Hi Anthony, the TObjArray::Streamer() is called via the operator<<() in: R__b << fTracks; Note that the static TObjArray *fgTracks is not written out. Static objects should be seperately written. Cheers, Fons. Anthony Faust wrote: > > Good morning Rooters, > > I would like to write the following class, which includes a TObjArray, > to a ROOT file. However, the Streamer function for the 'TObjArray* fTracks' > pointer, generated by rootcint does, not call a Streamer function for the > TObjArray, as can be seem in the attached Streamer function. > > I have lloed for similar examples but could not find any. I am just > getting started with root, so any helpful tips would be appreciated. > > Thanks. > > #ifndef TXrayEvent_hh > #define TXrayEvent_hh 1 > > //////////////////////////////////////////////////////////////// > // // > // TXrayEvent // > // Description of the event parameters // > // // > //////////////////////////////////////////////////////////////// > > #include "TObjArray.h" > #include <iostream.h> > > #include "TXrayTrack.hh" > > #ifdef G4ROOT > #include "G4Event.hh" > #endif > > class TXrayEvent : public TObject { > > public: > TXrayEvent(); > virtual ~TXrayEvent(); > > Int_t GetRunID() const { return frunID; } > Int_t GetEvtID() const { return feventID; } > Int_t GetDate() const { return fDate; } > > Int_t GetNTrack() const { return fNtrack; } > UInt_t GetFlag() const { return fFlag; } > > TObjArray *GetTracks() const { return fTracks; } > > void Clear(Option_t* option=""); > void Reset(Option_t* option=""); > > #ifdef G4ROOT > public: > void Fill (const G4Event*); > void AddTrack(const XrayTrajectory*); > #endif > > private: > > Int_t frunID; > Int_t feventID; > Int_t fDate; > > Int_t fNtrack; > UInt_t fFlag; > > TObjArray *fTracks; > static TObjArray *fgTracks; > > ClassDef(TXrayEvent,1) //Event structure > }; > > #endif > > /////////////////////////////////// > // rootcint generated Streamer // > /////////////////////////////////// > > void TXrayEvent::Streamer(TBuffer &R__b) > { > // Stream an object of class TXrayEvent. > > if (R__b.IsReading()) { > Version_t R__v = R__b.ReadVersion(); if (R__v) { } > TObject::Streamer(R__b); > R__b >> frunID; > R__b >> feventID; > R__b >> fDate; > R__b >> fNtrack; > R__b >> fFlag; > R__b >> fTracks; > } else { > R__b.WriteVersion(TXrayEvent::IsA()); > TObject::Streamer(R__b); > R__b << frunID; > R__b << feventID; > R__b << fDate; > R__b << fNtrack; > R__b << fFlag; > R__b << fTracks; > } > } > > > _____________ > Anthony A. Faust | Anthony.Faust@dres.dnd.ca > Defence Research Establishment Suffield | PH: (403) 544-5362 > Box 4000, Medicine Hat, Alberta, CANADA T1A 8K6 | FAX: (403) 544-4704 -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:43 MET