#ifndef detclass_h #define detclass_h #include #include #include #include class TMyAxis: public TObject { public: Int_t axisid; Int_t nchannels; Float_t* chdata = nullptr;///< [nchannels] TMyAxis(): TObject() { clear(); } ~TMyAxis() { clear(); } TMyAxis(Int_t axisid_, Int_t nchannels_): TObject() { clear(); axisid = axisid_; nchannels = nchannels_; chdata = new Float_t[nchannels]; } TMyAxis(const TMyAxis& axis): TObject(axis) { axisid = axis.axisid; nchannels = axis.nchannels; chdata = new Float_t[nchannels]; for (Int_t i=0; i Clear(); } TMySample(Int_t sampleid_): TObject() { clear(); sampleid = sampleid_; fAxes -> Clear(); } TMySample(const TMySample& sample): TObject(sample) { sampleid = sample.sampleid; } // we add axes and increment the naxis counter. // they are in the TClonesArray sequentially so we pull those by // the number of the sample in the TClonesArray TMyAxis* AddAxis(Int_t axisid_, Int_t nchannels_) { TClonesArray &axes = *fAxes; auto axis = new ((axes)[naxis++]) TMyAxis( axisid_, nchannels_); return axis; } ClassDef(TMySample,1) // Initial version };// end MySample class class TMyEvent: public TObject { public: Int_t nevent; Int_t nsample; TClonesArray *fSamples; TMyEvent(){ fSamples = new TClonesArray("TMySample", 100); nevent = nsample = 0; } ~TMyEvent() { clear(); delete fSamples; fSamples = 0; } void clear() { nevent = nsample = 0; fSamples -> Clear(); } // we add samples and increment the nsample counter. TMySample* AddSample(Int_t sampleid_) { TClonesArray &samples = *fSamples; auto sample = new ((samples)[nsample++]) TMySample(sampleid_); return sample; } ClassDef(TMyEvent,1) // Initial version };// end MyEvent class #endif