1 #ifndef ALIPHOSLOADER_H
2 #define ALIPHOSLOADER_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 "AliPHOSHit.h"
38 #include "AliPHOSDigit.h"
39 #include "AliPHOSEmcRecPoint.h"
40 #include "AliPHOSCpvRecPoint.h"
41 #include "AliPHOSTrackSegment.h"
42 #include "AliPHOSRecParticle.h"
43 class AliPHOSGeometry ;
44 #include "AliPHOSDigitizer.h"
45 #include "AliPHOSSDigitizer.h"
46 #include "AliPHOSClusterizer.h"
47 #include "AliPHOSTrackSegmentMaker.h"
48 #include "AliPHOSPID.h"
49 class AliPHOSCalibrationDB ;
54 class AliPHOSLoader : public AliLoader {
59 AliPHOSLoader(const AliPHOSLoader & obj){}
60 AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername);
62 virtual ~AliPHOSLoader() ;
64 // assignement operator requested by coding convention, but not needed
65 AliPHOSLoader & operator = (const AliPHOSLoader & ) {return *this;}
67 Int_t GetEvent();//extends the method on PHOS RecPart posting
68 Int_t SetEvent();//extends the method on PHOS RecPart posting
70 Bool_t BranchExists(const TString& recName);
71 Int_t LoadHits(Option_t* opt=""); //reads from disk and sends them to folder; array as well as tree
72 Int_t LoadSDigits(Option_t* opt="");
73 Int_t LoadDigits(Option_t* opt=""); //reads Digits from disk and sends them to folder; array as well as tree
74 Int_t LoadRecPoints(Option_t* opt=""); //reads RecPoints from disk and sends them to folder; array as well as tree
75 Int_t LoadTracks(Option_t* opt=""); //reads Tracks from disk and sends them to folder; array as well as tree
76 Int_t LoadRecParticles(Option_t* opt="");
78 Int_t PostHits(); //Posts the
81 Int_t PostRecPoints();
83 Int_t PostRecParticles();
85 void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean
90 void CleanRecPoints();
92 void CleanRecParticles();
94 //up to now it is only here -> no definition about global/incremental tracking/PID
96 // Int_t WriteRecParticles(Option_t* opt="");//writes the reconstructed particles
97 // Int_t WritePID(Option_t* opt="");//writes the task for PID to file
98 // Bool_t PostPID (AliPHOSPID * pid) const {return kTRUE;}
99 // Bool_t PostQA (void) const ; //it was empty anyway
101 /*******************************************************************/
102 /*******************************************************************/
103 /*******************************************************************/
105 TObject** HitsRef(){return GetDetectorDataRef(Hits());}
106 TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());}
107 TObject** DigitsRef(){return GetDetectorDataRef(Digits());}
108 TObject** EmcRecPointsRef(){return GetDetectorDataRef(EmcRecPoints());}
109 TObject** CpvRecPointsRef(){return GetDetectorDataRef(CpvRecPoints());}
110 TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());}
111 TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());}
112 TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());}
113 void Track(Int_t itrack) ;
115 static AliPHOSGeometry* GetPHOSGeometry();
116 static AliPHOSLoader* GetPHOSLoader(const char* eventfoldername);
118 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
119 Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();}
120 Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();}
122 const AliPHOS * PHOS();
123 const AliPHOSGeometry *PHOSGeometry() ;
125 // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); }
126 TObjArray * Alarms();
128 /*********************************************/
129 /************ TClonesArrays ***********/
130 /*********************************************/
132 TClonesArray* Hits(void);
133 const AliPHOSHit* Hit(Int_t index);
134 void MakeHitsArray();
135 /**** S D i g i t s ****/
136 TClonesArray* SDigits();
137 const AliPHOSDigit* SDigit(Int_t index);
138 void MakeSDigitsArray();
139 /**** D i g i t s ****/
140 TClonesArray* Digits();
141 const AliPHOSDigit * Digit(Int_t index);
142 void MakeDigitsArray();
143 /**** R e c P o i n t s ****/
144 TObjArray * EmcRecPoints();
145 TObjArray * CpvRecPoints();
146 const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) ;
147 const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) ;
148 void MakeRecPointsArray();
149 /**** T r a c k S e g m e n t s ****/
150 TClonesArray * TrackSegments();
151 const AliPHOSTrackSegment * TrackSegment(Int_t index);
152 void MakeTrackSegmentsArray();
153 /**** R e c P a r t ic l e s ****/
154 TClonesArray * RecParticles() ;
155 const AliPHOSRecParticle * RecParticle(Int_t index);
156 void MakeRecParticlesArray();
158 /*********************************************/
159 /************ T A S K S **************/
160 /*********************************************/
162 // AliPHOSSDigitizer* PHOSSDigitizer(TString name = AliConfig::fgkDefaultEventFolderName);
163 //AliPHOSDigitizer* PHOSDigitizer() { return dynamic_cast<AliPHOSDigitizer*>(Digitizer()) ;}
165 AliPHOSClusterizer* Clusterizer () {return dynamic_cast<AliPHOSClusterizer*>(Reconstructioner()) ;}
166 Int_t PostClusterizer(TTask* clust){return PostReconstructioner(clust);}
167 Int_t LoadClusterizer(Option_t * opt="") {return LoadReconstructioner(opt);}
168 Int_t WriteClusterizer(Option_t * opt="") {return WriteReconstructioner(opt);}
170 AliPHOSPID * PID (){return dynamic_cast<AliPHOSPID*>(PIDTask()) ;}
171 Int_t PostPID(TTask* pid){return PostPIDTask(pid);}
172 Int_t LoadPID(Option_t * opt="") {return LoadPIDTask(opt);}
173 Int_t WritePID(Option_t * opt="") {return WritePIDTask(opt);}
176 AliPHOSTrackSegmentMaker * TrackSegmentMaker () { return dynamic_cast<AliPHOSTrackSegmentMaker *>(Tracker()) ;}
177 Int_t PostTrackSegmentMaker(TTask* segmaker){return PostTracker(segmaker);}
178 Int_t LoadTrackSegmentMaker(Option_t * opt="") {return LoadTracker(opt);}
179 Int_t WriteTrackSegmentMaker(Option_t * opt="") {return WriteTracker(opt);}
182 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
183 void SetBranchTitle(const TString& btitle);
185 AliPHOSCalibrationDB * CalibrationDB(){return fcdb; }
186 void ReadCalibrationDB(const char * name, const char * filename);
189 TString fBranchTitle; //Title of the branch
190 AliPHOSCalibrationDB * fcdb ; //!
197 Int_t ReadRecPoints();
199 Int_t ReadRecParticles();
202 Int_t fDebug ; // Debug level
206 static const TString fgkHitsName;//Name for TClonesArray with hits from one event
207 static const TString fgkSDigitsName;//Name for TClonesArray
208 static const TString fgkDigitsName;//Name for TClonesArray
209 static const TString fgkEmcRecPointsName;//Name for TClonesArray
210 static const TString fgkCpvRecPointsName;//Name for TClonesArray
211 static const TString fgkTracksName;//Name for TClonesArray
212 static const TString fgkRecParticlesName;//Name for TClonesArray
214 static const TString fgkEmcRecPointsBranchName;//Name for branch
215 static const TString fgkCpvRecPointsBranchName;//Name for branch
216 static const TString fgkTrackSegmentsBranchName;//Name for branch
217 static const TString fgkRecParticlesBranchName;//Name for branch
219 ClassDef(AliPHOSLoader,3) // Algorithm class that provides methods to retrieve objects from a list knowing the index
223 /******************************************************************************/
224 /**************** I N L I N E S ****************************************/
225 /******************************************************************************/
227 inline TClonesArray* AliPHOSLoader::Hits()
229 return (TClonesArray*)GetDetectorData(fgkHitsName);
231 /******************************************************************************/
233 inline const AliPHOSHit* AliPHOSLoader::Hit(Int_t index)
235 const TClonesArray* tcarr = Hits();
237 return (const AliPHOSHit*) tcarr->At(index);
240 /******************************************************************************/
242 inline TClonesArray* AliPHOSLoader::SDigits()
244 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName));
246 /******************************************************************************/
248 inline const AliPHOSDigit* AliPHOSLoader::SDigit(Int_t index)
250 const TClonesArray* tcarr = SDigits();
252 return (const AliPHOSDigit*) tcarr->At(index);
255 /******************************************************************************/
257 inline TClonesArray* AliPHOSLoader::Digits()
259 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName));
261 /******************************************************************************/
263 inline const AliPHOSDigit* AliPHOSLoader::Digit(Int_t index)
265 const TClonesArray* tcarr = Digits();
267 return (const AliPHOSDigit*) tcarr->At(index);
270 /******************************************************************************/
272 inline TObjArray * AliPHOSLoader::EmcRecPoints()
274 return dynamic_cast<TObjArray*>(GetDetectorData(fgkEmcRecPointsName));
276 /******************************************************************************/
278 inline const AliPHOSEmcRecPoint * AliPHOSLoader::EmcRecPoint(Int_t index)
280 TObjArray* tcarr = EmcRecPoints();
282 return (const AliPHOSEmcRecPoint*) tcarr->At(index);
285 /******************************************************************************/
287 inline TObjArray * AliPHOSLoader::CpvRecPoints()
289 return dynamic_cast<TObjArray*>(GetDetectorData(fgkCpvRecPointsName));
291 /******************************************************************************/
293 inline const AliPHOSCpvRecPoint * AliPHOSLoader::CpvRecPoint(Int_t index)
295 TObjArray* tcarr = CpvRecPoints();
297 return (const AliPHOSCpvRecPoint*) tcarr->At(index);
300 /******************************************************************************/
302 inline TClonesArray * AliPHOSLoader::TrackSegments()
304 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName));
306 /******************************************************************************/
308 inline const AliPHOSTrackSegment * AliPHOSLoader::TrackSegment(Int_t index)
310 const TClonesArray* tcarr = TrackSegments();
312 return (const AliPHOSTrackSegment*) tcarr->At(index);
315 /******************************************************************************/
317 inline TClonesArray * AliPHOSLoader::RecParticles()
319 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName));
321 /******************************************************************************/
323 inline const AliPHOSRecParticle* AliPHOSLoader::RecParticle(Int_t index)
325 TClonesArray* tcarr = RecParticles();
327 return (const AliPHOSRecParticle*) tcarr->At(index);
330 /******************************************************************************/
331 inline TObjArray * AliPHOSLoader::Alarms()
332 { return (TObjArray*)(GetQAFolder()->FindObject(fDetectorName));}
334 #endif // AliPHOSLOADER_H