Problems with TTree

Hello, all:
I am trying to create a TTree with several branches, each of which has about 7 leaves attached to it, i.e.:
Tree < Branch1 <leaf1 leaf2 leaf3 …
Branch2<leaf1 leaf2 leaf3…

Branchn< leaf1 leaf2 leaf3

etc. The tricky part is that I have to fill the branches sequentially, and to boot they won’t each have the same number of entries. According to the manual, you are supposed to be able to call the TBranch->Fill() method just as you would for the TTree to fill one branch at a time, but when I do this and then try to examine the results, my tree is empty. Is there some simple trick to this that I am missing? If I instead use the TTree->Fill() method, then each branch ends up having all the entries of every branch! Is it just that there is no provision for having branches on a single tree with different numbers of entries?
Thanks in advance!
Ben

It looks like you are confusing a branch and a Tree.
Note that you can fill one branch only by calling TBranch::Fill
instead of TTree::Fill.
To call TBranch::Fill, simply use the pointer to the branch returned
by TTree::Branch

Rene

I think I wasn’t terribly clear on the problem in my first post. I’ve created the tree and branches and filled each branch seperately. Then a call to TTree::Print() yields something like the following:

root [39] theRunTree->Print()


*Tree :theRunTree: Tallies of Photon Data *
*Entries : 0 : Total = 11518 bytes File Size = 8406 *

  •    :          : Tree compression factor =   1.00                       *
    

*Br 0 :Event0. : BirthX/F:BirthY:BirthZ:BirthLambda:DistBefore: *

  •     | ReflectBefore/I:WLSZ/F:WLSLambda:DistAfter                       *
    

*Entries : 145 : Total Size= 6602 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 1 :Event1. : BirthX/F:BirthY:BirthZ:BirthLambda:DistBefore: *

  •     | ReflectBefore/I:WLSZ/F:WLSLambda:DistAfter                       *
    

*Entries : 87 : Total Size= 4514 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

So that the branches show entries, but the top level tree shows 0 entries. My problem is that all of the convenient functions (e.g. Show(),Scan(), and the tree viewer) to access the data rely on the number of entries in the TTree. I can use the TTree::SetEntries() function, which then lets me access the data in the branches, but then I end up with duplicate data on any branch with less than that number of entries (e.g. if I call theRunTree->SetEntries(145), then, since the branch Event1 only has 87 entries, entries 87-144 point to entry 86, which makes for some distorted histograms, as you can imagine.)
I can’t think of a suitable way around this except to make each branch be its own tree.
Ben