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