Hi Carla, We discovered and fix a small problem in the generation of branch with TClonesArray inside TClonesArray and a split level of 3 or more. The data was properly saved and could be retrieved with no problem with object mapping. However TTree::Draw was confused with the result and could not drill down inside the 2nd TClonesArray. This is now fixed in the CVS repository. To work around the problem you can also set the split level to '2' (instead of 99). Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Carla Bleve Sent: Friday, February 22, 2002 3:53 AM To: roottalk@pcroot.cern.ch Subject: [ROOT] Splitting TClonesArray Hi rooters , I create a TTree Branch of MyEvent objects. MyEvent class contains a TClonesArray of MyTracks objects (tracks) and MyTrack contains a TClonesArray of MyPoint objects (points). Setting split level = 99 doesn't work: I can't access directly (trough TTree::Draw()) to MyPoint data members. Any idea? I list below a simplfied version of .h files. ******************************** MyEvent.h class MyEvent :public TObject { private: int nevent; TClonesArray * tracks; public: MyEvent(); void Add(MyTrack &thistrack, int i); ..... TClonesArray *GetTracks() {return tracks;}; MyTrack * GetTrackPtr(int index) { MyTrack * tmp = new MyTrack(*(dynamic_cast<MyTrack *>((*tracks)[index]))); return tmp; }; }; ******************************** MyTrack.h class MyTrack : public TObject { private: int ntrack; TClonesArray * points; public: MyTrack() {points=0;} ; ..... void operator=( const MyTrack & h); virtual ~MyTrack() { if (points!= NULL ) if (points->GetEntries() > 0) points->Clear(); void Add(MyPoint &thispoint, int i); TClonesArray *GetPoints() {return points;}; MyPoint * GetPointPtr(int index) { MyPoint * tmp = new MyPoint(*(dynamic_cast<MyPoint *>((*points)[index]))); return tmp; } }; ********************************* MyPoint.h class MyPoint : public TObject { private: int npoint; double x; double y; double z; public: MyPoint(int i=0, double _x=0.,double _y=0., double _z=0.) { npoint = i; x = _x; y = _y; z = _z; }; virtual ~MyPoint() {}; MyPoint( const MyPoint & h); void operator=( const MyPoint & h); double GetX() { return x;}; double GetY() { return y;}; double GetZ() { return z;}; int GetNpoint() { return npoint;}; }; -------------------------------------------------- Carla Bleve Dipartimento di Fisica & INFN Sez. Lecce via per Arnesano I-73100 Lecce (Italy) Tel: +39-(0)832-320-459 Fax: +39-(0)832-325-128 e-mail: bleve@le.infn.it
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:43 MET