00001 00002 // 00003 // DemoNtupleRecord 00004 // 00005 // DemoNtupleRecord is a demo ntuple record class 00006 // 00007 // Author: S. Kasahara Feb,2003 00008 // 00010 00011 #ifndef DEMONTUPLERECORD_H 00012 #define DEMONTUPLERECORD_H 00013 00014 #include <iosfwd> 00015 #ifndef RECRECORDIMP_H 00016 #include "Record/RecRecordImp.h" // base class 00017 #endif 00018 #ifndef RECHEADER_H 00019 #include "Record/RecHeader.h" 00020 #endif 00021 00022 class TClonesArray; 00023 00024 // The user chooses the header class and uses this class as the 00025 // templated data member of the RecRecordImp base class. 00026 // In this example I've chosen to use the RecHeader class as the 00027 // header class, but the user can choose to use the RecHeader or 00028 // any of the derived header classes supplied in the Record package, 00029 // or write their own derived header class. 00030 class DemoNtupleRecord : public RecRecordImp<RecHeader> { 00031 00032 public: 00033 00034 // Constructors and Destructors 00035 DemoNtupleRecord(); 00036 DemoNtupleRecord(const RecHeader& header); 00037 virtual ~DemoNtupleRecord(); 00038 00039 // State changing methods 00040 void SetMyData(Int_t mydata) { fMyData = mydata; } 00041 00042 // State testing methods 00043 TClonesArray& GetVectors() { return *fVectors; } 00044 virtual std::ostream& Print(std::ostream& os) const; 00045 virtual void Print(const Option_t* option = "" ) const; 00046 00047 protected: 00048 00049 virtual void Init(); 00050 00051 private: 00052 00053 Int_t fMyData; // some generic data members 00054 //More examples: 00055 //Float_t fVertex[3]; // fixed size array, will be split 00056 //Int_t fNResults; // size of variable array 00057 //Double_t fResults[fNResult]; //[fNResult] variable size array 00058 //MyObject fObject; // MyObject data members will be split 00059 00060 // A TClonesArray is a specialized class for holding objects of 00061 // one type. An example of use is shown here. The -> is important 00062 // to tell root that the TClonesArray should not be deleted but 00063 // will be reused. The advantage of using TClonesArray is that they 00064 // are efficient and data members of objects will be split 00065 TClonesArray* fVectors; //-> array of TVector3 objects 00066 00067 ClassDef(DemoNtupleRecord,1) 00068 }; 00069 00070 #endif // DEMONTUPLERECORD_H 00071 00072 00073
1.3.9.1