[ROOT] Re: 2 copy of TClass in one TTree

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Feb 04 2002 - 11:45:00 MET


Hi Elena,

Use a '.' at the end of the branch name.

 _isltup->Branch("CDF_TRACKs.", "TTrkBlock", &Trks, bufsize,split);
 _isltup->Branch("Ele_TRACKs.", "TTrkBlock", &EleTrks, bufsize,split);

Note that to copy a subset of a Tree to a new Tree (subset of branches or
events), you do not need to write a class. You can use directly TTree::CopyTree.

Rene Brun

Elena Vataga wrote:
> 
>         Hello, rooters!
> 
> Would be most thankful to you for advice!
> 
> I was trying to do the following: save in TTree 2 branches:
>         1. all tracks found in event    (~50-60 tracks/event)
>         2. tracks with associated hit in EM calorimeter (~1-3 trks/event)
> 
> To do it, wrote a class TTracks derived from TObject and
> made 2 branches:
> 
>   TTrkBlock* Trks;              // TClonesArray of TTracks
>   TTrkBlock* EleTrks;
>   TTree* _isltup;
> ....
>   Trks    = new TTrkBlock;
>   EleTrks = new TTrkBlock;
> ...
>  _isltup->Branch("CDF_TRACKs", "TTrkBlock", &Trks, bufsize,split);
>  _isltup->Branch("Ele_TRACKs", "TTrkBlock", &EleTrks, bufsize,split);
> 
> The problem I have:
>                  each of branches by itself (when I book ONLY
> "CDF_TRACKs" or ONLY "Ele_TRACKs") is filled correctly.
> When I am trying to book both branches - they are identical
> because TTrack class is the same, so variables names are the same..
> Is there a way to use the same class to write in 2 different branches
> with different selection criteria?
> 
>         Thank you in advance,
>                                 Elena



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:40 MET