]>
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 ; | |
56088960 | 24 | class TGraph ; |
25 | class TF1 ; | |
ffa6d63b | 26 | |
27 | // --- Standard library --- | |
173558f2 | 28 | |
ffa6d63b | 29 | // --- AliRoot header files --- |
88cb7938 | 30 | #include "AliConfig.h" |
31 | ||
32 | // #include "AliRun.h" | |
88cb7938 | 33 | #include "AliEMCALHit.h" |
d64c959b | 34 | #include "AliEMCALRecParticle.h" |
88cb7938 | 35 | #include "AliEMCALDigitizer.h" |
36 | #include "AliEMCALSDigitizer.h" | |
1ce25ac8 | 37 | #include "AliEMCALLoader.h" |
38 | class AliEMCAL ; | |
39 | class AliEMCALGeometry ; | |
40 | class AliEMCALClusterizer ; | |
41 | class AliEMCALRecPoint ; | |
1ce25ac8 | 42 | class AliEMCALTrackSegmentMaker ; |
43 | class AliEMCALTrackSegment ; | |
44 | class AliEMCALPID ; | |
88cb7938 | 45 | class AliEMCALBeamTestEvent ; |
46 | ||
173558f2 | 47 | |
ffa6d63b | 48 | class AliEMCALGetter : public TObject { |
49 | ||
88cb7938 | 50 | public: |
6b10bdac | 51 | AliEMCALGetter() { |
52 | // ctor: this is a singleton, the ctor should never be called but cint needs it as public | |
88cb7938 | 53 | Fatal("ctor", "AliEMCALGetter is a singleton default ctor not callable") ; |
ffa6d63b | 54 | } |
39200c71 | 55 | AliEMCALGetter(const AliEMCALGetter & obj):TObject(obj) { |
ffa6d63b | 56 | // cpy ctor requested by Coding Convention |
88cb7938 | 57 | Fatal("cpy ctor", "not implemented") ; |
ffa6d63b | 58 | } |
59 | ||
05a92d59 | 60 | AliEMCALGetter & operator = (const AliEMCALGetter & ) { |
61 | // assignement operator requested by coding convention, but not needed | |
88cb7938 | 62 | Fatal("operator =", "not implemented") ; |
05a92d59 | 63 | return *this ; |
64 | } | |
ffa6d63b | 65 | virtual ~AliEMCALGetter() ; |
66 | ||
88cb7938 | 67 | //=========== Instantiators ================ |
68 | static AliEMCALGetter * Instance(const char* headerFile, | |
e191bb57 | 69 | const char* version = AliConfig::GetDefaultEventFolderName(), |
88cb7938 | 70 | Option_t * openingOption = "READ" ) ; |
71 | static AliEMCALGetter * Instance() ; | |
72 | ||
73 | static void Print() ; | |
74 | ||
75 | // //=========== General information about run ============== | |
09884213 | 76 | Bool_t IsLoaded(TString tree) const { return fLoadingStatus.Contains(tree) ; } |
77 | void SetLoaded(TString tree) { fLoadingStatus += tree ; } | |
88cb7938 | 78 | |
79 | Int_t MaxEvent() const ; | |
80 | Int_t EventNumber() const ; | |
81 | Bool_t VersionExists(TString & opt) const ; | |
82 | UShort_t EventPattern(void) const ; | |
83 | Float_t BeamEnergy(void) const ; | |
84 | ||
85 | // //========== EMCALGeometry and EMCAL ============= | |
86 | AliEMCAL * EMCAL() const ; | |
87 | AliEMCALGeometry * EMCALGeometry() const ; | |
88 | ||
89 | // //========== Methods to read something from file ========== | |
09884213 | 90 | void Event(Int_t event, const char * opt = "HSDRP") ; |
91 | void Track(Int_t itrack) ; | |
88cb7938 | 92 | |
93 | // //-----------------now getter's data-------------------------------------- | |
94 | // // AliEMCALCalibrationDB * CalibrationDB(){return fcdb; } | |
95 | // // void ReadCalibrationDB(const char * name, const char * filename) ; | |
05a92d59 | 96 | |
97 | //=========== Primaries ============ | |
88cb7938 | 98 | // TTree * TreeK(TString filename="") ; |
88cb7938 | 99 | TParticle * Primary(Int_t index) const ; |
6b10bdac | 100 | Int_t NPrimaries() const; |
09884213 | 101 | TParticle * Secondary(const TParticle * p, Int_t index=1) const ; |
88cb7938 | 102 | |
103 | // //=========== Hits ================= | |
104 | // TTree * TreeH(TString filename="") ; | |
1ce25ac8 | 105 | TClonesArray * Hits(void) const ; |
09884213 | 106 | AliEMCALHit * Hit(Int_t index) const { return dynamic_cast<AliEMCALHit*>(Hits()->At(index) );} |
88cb7938 | 107 | TTree * TreeH() const ; |
108 | ||
05a92d59 | 109 | //=========== SDigits ============== |
1ce25ac8 | 110 | TClonesArray * SDigits() const ; |
09884213 | 111 | AliEMCALDigit * SDigit(Int_t index) const { return static_cast<AliEMCALDigit *>(SDigits()->At(index)) ;} |
88cb7938 | 112 | TTree * TreeS() const ; |
113 | AliEMCALSDigitizer * SDigitizer() ; | |
114 | ||
1ce25ac8 | 115 | TString GetSDigitsFileName() const { return EmcalLoader()->GetSDigitsFileName() ; } |
116 | Int_t LoadSDigits(Option_t* opt="") const { return EmcalLoader()->LoadSDigits(opt) ; } | |
117 | Int_t LoadSDigitizer(Option_t* opt="") const { return EmcalLoader()->LoadSDigitizer(opt) ; } | |
118 | Int_t WriteSDigits(Option_t* opt="") const { return EmcalLoader()->WriteSDigits(opt) ; } | |
119 | Int_t WriteSDigitizer(Option_t* opt="") const { | |
88cb7938 | 120 | return EmcalLoader()->WriteSDigitizer(opt) ; } |
121 | ||
05a92d59 | 122 | //========== Digits ================ |
1ce25ac8 | 123 | TClonesArray * Digits() const ; |
09884213 | 124 | AliEMCALDigit * Digit(Int_t index) const { return static_cast<AliEMCALDigit *>(Digits()->At(index)) ;} |
88cb7938 | 125 | TTree * TreeD() const ; |
126 | AliEMCALDigitizer * Digitizer() ; | |
1ce25ac8 | 127 | TString GetDigitsFileName() const { return EmcalLoader()->GetDigitsFileName() ; } |
128 | Int_t LoadDigits(Option_t* opt="") const { return EmcalLoader()->LoadDigits(opt) ; } | |
129 | Int_t LoadDigitizer(Option_t* opt="") const { | |
88cb7938 | 130 | return EmcalLoader()->LoadDigitizer(opt) ; } |
1ce25ac8 | 131 | Int_t WriteDigits(Option_t* opt="") const { return EmcalLoader()->WriteDigits(opt) ; } |
132 | Int_t WriteDigitizer(Option_t* opt="") const { | |
88cb7938 | 133 | return EmcalLoader()->WriteDigitizer(opt) ; } |
134 | ||
05a92d59 | 135 | //========== RecPoints ============= |
fdebddeb | 136 | TObjArray * ECARecPoints() const; |
70a93198 | 137 | AliEMCALRecPoint * ECARecPoint(Int_t index) const{ return static_cast<AliEMCALRecPoint *>(ECARecPoints()->At(index)) ;} |
88cb7938 | 138 | TTree * TreeR() const ; |
139 | AliEMCALClusterizer * Clusterizer() ; | |
1ce25ac8 | 140 | TString GetRecPointsFileName() const { return EmcalLoader()->GetRecPointsFileName() ; } |
141 | Int_t LoadRecPoints(Option_t* opt="") const { return EmcalLoader()->LoadRecPoints(opt) ; } | |
142 | Int_t LoadClusterizer(Option_t* opt="") const { | |
88cb7938 | 143 | return EmcalLoader()->LoadClusterizer(opt) ; } |
1ce25ac8 | 144 | Int_t WriteRecPoints(Option_t* opt="") const { return EmcalLoader()->WriteRecPoints(opt) ; } |
145 | Int_t WriteClusterizer(Option_t* opt="") const { | |
88cb7938 | 146 | return EmcalLoader()->WriteClusterizer(opt) ; } |
147 | ||
148 | //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) { | |
1ce25ac8 | 149 | TClonesArray * TrackSegments() const ; |
09884213 | 150 | AliEMCALTrackSegment * TrackSegments(Int_t index) const { return static_cast<AliEMCALTrackSegment *>(TrackSegments()->At(index)) ;} |
88cb7938 | 151 | TTree * TreeT() const ; |
152 | AliEMCALTrackSegmentMaker * TrackSegmentMaker() ; | |
1ce25ac8 | 153 | TString GetTracksFileName() const { return EmcalLoader()->GetTracksFileName() ; } |
154 | Int_t LoadTracks(Option_t* opt="") const { return EmcalLoader()->LoadTracks(opt) ; } | |
155 | Int_t LoadTrackSegementMaker(Option_t* opt="") const { | |
88cb7938 | 156 | return EmcalLoader()->LoadTrackSegmentMaker(opt) ; } |
1ce25ac8 | 157 | Int_t WriteTracks(Option_t* opt="") const { return EmcalLoader()->WriteTracks(opt) ; } |
158 | Int_t WriteTrackSegmentMaker(Option_t* opt="") const { | |
88cb7938 | 159 | return EmcalLoader()->WriteTracker(opt) ; } |
516fff8e | 160 | //========== RecParticles =========== |
173558f2 | 161 | |
1ce25ac8 | 162 | TClonesArray * RecParticles() const ; |
e3bb24cf | 163 | AliEMCALRecParticle * RecParticle(Int_t index) const { return static_cast<AliEMCALRecParticle *>(RecParticles()->At(index)) ;} |
88cb7938 | 164 | TTree * TreeP() const ; |
165 | AliEMCALPID * PID() ; | |
1ce25ac8 | 166 | TString GetRecParticlesFileName() const { return EmcalLoader()->GetRecParticlesFileName() ; } |
167 | Int_t LoadRecParticles(Option_t* opt="") const { return EmcalLoader()->LoadRecParticles(opt) ; } | |
168 | Int_t LoadPID(Option_t* opt="") const { | |
88cb7938 | 169 | return EmcalLoader()->LoadPID(opt) ; } |
1ce25ac8 | 170 | Int_t WriteRecParticles(Option_t* opt="") const { return EmcalLoader()->WriteRecParticles(opt) ; } |
171 | Int_t WritePID(Option_t* opt="") const { | |
88cb7938 | 172 | return EmcalLoader()->WritePID(opt) ; } |
173 | ||
a43c51c3 | 174 | //========== Raw =========== |
175 | Int_t ReadRaw(Int_t event) ; | |
88cb7938 | 176 | |
177 | void SetDebug(Int_t level) {fgDebug = level;} // Set debug level | |
1ce25ac8 | 178 | void PostClusterizer(AliEMCALClusterizer * clu) |
88cb7938 | 179 | const{EmcalLoader()->PostClusterizer(clu) ; } |
180 | void PostPID(AliEMCALPID * pid) | |
181 | const{EmcalLoader()->PostPID(pid) ; } | |
182 | void PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tr) | |
183 | const{EmcalLoader()->PostTrackSegmentMaker(tr) ; } | |
184 | void PostSDigitizer (AliEMCALSDigitizer * sdigitizer) | |
185 | const {EmcalLoader()->PostSDigitizer(sdigitizer);} | |
186 | void PostDigitizer (AliEMCALDigitizer * digitizer) | |
187 | const {EmcalLoader()->PostDigitizer(dynamic_cast<AliDigitizer *>(digitizer));} | |
188 | ||
189 | TString Version() const { return EmcalLoader()->GetTitle() ; } | |
6b10bdac | 190 | AliEMCALLoader * EmcalLoader() const { return fgEmcalLoader; } |
0ef40383 | 191 | void Reset() ; |
64c1dcb3 | 192 | |
9859bfc0 | 193 | private: |
88cb7938 | 194 | |
195 | AliEMCALGetter(const char* headerFile, | |
6b10bdac | 196 | const char* version = AliConfig::GetDefaultEventFolderName(), |
197 | Option_t * openingOption = "READ") ; | |
198 | ||
173558f2 | 199 | |
88cb7938 | 200 | Int_t ReadTreeD(void) ; |
05a92d59 | 201 | Int_t ReadTreeH(void) ; |
88cb7938 | 202 | Int_t ReadTreeR(void) ; |
203 | Int_t ReadTreeT(void) ; | |
204 | Int_t ReadTreeS(void) ; | |
205 | Int_t ReadTreeP(void) ; | |
206 | ||
207 | ||
05a92d59 | 208 | void ReadPrimaries(void) ; |
56088960 | 209 | |
210 | void FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Int_t & amp, Double_t & time) ; | |
88cb7938 | 211 | |
212 | private: | |
213 | ||
88cb7938 | 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 | |
7c193632 | 227 | ClassDef(AliEMCALGetter,6) // Algorithm class that provides methods to retrieve objects from a list knowing the index |
ffa6d63b | 228 | |
229 | }; | |
230 | ||
231 | #endif // AliEMCALGETTER_H |