]>
Commit | Line | Data |
---|---|---|
ffa6d63b | 1 | #ifndef ALIEMCALGETTER_H |
2 | #define ALIEMCALGETTER_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
88cb7938 | 5 | |
ffa6d63b | 6 | /* $Id$ */ |
88cb7938 | 7 | |
8 | //_________________________________________________________________________ | |
ffa6d63b | 9 | // A singleton that returns various objects |
10 | // Should be used on the analysis stage to avoid confusing between different | |
11 | // branches of reconstruction tree: e.g. reading RecPoints and TS made from | |
12 | // another set of RecPoints. | |
d75bea67 | 13 | // |
ffa6d63b | 14 | // The objects are retrived from folders. |
d75bea67 | 15 | //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) |
16 | // | |
ffa6d63b | 17 | |
88cb7938 | 18 | |
ffa6d63b | 19 | // --- ROOT system --- |
88cb7938 | 20 | #include "TObject.h" |
1ce25ac8 | 21 | #include "TClonesArray.h" |
22 | class TParticle ; | |
23 | class TTree ; | |
ffa6d63b | 24 | |
25 | // --- Standard library --- | |
173558f2 | 26 | |
ffa6d63b | 27 | // --- AliRoot header files --- |
88cb7938 | 28 | #include "AliConfig.h" |
29 | ||
30 | // #include "AliRun.h" | |
88cb7938 | 31 | #include "AliEMCALHit.h" |
d64c959b | 32 | #include "AliEMCALRecParticle.h" |
88cb7938 | 33 | #include "AliEMCALDigitizer.h" |
34 | #include "AliEMCALSDigitizer.h" | |
1ce25ac8 | 35 | #include "AliEMCALLoader.h" |
36 | class AliEMCAL ; | |
37 | class AliEMCALGeometry ; | |
38 | class AliEMCALClusterizer ; | |
39 | class AliEMCALRecPoint ; | |
1ce25ac8 | 40 | class AliEMCALTrackSegmentMaker ; |
41 | class AliEMCALTrackSegment ; | |
42 | class AliEMCALPID ; | |
88cb7938 | 43 | class AliEMCALBeamTestEvent ; |
44 | ||
173558f2 | 45 | |
ffa6d63b | 46 | class AliEMCALGetter : public TObject { |
47 | ||
88cb7938 | 48 | public: |
6b10bdac | 49 | AliEMCALGetter() { |
50 | // ctor: this is a singleton, the ctor should never be called but cint needs it as public | |
88cb7938 | 51 | Fatal("ctor", "AliEMCALGetter is a singleton default ctor not callable") ; |
ffa6d63b | 52 | } |
39200c71 | 53 | AliEMCALGetter(const AliEMCALGetter & obj):TObject(obj) { |
ffa6d63b | 54 | // cpy ctor requested by Coding Convention |
88cb7938 | 55 | Fatal("cpy ctor", "not implemented") ; |
ffa6d63b | 56 | } |
57 | ||
05a92d59 | 58 | AliEMCALGetter & operator = (const AliEMCALGetter & ) { |
59 | // assignement operator requested by coding convention, but not needed | |
88cb7938 | 60 | Fatal("operator =", "not implemented") ; |
05a92d59 | 61 | return *this ; |
62 | } | |
ffa6d63b | 63 | virtual ~AliEMCALGetter() ; |
64 | ||
88cb7938 | 65 | //=========== Instantiators ================ |
66 | static AliEMCALGetter * Instance(const char* headerFile, | |
e191bb57 | 67 | const char* version = AliConfig::GetDefaultEventFolderName(), |
88cb7938 | 68 | Option_t * openingOption = "READ" ) ; |
69 | static AliEMCALGetter * Instance() ; | |
6b10bdac | 70 | void OpenFile(const char* headerFile, |
71 | const char* version = AliConfig::GetDefaultEventFolderName(), | |
72 | Option_t * openingOption = "READ" ); | |
88cb7938 | 73 | |
74 | static void Print() ; | |
75 | ||
76 | // //=========== General information about run ============== | |
09884213 | 77 | Bool_t IsLoaded(TString tree) const { return fLoadingStatus.Contains(tree) ; } |
78 | void SetLoaded(TString tree) { fLoadingStatus += tree ; } | |
88cb7938 | 79 | |
80 | Int_t MaxEvent() const ; | |
81 | Int_t EventNumber() const ; | |
82 | Bool_t VersionExists(TString & opt) const ; | |
83 | UShort_t EventPattern(void) const ; | |
84 | Float_t BeamEnergy(void) const ; | |
85 | ||
86 | // //========== EMCALGeometry and EMCAL ============= | |
87 | AliEMCAL * EMCAL() const ; | |
88 | AliEMCALGeometry * EMCALGeometry() const ; | |
89 | ||
90 | // //========== Methods to read something from file ========== | |
09884213 | 91 | void Event(Int_t event, const char * opt = "HSDRP") ; |
92 | void Track(Int_t itrack) ; | |
88cb7938 | 93 | |
94 | // //-----------------now getter's data-------------------------------------- | |
95 | // // AliEMCALCalibrationDB * CalibrationDB(){return fcdb; } | |
96 | // // void ReadCalibrationDB(const char * name, const char * filename) ; | |
05a92d59 | 97 | |
98 | //=========== Primaries ============ | |
88cb7938 | 99 | // TTree * TreeK(TString filename="") ; |
88cb7938 | 100 | TParticle * Primary(Int_t index) const ; |
6b10bdac | 101 | Int_t NPrimaries() const; |
09884213 | 102 | TParticle * Secondary(const TParticle * p, Int_t index=1) const ; |
88cb7938 | 103 | |
104 | // //=========== Hits ================= | |
105 | // TTree * TreeH(TString filename="") ; | |
1ce25ac8 | 106 | TClonesArray * Hits(void) const ; |
09884213 | 107 | AliEMCALHit * Hit(Int_t index) const { return dynamic_cast<AliEMCALHit*>(Hits()->At(index) );} |
88cb7938 | 108 | TTree * TreeH() const ; |
109 | ||
05a92d59 | 110 | //=========== SDigits ============== |
1ce25ac8 | 111 | TClonesArray * SDigits() const ; |
09884213 | 112 | AliEMCALDigit * SDigit(Int_t index) const { return static_cast<AliEMCALDigit *>(SDigits()->At(index)) ;} |
88cb7938 | 113 | TTree * TreeS() const ; |
114 | AliEMCALSDigitizer * SDigitizer() ; | |
115 | ||
1ce25ac8 | 116 | TString GetSDigitsFileName() const { return EmcalLoader()->GetSDigitsFileName() ; } |
117 | Int_t LoadSDigits(Option_t* opt="") const { return EmcalLoader()->LoadSDigits(opt) ; } | |
118 | Int_t LoadSDigitizer(Option_t* opt="") const { return EmcalLoader()->LoadSDigitizer(opt) ; } | |
119 | Int_t WriteSDigits(Option_t* opt="") const { return EmcalLoader()->WriteSDigits(opt) ; } | |
120 | Int_t WriteSDigitizer(Option_t* opt="") const { | |
88cb7938 | 121 | return EmcalLoader()->WriteSDigitizer(opt) ; } |
122 | ||
05a92d59 | 123 | //========== Digits ================ |
1ce25ac8 | 124 | TClonesArray * Digits() const ; |
09884213 | 125 | AliEMCALDigit * Digit(Int_t index) const { return static_cast<AliEMCALDigit *>(Digits()->At(index)) ;} |
88cb7938 | 126 | TTree * TreeD() const ; |
127 | AliEMCALDigitizer * Digitizer() ; | |
1ce25ac8 | 128 | TString GetDigitsFileName() const { return EmcalLoader()->GetDigitsFileName() ; } |
129 | Int_t LoadDigits(Option_t* opt="") const { return EmcalLoader()->LoadDigits(opt) ; } | |
130 | Int_t LoadDigitizer(Option_t* opt="") const { | |
88cb7938 | 131 | return EmcalLoader()->LoadDigitizer(opt) ; } |
1ce25ac8 | 132 | Int_t WriteDigits(Option_t* opt="") const { return EmcalLoader()->WriteDigits(opt) ; } |
133 | Int_t WriteDigitizer(Option_t* opt="") const { | |
88cb7938 | 134 | return EmcalLoader()->WriteDigitizer(opt) ; } |
135 | ||
05a92d59 | 136 | //========== RecPoints ============= |
fdebddeb | 137 | TObjArray * ECARecPoints() const; |
70a93198 | 138 | AliEMCALRecPoint * ECARecPoint(Int_t index) const{ return static_cast<AliEMCALRecPoint *>(ECARecPoints()->At(index)) ;} |
88cb7938 | 139 | TTree * TreeR() const ; |
140 | AliEMCALClusterizer * Clusterizer() ; | |
1ce25ac8 | 141 | TString GetRecPointsFileName() const { return EmcalLoader()->GetRecPointsFileName() ; } |
142 | Int_t LoadRecPoints(Option_t* opt="") const { return EmcalLoader()->LoadRecPoints(opt) ; } | |
143 | Int_t LoadClusterizer(Option_t* opt="") const { | |
88cb7938 | 144 | return EmcalLoader()->LoadClusterizer(opt) ; } |
1ce25ac8 | 145 | Int_t WriteRecPoints(Option_t* opt="") const { return EmcalLoader()->WriteRecPoints(opt) ; } |
146 | Int_t WriteClusterizer(Option_t* opt="") const { | |
88cb7938 | 147 | return EmcalLoader()->WriteClusterizer(opt) ; } |
148 | ||
149 | //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) { | |
1ce25ac8 | 150 | TClonesArray * TrackSegments() const ; |
09884213 | 151 | AliEMCALTrackSegment * TrackSegments(Int_t index) const { return static_cast<AliEMCALTrackSegment *>(TrackSegments()->At(index)) ;} |
88cb7938 | 152 | TTree * TreeT() const ; |
153 | AliEMCALTrackSegmentMaker * TrackSegmentMaker() ; | |
1ce25ac8 | 154 | TString GetTracksFileName() const { return EmcalLoader()->GetTracksFileName() ; } |
155 | Int_t LoadTracks(Option_t* opt="") const { return EmcalLoader()->LoadTracks(opt) ; } | |
156 | Int_t LoadTrackSegementMaker(Option_t* opt="") const { | |
88cb7938 | 157 | return EmcalLoader()->LoadTrackSegmentMaker(opt) ; } |
1ce25ac8 | 158 | Int_t WriteTracks(Option_t* opt="") const { return EmcalLoader()->WriteTracks(opt) ; } |
159 | Int_t WriteTrackSegmentMaker(Option_t* opt="") const { | |
88cb7938 | 160 | return EmcalLoader()->WriteTracker(opt) ; } |
516fff8e | 161 | //========== RecParticles =========== |
173558f2 | 162 | |
1ce25ac8 | 163 | TClonesArray * RecParticles() const ; |
e3bb24cf | 164 | AliEMCALRecParticle * RecParticle(Int_t index) const { return static_cast<AliEMCALRecParticle *>(RecParticles()->At(index)) ;} |
88cb7938 | 165 | TTree * TreeP() const ; |
166 | AliEMCALPID * PID() ; | |
1ce25ac8 | 167 | TString GetRecParticlesFileName() const { return EmcalLoader()->GetRecParticlesFileName() ; } |
168 | Int_t LoadRecParticles(Option_t* opt="") const { return EmcalLoader()->LoadRecParticles(opt) ; } | |
169 | Int_t LoadPID(Option_t* opt="") const { | |
88cb7938 | 170 | return EmcalLoader()->LoadPID(opt) ; } |
1ce25ac8 | 171 | Int_t WriteRecParticles(Option_t* opt="") const { return EmcalLoader()->WriteRecParticles(opt) ; } |
172 | Int_t WritePID(Option_t* opt="") const { | |
88cb7938 | 173 | return EmcalLoader()->WritePID(opt) ; } |
174 | ||
175 | ||
176 | void SetDebug(Int_t level) {fgDebug = level;} // Set debug level | |
1ce25ac8 | 177 | void PostClusterizer(AliEMCALClusterizer * clu) |
88cb7938 | 178 | const{EmcalLoader()->PostClusterizer(clu) ; } |
179 | void PostPID(AliEMCALPID * pid) | |
180 | const{EmcalLoader()->PostPID(pid) ; } | |
181 | void PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tr) | |
182 | const{EmcalLoader()->PostTrackSegmentMaker(tr) ; } | |
183 | void PostSDigitizer (AliEMCALSDigitizer * sdigitizer) | |
184 | const {EmcalLoader()->PostSDigitizer(sdigitizer);} | |
185 | void PostDigitizer (AliEMCALDigitizer * digitizer) | |
186 | const {EmcalLoader()->PostDigitizer(dynamic_cast<AliDigitizer *>(digitizer));} | |
187 | ||
188 | TString Version() const { return EmcalLoader()->GetTitle() ; } | |
6b10bdac | 189 | AliEMCALLoader * EmcalLoader() const { return fgEmcalLoader; } |
0ef40383 | 190 | void Reset() ; |
64c1dcb3 | 191 | |
9859bfc0 | 192 | private: |
88cb7938 | 193 | |
194 | AliEMCALGetter(const char* headerFile, | |
6b10bdac | 195 | const char* version = AliConfig::GetDefaultEventFolderName(), |
196 | Option_t * openingOption = "READ") ; | |
197 | ||
173558f2 | 198 | |
88cb7938 | 199 | Int_t ReadTreeD(void) ; |
05a92d59 | 200 | Int_t ReadTreeH(void) ; |
88cb7938 | 201 | Int_t ReadTreeR(void) ; |
202 | Int_t ReadTreeT(void) ; | |
203 | Int_t ReadTreeS(void) ; | |
204 | Int_t ReadTreeP(void) ; | |
205 | ||
206 | ||
05a92d59 | 207 | void ReadPrimaries(void) ; |
88cb7938 | 208 | |
209 | private: | |
210 | ||
211 | // static TFile * fgFile; //! | |
212 | ||
213 | // AliEMCALBeamTestEvent * fBTE ; //! Header if BeamTest Event | |
214 | ||
215 | static Int_t fgDebug ; //! Debug level | |
216 | ||
217 | TString fLoadingStatus ; //! tells which trees are loaded | |
88cb7938 | 218 | |
219 | // AliEMCALCalibrationDB * fcdb ; //! | |
220 | ||
1ce25ac8 | 221 | static AliEMCALLoader * fgEmcalLoader ; // pointer to EMCAL Loader |
ffa6d63b | 222 | static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton |
88cb7938 | 223 | |
224 | enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes}; | |
225 | ||
ffa6d63b | 226 | |
6b10bdac | 227 | ClassDef(AliEMCALGetter,4) // Algorithm class that provides methods to retrieve objects from a list knowing the index |
ffa6d63b | 228 | |
229 | }; | |
230 | ||
231 | #endif // AliEMCALGETTER_H |