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