[ROOT] TClonesArrays as Leaf in TTree

From: Mark Horner (mjhorner@lbl.gov)
Date: Thu Jul 29 2004 - 02:23:25 MEST


Hi Rooters

I want to make a TTree where every entry in a branch is a TClonesArray. 
My code seg-faults on the Fill() and simple script
to reproduce the behaviour is:

 void test()
{
  gROOT->LoadMacro("loadSharedLibraries.C");
  loadSharedLibraries();
  TTree mytree("mytree","Tree");
  TClonesArray *arr = new TClonesArray("StMuTrack",10);
  mytree->Branch("vobranch",&arr);
  StMuTrack* v0 = new StMuTrack();
  new((StMuTrack*)arr[0]) StMuTrack(*v0);
  new((StMuTrack*)arr[1]) StMuTrack(*v0);
  mytree->Fill();
}

I presume I just don't understand how the TTree handles the TClonesArray 
and that I have made some stupid error.

The class StMuTrack does has a working copy constructor and is available 
elsewhere in a TClonesArray so I don't think this is the problem but
the code is here:
http://www.star.bnl.gov/cgi-bin/cvsweb.cgi/StRoot/StMuDSTMaker/COMMON/StMuTrack.h?rev=1.9&content-type=text/x-cvsweb-markup

Could somone point out what I am doing wrong or send me in the correct 
general direction?

Thanks

Mark






This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET