Hi Rene, thank you very much for the prompt replay. For our case, what would you suggest? Shall we try a different approach, such as TArrayD or TClonesArray to have arrays with variable lenght in a class or at the moment this is not possible yet? Many thanks and regards, Andrea On Thu, 2 Nov 2000, Rene Brun wrote: > Hi Andrea, > > Data members like SOMETYPE *fData //[fNdata] > are OK with the non-split mode, but not with the split mode. > See the recently announced Users Guide for more info. > > We are planning to support also this case in split mode in the near future. > > Rene Brun > > > Andrea Fontana wrote: > > > > Dear Rooters, > > we want to save an array with variable length in a tree. > > The array is a data member of a class and the tree branches are > > created according to the class definition in split mode. > > The array length is also member of the class. > > > > We tried the following class definition: it is compiled correctly, > > but then the program crashes on execution. > > > > What did we not understand? > > > > Many thanks, > > Andrea Fontana & Germano Bonomi > > > > THenaEvent.h: > > ============= > > > > #ifndef ATH_HenaEvent > > #define ATH_HenaEvent > > > > // > > // > > // Athena Event Class > > // > > // > > > > #include "TObject.h" > > #include "TArrayD.h" > > > > class THenaEvent : public TObject { > > > > protected: > > Int_t fSlot; > > Int_t fRawEventNum; > > Char_t fRawEventTime[13]; > > Int_t fTOFEventNum; > > Int_t fSIS_time; > > Int_t fNData; > > Double_t *fData; //[fNData] > > Int_t fType; > > public: > > THenaEvent(); > > ~THenaEvent(); > > > > void SetHead(Int_t, Int_t, Char_t *,Int_t, Int_t); > > void SetData(Int_t, Int_t, Double_t *); > > > > Int_t GetSlot() {return fSlot;} > > Char_t * GetRawTime() {return fRawEventTime;} > > Int_t GetRawNum() {return fRawEventNum;} > > Int_t GetTOFNum() {return fTOFEventNum;} > > Int_t GetSISTime() {return fSIS_time;} > > Int_t GetNData() {return fNData;} > > Int_t GetType() {return fType;} > > Double_t * GetData() {return fData;} > > > > ClassDef(THenaEvent,1) > > }; > > #endif > > > > THenaEvent.C: > > ============= > > > > #include "THenaEvent.h" > > > > ClassImp(THenaEvent); > > > > THenaEvent::THenaEvent() > > { > > } > > THenaEvent::~THenaEvent() > > { > > } > > void THenaEvent::SetHead(Int_t Slot, Int_t RawEventNum, Char_t *RawEventTime, Int_t Type, Int_t NData) > > { > > fSlot=Slot; > > fRawEventNum=RawEventNum; > > strcpy(fRawEventTime,RawEventTime); > > fType=Type; > > fNData=NData; > > } > > void THenaEvent::SetData(Int_t TOFEventNum, Int_t SIS_counts, Double_t *Data) > > { > > for(int i=0;i<fNData;i++){ > > fData[i]=Data[i]; > > } > > fTOFEventNum=TOFEventNum; > > fSIS_time=SIS_counts; > > } >
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET