Re: subbranches

From: Axel Naumann <axel_at_fnal.gov>
Date: Fri, 18 Mar 2005 14:35:52 -0600


Hi Chiara,
one way of doing that is by creating an class which represents a certain part of your hierarchy. I assume you have several entries of (sector1, sector2) pairs, i.e. you'd fill your tree more than once (otherwise you probably shouldn't use a TTree), and that you have several histos per strip object (otherwise get rid of the TString class, and store the list of histos directly in TPlate). In that case this should work:

class TStrip: public: TObject {
...
private:

   std::list<TH1*> fHists;
};

class TPlate: public TObject {
...
private:
std::list<TStrip> fStrips;
};

TClonesArray* ca=new TClonesArray("TPlate");

TTree* t=new TTree("ch_nofero", "tree of sectors, plates, and strips"); t->Branch("sectors", &ca);

You could also create one branch for each strip, named e.g. "Sector1Plate4Strip2". This is pretty efficient, but a bit ugly.

Axel.

chiara zampolli wrote:
> Dear rooters,
>
> we are trying to create a tree with four levels of subbranches, with
> the last one made up of histograms (TH1F):
>
> LEVEL1: sector1
> sector2
> |
> |
> / \
> / \
> LEVEL 2: plate1 plate2 plate1
> plate2
> |
> /
> LEVEL3: strip1 .... .....
> ....... ......
> |
> LEVEL4: histo1
>
> and so on. Could you suggest me how to create such a tree? Since we are
> not able to split more than once the tree we have defined.
> Till now, we have tried using the TClonesArray class and the
> TTree->Branch(....) method.
>
> Thank you.
> Cheers,
> ch & nofero
>
Received on Fri Mar 18 2005 - 21:36:01 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:06 MET