To the use of a TBranch->Fill()

Hi,

I need to create a program to convert data files from binary format to a root format.
In this program, the data I’m looking for are:

  • a channel number
  • a marker (booleen) on this channel
  • the energy of the hit coded on this channel
  • the time of this hit

So I’ve decided to create a tree with one branch per channel. And in each branch three leaves for the three other parameters (marker, energy and time).
So I have to manipulate a tree with n branches that contains three identical leaves…
If I use the function mytree -> Fill() it will duplicate in each branch the same hit…
So I use mytree->GetBranch(“channel_x”)->Fill() (where x is the number of my channel).

The consequence is at the end of my conversion, if I try to use the TBrowser to visualize my tree its impossible… But if I do it via a routine it works perfectly.
And the use of TChains seems to be impossible…

Did I miss something?

Thank you for your response.

By calling TBranch’s Fill directly you do not set the number of entries for the TTree correctly (you could fix that by calling TTree::SetEntries).

[quote]If I use the function mytree -> Fill() it will duplicate in each branch the same hit[/quote]Most likely that is because you set the ‘user object’ address of all the branch to be the same … If you were to have n placeholder (one for each channel/branch) then it should work.

Cheers,
Philippe