Basic problems with TTrees

Hi, I`m trying to use TTrees to do some basic fitting work. As usual I have looked through the reference guide, etc. but havent had much luck.

Lets say I have a TNtuple with branches “x:y:z”, and that it has 5 entries.

question 1: How do I access these values of each entry? I.E. what do I type to recieve (as a float) the nth entry’s x value?

question 2: For a particular entry, how do I modify the value in one of the branches? I.E. if, for each entry, I want the z category to be changed to a new value based on the entry’s x and y values, how can i do so?

I have some more questions, but I think if I can get the above ones answered I can figure the rest out myself.

Thanks, Andy

see the tutorials about Trees, in particular tree1.C

read also the TTree class description, section “Adding a Branch to an Existing Tree” at


Thanks Rene, and sorry I didnt look thoroughly enough in the manuals for a solution.