Re: [ROOT] TTree::MakeSelector and TClonesArray

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Apr 25 2001 - 19:21:24 MEST


Hi Stefan,
   
   In your ProcessCut function, do:
   
   b_myparticle_->GetEntry(0);  
   b_myparticle_momentum->GetEntry(0); 
   cout << myparticle_momentum[0] << endl;
   
In case you have a TClonesArray, you must read first the number of 
elements in the array. This number is obtained by reading the
branch with name myparticle_
   
Rene Brun

Stefan Steinbeck wrote:
> 
> Dear Root-ers,
> 
> for the analysis of a tree (containing some TClonesArray's) I would like
> to use the class, which is created by the TTree::MakeSelector method.
> It is somehow not possible for me to access members of the TClonesArray,
> which the GetEntry method.
> For example assume a tree 'mytree' which a TClonesArray  'myparticle' and
> a member 'momentum'. To access the first entry of 'momentum',  I'll tried
> to following:
> 
>         b_myparticle_momentum->GetEntry(1);
>         cout << myparticle_momentum[0] << endl;
> 
> Can you tell me the correct way?
> 
> Thanks a lot for your help,
>         Stefan



This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:51:23 MEST