Re: TTree sub-branches

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Fri, 5 Mar 2010 10:54:44 +0100


Hi Jochen,

If you have your class testClass, you should do:

   tree->Branch("b1.", &testClass1)
   tree->Branch("b2.", &testClass2)
Note the "." at the end of the branch names (see doc of TTree::Branch for explanation).

If you do not want the class testClass and assuming :

   Int_t index1, index2;
   TClonesArray ar1, ar2, you can do directly

   tree->Branch("index1",&index1,..)
   tree->Branch("index2",&index2,..)
   tree->Branch("ar1",&ar1,..)
   tree->Branch("ar2",&ar2,..)
 

Rene Brun

Jochen Klein wrote:
> Dear all,
>
> I am wondering whether it is possible to create sub-branches for a TTree,
> i.e. I would like to create e.g. two branches as they would be created by
>
> class testClass {
> Int_t index;
> TClonesArray ar("someClass");
> }
>
> testClass testClass1;
> testClass testClass2;
>
> tree->Branch("b1", &testClass1)
> tree->Branch("b2", &testClass2)
>
> without implementing testClass (which has no functionality in my
> case). So
> can I create the branches b1/b2 and then add the branches for index
> and ar
> to each of them?
>
> The wanted behaviour could probably also be achieved by first creating
> folders
> but I am looking for a direct way of creating the tree structure.
>
> Thanks for your help,
> Jochen
>
Received on Fri Mar 05 2010 - 10:51:40 CET

This archive was generated by hypermail 2.2.0 : Fri Mar 05 2010 - 17:50:01 CET