Hi Hamlet, The problem has been fixed. Please try the version in the CVS repository and let me know if you any other problems. Cheers, Philippe -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Hamlet Sent: Tuesday, July 22, 2003 6:02 PM To: roottalk Subject: [ROOT] Trees, ClonesArrays and an obsolete call error Hello! While messing with TTrees, I've run into the following error: Error in <TBranchElement::GetDataMemberOffset>: obsolete call with (PhotonsList,Clusters) The object I'm going to write in TTree is something which recall this scheme: // start of code class PhotonsList: public TObject { public: TClonesArray* pPhotons; //photons data PhotonsList() { pPhotons = NULL; } ~PhotonsList() { if (!pPhotons) return; pPhotons->Delete(); delete pPhotons; } void Init() { pPhotons = new TClonesArray(TObject::Class(), 8); } ClassDef(PhotonsList,1) //list of photons for an event }; // PhotonsList class STreeEvent: public TObject { public: PhotonsList Clusters; //original photons data void Init() { Clusters.Init(); } ClassDef(STreeEvent,1) //event encapsulated in a tree }; // STreeEvent // end of code Linking header file is: // start of code #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class PhotonsList; #pragma link C++ class STreeEvent; #endif // end of code while the object file (namely, STreeEvent.cpp) is the couple of calls to macro to implement classes (ClassImp). That is to say, I've a class fated to be main tree branch (STreeEvent) which directly holds a TObject derived class, which has a pointer to a clones-array of photons (a TObject or whatever); this pointer is not initted in constructor since some tutorials teach so. Now with CINT and ROOT 3.05/06 the sequence: // loads object code to CINT: [0] .x STreeEvent.so // create and init an object: [1] STreeEvent* pEvent = new STreeEvent; pEvent->Init(); // create a tree and a branch with that object as address: [2] TTree tree; tree.Branch("Event", "STreeEvent", &pEvent); that message prints out. It's very reasonable that a call to TBranchElement::GetDataMemberOffset(PhotonsList,Clusters) fails, since there is no "Clusters" field in PhotonsList and Clusters is a field /of type/ PhotonsList (in another object). I could bet that with 3.05/05 this did not happen, but I'm not sure. I've no idea whether this is a message that can be safely ignored or not. Written enough. Any suggestion? -- Hamlet
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET