]>
Commit | Line | Data |
---|---|---|
88cb7938 | 1 | #ifndef ALIEMCALLOADER_H |
2 | #define ALIEMCALLOADER_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
8 | //_________________________________________________________________________ | |
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. | |
13 | // | |
14 | // The objects are retrived from folders. | |
15 | //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) | |
16 | // | |
17 | ||
18 | ||
19 | // --- ROOT system --- | |
20 | #include "TClonesArray.h" | |
21 | #include "TFolder.h" | |
22 | #include "TTree.h" | |
23 | class TString ; | |
24 | class TParticle ; | |
25 | class TTask ; | |
26 | ||
27 | // --- Standard library --- | |
88cb7938 | 28 | |
29 | // --- AliRoot header files --- | |
30 | ||
31 | #include "AliRun.h" | |
88cb7938 | 32 | #include "AliRunLoader.h" |
88cb7938 | 33 | #include "AliEMCALDigit.h" |
d64c959b | 34 | #include "AliEMCALRecPoint.h" |
35 | #include "AliEMCALTowerRecPoint.h" | |
88cb7938 | 36 | #include "AliEMCALTrackSegment.h" |
88cb7938 | 37 | #include "AliEMCALClusterizer.h" |
d64c959b | 38 | #include "AliEMCALTrackSegmentMaker.h" |
88cb7938 | 39 | #include "AliEMCALPID.h" |
d64c959b | 40 | class AliLoader ; |
41 | class AliEMCAL ; | |
42 | class AliEMCALHit ; | |
43 | class AliEMCALRecParticle ; | |
44 | class AliEMCALGeometry ; | |
45 | class AliEMCALDigitizer ; | |
46 | class AliEMCALSDigitizer ; | |
88cb7938 | 47 | class AliEMCALCalibrationDB ; |
48 | ||
49 | ||
50 | // | |
51 | ||
52 | class AliEMCALLoader : public AliLoader { | |
53 | ||
54 | public: | |
55 | ||
56 | AliEMCALLoader(); | |
39200c71 | 57 | AliEMCALLoader(const AliEMCALLoader & obj):AliLoader(obj){} |
88cb7938 | 58 | AliEMCALLoader(const Char_t *detname,const Char_t *eventfoldername); |
59 | ||
60 | virtual ~AliEMCALLoader() ; | |
61 | ||
62 | // assignement operator requested by coding convention, but not needed | |
d64c959b | 63 | const AliEMCALLoader & operator = (const AliEMCALLoader & ) {return *this;} |
88cb7938 | 64 | |
65 | Int_t GetEvent();//extends the method on EMCAL RecPart posting | |
66 | Int_t SetEvent();//extends the method on EMCAL RecPart posting | |
67 | ||
68 | Bool_t BranchExists(const TString& recName); | |
69 | Int_t LoadHits(Option_t* opt=""); //reads from disk and sends them to folder; array as well as tree | |
70 | Int_t LoadSDigits(Option_t* opt=""); | |
71 | Int_t LoadDigits(Option_t* opt=""); //reads Digits from disk and sends them to folder; array as well as tree | |
72 | Int_t LoadRecPoints(Option_t* opt=""); //reads RecPoints from disk and sends them to folder; array as well as tree | |
73 | Int_t LoadTracks(Option_t* opt=""); //reads Tracks from disk and sends them to folder; array as well as tree | |
74 | Int_t LoadRecParticles(Option_t* opt=""); | |
75 | ||
76 | void UnloadRecParticles(); | |
77 | void UnloadTracks(); | |
78 | ||
79 | Int_t PostHits(); //Posts the | |
80 | Int_t PostSDigits(); | |
81 | Int_t PostDigits(); | |
82 | Int_t PostRecPoints(); | |
83 | Int_t PostTracks(); | |
84 | Int_t PostRecParticles(); | |
85 | ||
86 | void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean | |
87 | ||
88 | void CleanHits(); | |
89 | void CleanSDigits(); | |
90 | void CleanDigits(); | |
91 | void CleanRecPoints(); | |
92 | void CleanTracks(); | |
93 | void CleanRecParticles(); | |
94 | ||
95 | //up to now it is only here -> no definition about global/incremental tracking/PID | |
96 | ||
97 | // Int_t WriteRecParticles(Option_t* opt="");//writes the reconstructed particles | |
98 | // Int_t WritePID(Option_t* opt="");//writes the task for PID to file | |
99 | // Bool_t PostPID (AliEMCALPID * pid) const {return kTRUE;} | |
100 | // Bool_t PostQA (void) const ; //it was empty anyway | |
101 | ||
102 | /*******************************************************************/ | |
103 | /*******************************************************************/ | |
104 | /*******************************************************************/ | |
105 | ||
106 | TObject** HitsRef(){return GetDetectorDataRef(Hits());} | |
107 | TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());} | |
108 | TObject** DigitsRef(){return GetDetectorDataRef(Digits());} | |
109 | TObject** PRERecPointsRef(){return GetDetectorDataRef(PRERecPoints());} | |
110 | TObject** ECARecPointsRef(){return GetDetectorDataRef(ECARecPoints());} | |
111 | TObject** HCARecPointsRef(){return GetDetectorDataRef(HCARecPoints());} | |
112 | TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());} | |
113 | TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());} | |
114 | TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());} | |
115 | void Track(Int_t itrack) ; | |
116 | ||
117 | static AliEMCALGeometry* GetEMCALGeometry(); | |
118 | static AliEMCALLoader* GetEMCALLoader(const char* eventfoldername); | |
119 | ||
120 | //Method to be used when digitizing under AliRunDigitizer, who opens all files etc. | |
121 | Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();} | |
122 | Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();} | |
123 | ||
124 | const AliEMCAL * EMCAL(); | |
125 | const AliEMCALGeometry *EMCALGeometry() ; | |
126 | // Alarms | |
127 | // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); } | |
128 | TObjArray * Alarms(); | |
129 | ||
130 | /*********************************************/ | |
131 | /************ TClonesArrays ***********/ | |
132 | /*********************************************/ | |
133 | /**** H i t s ****/ | |
134 | TClonesArray* Hits(void); | |
135 | const AliEMCALHit* Hit(Int_t index); | |
136 | void MakeHitsArray(); | |
137 | /**** S D i g i t s ****/ | |
138 | TClonesArray* SDigits(); | |
139 | const AliEMCALDigit* SDigit(Int_t index); | |
140 | void MakeSDigitsArray(); | |
141 | /**** D i g i t s ****/ | |
142 | TClonesArray* Digits(); | |
143 | const AliEMCALDigit * Digit(Int_t index); | |
144 | void MakeDigitsArray(); | |
145 | /**** R e c P o i n t s ****/ | |
146 | TObjArray * PRERecPoints(); | |
147 | TObjArray * ECARecPoints(); | |
148 | TObjArray * HCARecPoints(); | |
149 | const AliEMCALRecPoint * PRERecPoint(Int_t index) ; | |
150 | const AliEMCALTowerRecPoint * ECARecPoint(Int_t index) ; | |
151 | const AliEMCALTowerRecPoint * HCARecPoint(Int_t index) ; | |
152 | void MakeRecPointsArray(); | |
153 | /**** T r a c k S e g m e n t s ****/ | |
154 | TClonesArray * TrackSegments(); | |
155 | const AliEMCALTrackSegment * TrackSegment(Int_t index); | |
156 | void MakeTrackSegmentsArray(); | |
157 | /**** R e c P a r t ic l e s ****/ | |
158 | TClonesArray * RecParticles() ; | |
159 | const AliEMCALRecParticle * RecParticle(Int_t index); | |
160 | void MakeRecParticlesArray(); | |
161 | ||
162 | /*********************************************/ | |
163 | /************ T A S K S **************/ | |
164 | /*********************************************/ | |
165 | // | |
166 | // AliEMCALSDigitizer* EMCALSDigitizer(TString name = AliConfig::fgkDefaultEventFolderName); | |
167 | //AliEMCALDigitizer* EMCALDigitizer() { return dynamic_cast<AliEMCALDigitizer*>(Digitizer()) ;} | |
168 | ||
169 | AliEMCALClusterizer* Clusterizer () {return dynamic_cast<AliEMCALClusterizer*>(Reconstructioner()) ;} | |
170 | Int_t PostClusterizer(TTask* clust){return PostReconstructioner(clust);} | |
171 | Int_t LoadClusterizer(Option_t * opt="") {return LoadReconstructioner(opt);} | |
172 | Int_t WriteClusterizer(Option_t * opt="") {return WriteReconstructioner(opt);} | |
173 | ||
174 | AliEMCALPID * PID (){return dynamic_cast<AliEMCALPID*>(PIDTask()) ;} | |
175 | Int_t PostPID(TTask* pid){return PostPIDTask(pid);} | |
176 | Int_t LoadPID(Option_t * opt="") {return LoadPIDTask(opt);} | |
177 | Int_t WritePID(Option_t * opt="") {return WritePIDTask(opt);} | |
178 | ||
179 | ||
180 | AliEMCALTrackSegmentMaker * TrackSegmentMaker () { return dynamic_cast<AliEMCALTrackSegmentMaker *>(Tracker()) ;} | |
181 | Int_t PostTrackSegmentMaker(TTask* segmaker){return PostTracker(segmaker);} | |
182 | Int_t LoadTrackSegmentMaker(Option_t * opt="") {return LoadTracker(opt);} | |
183 | Int_t WriteTrackSegmentMaker(Option_t * opt="") {return WriteTracker(opt);} | |
184 | ||
185 | ||
186 | void SetDebug(Int_t level) {fDebug = level;} // Set debug level | |
187 | void SetBranchTitle(const TString& btitle); | |
188 | ||
189 | AliEMCALCalibrationDB * CalibrationDB(){return fcdb; } | |
190 | //void ReadCalibrationDB(const char * name, const char * filename); | |
191 | ||
d64c959b | 192 | |
193 | static TString HitsName() { return fgkHitsName ; } //Name for TClonesArray with hits from one event | |
194 | static TString SDigitsName() { return fgkSDigitsName ;} //Name for TClonesArray | |
195 | static TString DigitsName() { return fgkDigitsName ;} //Name for TClonesArray | |
196 | static TString PreRecPointsName() { return fgkPRERecPointsName ;} //Name for TClonesArray | |
197 | static TString ECARecPointsName() { return fgkECARecPointsName ;} //Name for TClonesArray | |
198 | static TString HCARecPointsName() { return fgkHCARecPointsName ;} //Name for TClonesArray | |
199 | static TString TracksName() { return fgkTracksName ;} //Name for TClonesArray | |
200 | static TString RecParticlesName() { return fgkRecParticlesName ;} //Name for TClonesArray | |
201 | static TString PRERecPointsBranchName() { return fgkPRERecPointsBranchName ;} //Name for branch | |
202 | static TString ECARecPointsBranchName() { return fgkECARecPointsBranchName ;} //Name for branch | |
203 | static TString HCARecPointsBranchName() { return fgkHCARecPointsBranchName ;} //Name for branch | |
204 | static TString TrackSegmentsBranchName() { return fgkTrackSegmentsBranchName ;} //Name for branch | |
205 | static TString RecParticlesBranchName() { return fgkRecParticlesBranchName ;} //Name for branch | |
206 | ||
88cb7938 | 207 | protected: |
208 | TString fBranchTitle; //Title of the branch | |
209 | Bool_t fRecParticlesLoaded; //Flag signing if Reconstructed Particles are loaded | |
210 | Bool_t fTracksLoaded; //Flag signing if Tracks are loaded | |
211 | TString fRecParticlesFileOption; //Loading Option for Reconstructed Particles | |
212 | AliEMCALCalibrationDB * fcdb ; //! | |
213 | ||
214 | private: | |
215 | ||
216 | Int_t ReadHits(); | |
217 | Int_t ReadDigits(); | |
218 | Int_t ReadSDigits(); | |
219 | Int_t ReadRecPoints(); | |
220 | Int_t ReadTracks(); | |
221 | Int_t ReadRecParticles(); | |
222 | ||
223 | void ReadTreeQA() ; | |
88cb7938 | 224 | |
225 | static const TString fgkHitsName;//Name for TClonesArray with hits from one event | |
226 | static const TString fgkSDigitsName;//Name for TClonesArray | |
227 | static const TString fgkDigitsName;//Name for TClonesArray | |
228 | static const TString fgkPRERecPointsName;//Name for TClonesArray | |
229 | static const TString fgkECARecPointsName;//Name for TClonesArray | |
230 | static const TString fgkHCARecPointsName;//Name for TClonesArray | |
231 | static const TString fgkTracksName;//Name for TClonesArray | |
232 | static const TString fgkRecParticlesName;//Name for TClonesArray | |
233 | ||
234 | static const TString fgkPRERecPointsBranchName;//Name for branch | |
235 | static const TString fgkECARecPointsBranchName;//Name for branch | |
236 | static const TString fgkHCARecPointsBranchName;//Name for branch | |
237 | static const TString fgkTrackSegmentsBranchName;//Name for branch | |
238 | static const TString fgkRecParticlesBranchName;//Name for branch | |
d64c959b | 239 | Int_t fDebug ; // Debug level |
240 | ||
241 | ||
88cb7938 | 242 | |
39200c71 | 243 | ClassDef(AliEMCALLoader,3) // Algorithm class that provides methods to retrieve objects from a list knowing the index |
88cb7938 | 244 | |
245 | }; | |
246 | ||
247 | /******************************************************************************/ | |
248 | /**************** I N L I N E S ****************************************/ | |
249 | /******************************************************************************/ | |
250 | ||
251 | inline TClonesArray* AliEMCALLoader::Hits() | |
252 | { | |
253 | return (TClonesArray*)GetDetectorData(fgkHitsName); | |
254 | } | |
255 | /******************************************************************************/ | |
256 | ||
257 | inline const AliEMCALHit* AliEMCALLoader::Hit(Int_t index) | |
258 | { | |
259 | const TClonesArray* tcarr = Hits(); | |
260 | if (tcarr) | |
261 | return (const AliEMCALHit*) tcarr->At(index); | |
262 | return 0x0; | |
263 | } | |
264 | /******************************************************************************/ | |
265 | ||
266 | inline TClonesArray* AliEMCALLoader::SDigits() | |
267 | { | |
268 | return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName)); | |
269 | } | |
270 | /******************************************************************************/ | |
271 | ||
272 | inline const AliEMCALDigit* AliEMCALLoader::SDigit(Int_t index) | |
273 | { | |
274 | const TClonesArray* tcarr = SDigits(); | |
275 | if (tcarr) | |
276 | return (const AliEMCALDigit*) tcarr->At(index); | |
277 | return 0x0; | |
278 | } | |
279 | /******************************************************************************/ | |
280 | ||
281 | inline TClonesArray* AliEMCALLoader::Digits() | |
282 | { | |
283 | return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName)); | |
284 | } | |
285 | /******************************************************************************/ | |
286 | ||
287 | inline const AliEMCALDigit* AliEMCALLoader::Digit(Int_t index) | |
288 | { | |
289 | const TClonesArray* tcarr = Digits(); | |
290 | if (tcarr) | |
291 | return (const AliEMCALDigit*) tcarr->At(index); | |
292 | return 0x0; | |
293 | } | |
294 | ||
295 | /******************************************************************************/ | |
296 | ||
297 | inline TObjArray * AliEMCALLoader::PRERecPoints() | |
298 | { | |
299 | return dynamic_cast<TObjArray*>(GetDetectorData(fgkPRERecPointsName)); | |
300 | } | |
301 | /******************************************************************************/ | |
302 | ||
303 | inline const AliEMCALRecPoint * AliEMCALLoader::PRERecPoint(Int_t index) | |
304 | { | |
305 | TObjArray* tcarr = PRERecPoints(); | |
306 | if (tcarr) | |
307 | return dynamic_cast<const AliEMCALRecPoint*>(tcarr->At(index)); | |
308 | return 0x0; | |
309 | } | |
310 | ||
311 | /******************************************************************************/ | |
312 | ||
313 | inline TObjArray * AliEMCALLoader::ECARecPoints() | |
314 | { | |
315 | return dynamic_cast<TObjArray*>(GetDetectorData(fgkECARecPointsName)); | |
316 | } | |
317 | ||
318 | /******************************************************************************/ | |
319 | ||
320 | inline const AliEMCALTowerRecPoint * AliEMCALLoader::ECARecPoint(Int_t index) | |
321 | { | |
322 | TObjArray* tcarr = ECARecPoints(); | |
323 | if (tcarr) | |
324 | return dynamic_cast<const AliEMCALTowerRecPoint*>(tcarr->At(index)); | |
325 | return 0x0; | |
326 | } | |
327 | ||
328 | /******************************************************************************/ | |
329 | ||
330 | inline TObjArray * AliEMCALLoader::HCARecPoints() | |
331 | { | |
332 | return dynamic_cast<TObjArray*>(GetDetectorData(fgkHCARecPointsName)); | |
333 | } | |
334 | ||
335 | /******************************************************************************/ | |
336 | ||
337 | inline const AliEMCALTowerRecPoint * AliEMCALLoader::HCARecPoint(Int_t index) | |
338 | { | |
339 | TObjArray* tcarr = HCARecPoints(); | |
340 | if (tcarr) | |
341 | return dynamic_cast<const AliEMCALTowerRecPoint*>(tcarr->At(index)); | |
342 | return 0x0; | |
343 | } | |
344 | ||
345 | /******************************************************************************/ | |
346 | ||
347 | inline TClonesArray * AliEMCALLoader::TrackSegments() | |
348 | { | |
349 | return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName)); | |
350 | } | |
351 | /******************************************************************************/ | |
352 | ||
353 | inline const AliEMCALTrackSegment * AliEMCALLoader::TrackSegment(Int_t index) | |
354 | { | |
355 | const TClonesArray* tcarr = TrackSegments(); | |
356 | if (tcarr) | |
357 | return (const AliEMCALTrackSegment*) tcarr->At(index); | |
358 | return 0x0; | |
359 | } | |
360 | /******************************************************************************/ | |
361 | ||
362 | inline TClonesArray * AliEMCALLoader::RecParticles() | |
363 | { | |
364 | return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName)); | |
365 | } | |
366 | /******************************************************************************/ | |
367 | ||
368 | inline const AliEMCALRecParticle* AliEMCALLoader::RecParticle(Int_t index) | |
369 | { | |
370 | TClonesArray* tcarr = RecParticles(); | |
371 | if (tcarr) | |
372 | return (const AliEMCALRecParticle*) tcarr->At(index); | |
373 | return 0x0; | |
374 | } | |
375 | /******************************************************************************/ | |
376 | inline TObjArray * AliEMCALLoader::Alarms() | |
377 | { return (TObjArray*)(GetQAFolder()->FindObject(fDetectorName));} | |
378 | ||
379 | #endif // AliEMCALLOADER_H |