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 14:28:51 -0500


Hi Vincent,

Thanks for providing this example.

The fix needed so that
  mytree->Draw("theTracks.Hits.r")
properly works, will be uploaded in CVS shortly.

The TBrowser still can not drill through a nested TClonesArray but TTreeFormula can. We will be correcting as soon as possible.

If you need the ability to drill through a nested collection, youc could use a STL collection For the nested collection. (It is easier to drill through them in the TBrowser since we can easily know the contained type without having to load the data).

Cheers,
Philippe.


From: Vincent Roberfroid [mailto:roberfroid_at_fynu.ucl.ac.be] Sent: Wednesday, May 18, 2005 9:31 AM
To: Philippe Canal
Cc: roottalk_at_root.cern.ch
Subject: Re: [ROOT] TClonesArray of Tracks with a TClonesArray of Hits as a data member

Here is my root file.
I also added a little macro to read the radius of the hits.

PS: To understand the variables included, the "Track" class is called here a "GTTrack" and the "Hit" class is called "MVDhit" :

  TTree*          outTTree;
  Int_t           Runnr;
  Int_t           Eventnr;

  Int_t           ngttrk2; // number of GTT2 tracks
  Int_t           nvctrk;  // number of offline (VC) tracks

  TObjArray*      GTT1;  // all the tracks for the online GTT code
  TObjArray*      GTT2;  // all the tracks for the current GTT code
  TObjArray*      VCT;   // all offline tracks

  Float_t         GTT2_xvtx; // vertex position
  Float_t         GTT2_yvtx;
  Float_t         GTT2_zvtx;

  Float_t         GTT1_xvtx; // vertex position
  Float_t         GTT1_yvtx;
  Float_t         GTT1_zvtx;

  Float_t         VC_xvtx;  // vertex position
  Float_t         VC_yvtx;
  Float_t         VC_zvtx;

And in my constructor :
 outTTree = new TTree("outTTree","Output TTree from the GTT code");   GTT1 = new TClonesArray("GTTrack",100);   GTT2 = new TClonesArray("GTTrack",100);   VCT = new TClonesArray("GTTrack",100);

  outTTree->Branch("event",&Eventnr,"event/I");   outTTree->Branch("run",&Runnr,"run/I");

  outTTree->Branch("ngttrk2",&ngttrk2,"ngttrk2/I");
  outTTree->Branch("ngttrk1",&ngttrk1,"ngttrk1/I");
  outTTree->Branch("nvctrk",&nvctrk,"nvctrk/I");

  outTTree->Branch("GTT1",&GTT1,memory,split);  // memory =4000 and split=2
  outTTree->Branch("GTT2",&GTT2,memory,split);   outTTree->Branch("VCT",&VCT,memory,split);

Philippe Canal wrote:

        Hi Vincent,         

        Please send me your ROOT file.         

        Philippe.                                                                       Received on Wed May 18 2005 - 21:28:57 MEST

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