First I would like to say, that imho TTrees are awesome and I would love to see more of my students start using TTrees right away. In my opinion TTree::ReadFile() is a great way to let beginners enjoy the awesome features of quick look data analysis via TTree:Draw() without the need to write lengthy code.
However, I have two issues with the baviour of TTree::ReadFile() I would like to bring up here.
Issue 1:
From the documentation of the method http://root.cern.ch/root/html/TTree.html#TTree:ReadFile:
One may get the impression, that a file like this (named “test.txt”)
# ignored
a/I:b/F:c/D
1 2.3 3.9
# ignored
4 2.3 1.234
can be parsed easily with these two lines of code on the ROOT cmd line
root [0] t = TTree()
(class TTree) [...]
root [1] r.ReadFile("test.txt")
But this is not the case, since the tree descriptor really needs to be the very first line of the file.
I wonder if this could be changed like:
The tree descriptor is the first valid line found in the file … .i.e the 2nd line in my example.
Issue2:
External programs might create textual data, which is either infinity or even not-a-number. Usually represented as text by “NaN”, “nan”, “inf”, “-inf” or the like. However ReadLine() is currently not able to correctly parse these representations. I once found a post here, which elaborated the reason for it, but I can’t find it anymore.
However I remember the reason to be the behaviour of the >> operator of std::ifstream. It simply can’t deal with “Nan” or the like.
There is a thread on Stack Overflow discussing this as well:
http://stackoverflow.com/questions/11420263/is-it-possible-to-read-infinity-or-nan-values-using-input-streams
And I believe one might solve this issue by doing something similar to this:
http://ideone.com/qIFVo.
I am not sure if one can consider any of these two issues as a bug, since it is like this since a long time now. However maybe one could still consider changing the behaviour of ReadLine() since it will most certainly not be a compatibility issue.
Thank you for your attention.