Re: [ROOT] TRefArray usage

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Oct 24 2002 - 23:05:27 MEST


Hi Sue,

Following TRefs in TTree::Draw is currently not implemented.
We plan to support this in the next version (I discussed this
during the Root workshop). The main difficulty is in loading
automatically the branch referenced by the TRef.
With the Event example, however, you can do:
T.Draw("event.GetLastTrack()->GetPt()")

Rene Brun

On Wed, 23 Oct 2002, Susan Kasahara wrote:

> Hi roottalk,
> I have a question about using TRefArray objects in the TTree::Draw
> method.
> In the $ROOTSYS/test/Event example, there is a datamember:
>   TRefArray *fHighPt;  // array of High Pt tracks only
> in the Event class that is filled with references to a subset of the tracks stored
> in the
>   TClonesArray *fTracks; //->array with all tracks
> array.
> After running the executable "Event" to generate an output file Event.root, I am able
> to open this file in a root session and plot datamembers of the fTracks array, e.g.
> 
>    t -> Draw("fEvtHdr.GetEvtNum()","fTracks[0].GetPx()>0");
> 
> works and plots a histogram of event numbers for all events in which the first track
> has a positive Px.
> But if I try to use the fHighPt TRefArray in a similar way,e.g.
>    t -> Draw("fEvtHdr.GetEvtNum()","((Track*)fHighPt->At(0))->GetPx()>0");
> I receive the error message:
> Error in <TTreeFormula::DefinedVariable>: Unknown method:At(0).).GetPx()
> 
> *ERROR 26 :
>  Unknown name : "((Track*)fHighPt.At(0)).GetPx()"
> 
> So, I'm wondering, what is the correct way to use the fHighPt branch in the TTree::Draw,
> TTree::Scan, etc.?
> 
> Thanks for the help,
> -Sue
> 



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