How to read entries from a Ttree?

I have a problem in reading a TTree. I have a TTree with 3 branches and I would like to read one of these branches.
Since I would like to know the variable value given by TLeaf::GetValue() ,
I ask to the TBranch class the leaves number with the code (the answer is 1):

TLeaf * myLeaf = (TLeaf *) (numtel->GetListOfLeaves()+0);
// where numtel is the TBranch class pointer, previously defined as
// TBranch *numtel=tree->GetBranch(“numtel”);
for(int n=0;nGetEntry(n);
The problem is that GetValue() gives a NAN result, as if the class was not initialized… instead of the expected value, that coherently with my data structure, is an integer between zero and 1192.

Is the classes and methods use right to get the value? Should I use FillLeaves()?
Using the TLeaf class pointer of the TTree class, like
TLeaf *mia = T->GetLeaf("…")
what code/string shell I use to get the “numtel” value for each entry, asking to the TLeaf?
Are there any alternative? How can I write my code?

Thank you!



TLeaf *leaf = tree->GetLeaf("numtel"); for (int i=0.... leaf->GetBranch()->GetEntry(i); double numtel = leaf->GetValue(); } Rene

Hi Rene,
thank you very much for your help!
My code now works on well!