[ROOT] TRefArray usage

From: Susan Kasahara (schubert@physics.umn.edu)
Date: Wed Oct 23 2002 - 22:42:50 MEST


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