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

From: Vincent Roberfroid <>
Date: Wed, 18 May 2005 11:09:42 +0200

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*/

  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 - 11:08:27 MEST

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