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 */
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.
14 // The objects are retrived from folders.
15 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
19 // --- ROOT system ---
20 #include "TClonesArray.h"
27 // --- Standard library ---
29 #include <Riostream.h>
31 // --- AliRoot header files ---
34 #include "AliLoader.h"
35 #include "AliRunLoader.h"
37 #include "AliEMCALHit.h"
38 #include "AliEMCALDigit.h"
39 #include "AliEMCALTowerRecPoint.h"
40 #include "AliEMCALTrackSegment.h"
41 #include "AliEMCALRecParticle.h"
42 class AliEMCALGeometry ;
43 #include "AliEMCALDigitizer.h"
44 #include "AliEMCALSDigitizer.h"
45 #include "AliEMCALClusterizer.h"
46 #include "AliEMCALTrackSegmentMaker.h"
47 #include "AliEMCALPID.h"
48 class AliEMCALCalibrationDB ;
53 class AliEMCALLoader : public AliLoader {
58 AliEMCALLoader(const AliEMCALLoader & obj){}
59 AliEMCALLoader(const Char_t *detname,const Char_t *eventfoldername);
61 virtual ~AliEMCALLoader() ;
63 // assignement operator requested by coding convention, but not needed
64 AliEMCALLoader & operator = (const AliEMCALLoader & ) {return *this;}
66 Int_t GetEvent();//extends the method on EMCAL RecPart posting
67 Int_t SetEvent();//extends the method on EMCAL RecPart posting
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="");
77 void UnloadRecParticles();
80 Int_t PostHits(); //Posts the
83 Int_t PostRecPoints();
85 Int_t PostRecParticles();
87 void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean
92 void CleanRecPoints();
94 void CleanRecParticles();
96 //up to now it is only here -> no definition about global/incremental tracking/PID
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
103 /*******************************************************************/
104 /*******************************************************************/
105 /*******************************************************************/
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) ;
118 static AliEMCALGeometry* GetEMCALGeometry();
119 static AliEMCALLoader* GetEMCALLoader(const char* eventfoldername);
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();}
125 const AliEMCAL * EMCAL();
126 const AliEMCALGeometry *EMCALGeometry() ;
128 // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); }
129 TObjArray * Alarms();
131 /*********************************************/
132 /************ TClonesArrays ***********/
133 /*********************************************/
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();
163 /*********************************************/
164 /************ T A S K S **************/
165 /*********************************************/
167 // AliEMCALSDigitizer* EMCALSDigitizer(TString name = AliConfig::fgkDefaultEventFolderName);
168 //AliEMCALDigitizer* EMCALDigitizer() { return dynamic_cast<AliEMCALDigitizer*>(Digitizer()) ;}
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);}
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);}
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);}
187 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
188 void SetBranchTitle(const TString& btitle);
190 AliEMCALCalibrationDB * CalibrationDB(){return fcdb; }
191 //void ReadCalibrationDB(const char * name, const char * filename);
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 ; //!
205 Int_t ReadRecPoints();
207 Int_t ReadRecParticles();
210 Int_t fDebug ; // Debug level
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
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
229 ClassDef(AliEMCALLoader,2) // Algorithm class that provides methods to retrieve objects from a list knowing the index
233 /******************************************************************************/
234 /**************** I N L I N E S ****************************************/
235 /******************************************************************************/
237 inline TClonesArray* AliEMCALLoader::Hits()
239 return (TClonesArray*)GetDetectorData(fgkHitsName);
241 /******************************************************************************/
243 inline const AliEMCALHit* AliEMCALLoader::Hit(Int_t index)
245 const TClonesArray* tcarr = Hits();
247 return (const AliEMCALHit*) tcarr->At(index);
250 /******************************************************************************/
252 inline TClonesArray* AliEMCALLoader::SDigits()
254 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName));
256 /******************************************************************************/
258 inline const AliEMCALDigit* AliEMCALLoader::SDigit(Int_t index)
260 const TClonesArray* tcarr = SDigits();
262 return (const AliEMCALDigit*) tcarr->At(index);
265 /******************************************************************************/
267 inline TClonesArray* AliEMCALLoader::Digits()
269 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName));
271 /******************************************************************************/
273 inline const AliEMCALDigit* AliEMCALLoader::Digit(Int_t index)
275 const TClonesArray* tcarr = Digits();
277 return (const AliEMCALDigit*) tcarr->At(index);
281 /******************************************************************************/
283 inline TObjArray * AliEMCALLoader::PRERecPoints()
285 return dynamic_cast<TObjArray*>(GetDetectorData(fgkPRERecPointsName));
287 /******************************************************************************/
289 inline const AliEMCALRecPoint * AliEMCALLoader::PRERecPoint(Int_t index)
291 TObjArray* tcarr = PRERecPoints();
293 return dynamic_cast<const AliEMCALRecPoint*>(tcarr->At(index));
297 /******************************************************************************/
299 inline TObjArray * AliEMCALLoader::ECARecPoints()
301 return dynamic_cast<TObjArray*>(GetDetectorData(fgkECARecPointsName));
304 /******************************************************************************/
306 inline const AliEMCALTowerRecPoint * AliEMCALLoader::ECARecPoint(Int_t index)
308 TObjArray* tcarr = ECARecPoints();
310 return dynamic_cast<const AliEMCALTowerRecPoint*>(tcarr->At(index));
314 /******************************************************************************/
316 inline TObjArray * AliEMCALLoader::HCARecPoints()
318 return dynamic_cast<TObjArray*>(GetDetectorData(fgkHCARecPointsName));
321 /******************************************************************************/
323 inline const AliEMCALTowerRecPoint * AliEMCALLoader::HCARecPoint(Int_t index)
325 TObjArray* tcarr = HCARecPoints();
327 return dynamic_cast<const AliEMCALTowerRecPoint*>(tcarr->At(index));
331 /******************************************************************************/
333 inline TClonesArray * AliEMCALLoader::TrackSegments()
335 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName));
337 /******************************************************************************/
339 inline const AliEMCALTrackSegment * AliEMCALLoader::TrackSegment(Int_t index)
341 const TClonesArray* tcarr = TrackSegments();
343 return (const AliEMCALTrackSegment*) tcarr->At(index);
346 /******************************************************************************/
348 inline TClonesArray * AliEMCALLoader::RecParticles()
350 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName));
352 /******************************************************************************/
354 inline const AliEMCALRecParticle* AliEMCALLoader::RecParticle(Int_t index)
356 TClonesArray* tcarr = RecParticles();
358 return (const AliEMCALRecParticle*) tcarr->At(index);
361 /******************************************************************************/
362 inline TObjArray * AliEMCALLoader::Alarms()
363 { return (TObjArray*)(GetQAFolder()->FindObject(fDetectorName));}
365 #endif // AliEMCALLOADER_H