Re: TClonesArray of Tracks with a TClonesArray of Hits as a data member

From: Vincent Roberfroid <roberfroid_at_fynu.ucl.ac.be>
Date: Wed, 18 May 2005 15:18:59 +0200


Hi Philippe,

Thank you for your answer.
I used root 4.02/00.
But it does not work with root 4.04/02.
When I click on "theTracks.Hits" I get also the same message : Warning in <TSelectorDraw::ProcessFillObject>: Not implemented for TClonesArray

I have also an new variable in the Track branch : "@size". But when I click on it I get the following message : Error in <TTreeFormula::DefinedVariable>: Unknown method:GetEntries() in Track

*ERROR 30 :
 Bad numerical expression : "Track.GetEntries()"

It is maybe related ?

Vincent

Philippe Canal wrote:

>>So, how can I do to see the variables r, phi and z of a hit belonging to
>>a Track ? The split level is good ? Is it possible to have a TClonesArray
>>
>>
>in a
>
>
>>TClonesArray include in a TTree ?
>>
>>
>
>It is possible to have a TClonesArray within a TClonesArray. However they
>can not be split. To see the data member in the Browser you should use
>ROOT 4.04/02 (note that you forgot to mention which version of ROOT you
>were using).
>
>Cheers,
>Philippe.
>
>-----Original Message-----
>From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch]
>On Behalf Of Vincent Roberfroid
>Sent: Wednesday, May 18, 2005 4:10 AM
>To: roottalk_at_pcroot.cern.ch
>Subject: [ROOT] TClonesArray of Tracks with a TClonesArray of Hits as a data
>member
>
>Dear root users,
>
>I have a TTree containg a TClonesArray of Tracks (a class derivating
>from TObject).
>And a data member of Track is also a TClonesArray containing Hits (an
>other class derivating from TObject).
>So here is the structure :
>
>class Track : public TObject
>{
> public :
>
> double R; /** track parameters **/
> double phi0;
> int Nhits;
> ...
> TClonesArray *Hits; /* all the hits in a TClonesArray */
>}
>Track::Track(axial_track *atrack) /* the constructor - axial_track is
>just a struct*/
>{
> R=atrack->R;
> phi0=atrack->phi0;
> for(int i=0; i<Nhits;i++)
> new(Hits->operator[](i)) Hit(atrack->mvdhit[i]); /* Fill the
>TClonesArray */
>}
>//-----------------------------------
>class Hit : public TObject
>{
> public :
>
> float r; /** r-phi cluster position **/
> float phi;
> float z;
> ...
>}
>
>And in the main :
>TTree *outTTree = new TTree("outTTree","Output TTree");
>TCLonesArray *theTracks = new TClonesArray("Track",100);
>outTTree->Branch("theTracks",&theTracks,4000,2);
>
>The code runs well, the variables R, phi0 and Hits are visible in the
>Track branch, but when I click on Hits I get the following message :
>Warning in <TSelectorDraw::ProcessFillObject>: Not implemented for
>TClonesArray
>
>So, how can I do to see the variables r, phi and z of a hit belonging to
>a Track ?
>The split level is good ? Is it possible to have a TClonesArray in a
>TClonesArray include in a TTree ?
>And is it possible to use the TreeViewer with it ?
>
>Thanks a lot.
>Vincent
>
>
>
>
Received on Wed May 18 2005 - 15:17:37 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:08 MET