Re: TTree BranchClones

Rene Brun (brun@hpbrun.cern.ch)
Tue, 3 Feb 1998 00:33:54 +0100 (MET)


In your tree->Branch sattement below, the second parameter is wrong.
You must give the address of the pointer, not its value,
ie &event->fTracks

Rene Brun

On Mon, 2 Feb 1998, Axel Schwank wrote:

> Dear Rooters,
>
> I have a problem creating branches in case each event consits of several
> TClonesArrays; this is the case C described in the TTree class manual.
> The constructor for creating branches of this type is
>
> TTree::Branch(const Text_t *name, TClonesArray *list, Int_t bufsize, Int_t
> split)
>
> Unfortunately, there is no example given for this method of how to create
> and fill a tree. I want to use this method because I don't want to store
> all the data of one event, but only a certain subset, e.g. tracks.
> For this purpose, method C seems apropriate.
>
> The event class I am using is similar to the famous class Event used in
> the ROOT tutorials, where the data member fTracks is a pointer to a
> TClonesArray, which itself is built of the class Track.
> So I try to create a branch like this
>
> Int_t bufsize = 64000;
> Int_t split = 1;
> event = new Event();
> TTree *tree = new TTree("T","Example of a tree of TBranchClones");
> TBranch *bTracks = tree->Branch("Tracks",event->fTracks,bufsize,split);
>
> But invoking this constructor does not create the desired branch bTracks,
> as can be recognized by looking at the address of bTracks which is 0.
>
> What am I doing wrong ?
> Could there be a little example and documentation on this method of
> creating a tree with several branches, when the branches should consist of
> TClonesArrays (method C) ?
>
> Thanks for the support !!!
>
>
> ********************************************************************************
>
> Axel Schwank
>
> Hoffmann-von-Fallersleben-Strasse 15 DESY H1-F22
> 21029 Hamburg Notkestrasse 85
> Tel (+49 40) 7219895 22607 Hamburg
> Rm. 1b / 269
> Tel (+49 40) 8998-3560
> Fax (+49 40) 8998-4385
>
> e-mail schwank@mail.desy.de
> Quix 0165-6-2705109
>
> ********************************************************************************
>
>
>