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

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Wed, 18 May 2005 07:51:14 -0500


> 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 - 14:52:03 MEST

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