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"
25 // --- Standard library ---
27 // --- AliRoot header files ---
30 #include "AliLoader.h"
31 #include "AliRunLoader.h"
32 #include "AliPHOSClusterizer.h"
33 #include "AliPHOSTrackSegmentMaker.h"
34 #include "AliPHOSPID.h"
36 class AliPHOSGeometry ;
39 class AliPHOSEmcRecPoint ;
40 class AliPHOSCpvRecPoint ;
41 class AliPHOSTrackSegment ;
42 class AliPHOSRecParticle ;
43 class AliPHOSCalibrationDB ;
44 class AliPHOSSDigitizer ;
45 class AliPHOSDigitizer ;
51 class AliPHOSLoader : public AliLoader {
56 AliPHOSLoader(const AliPHOSLoader & obj) : AliLoader(obj) {}
57 AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername);
59 virtual ~AliPHOSLoader() ;
61 // assignement operator requested by coding convention, but not needed
62 AliPHOSLoader & operator = (const AliPHOSLoader & ) {return *this;}
64 Int_t GetEvent();//extends the method on PHOS RecPart posting
65 Int_t SetEvent();//extends the method on PHOS RecPart posting
67 Bool_t BranchExists(const TString& recName);
68 Int_t LoadHits(Option_t* opt=""); //reads from disk and sends them to folder; array as well as tree
69 Int_t LoadSDigits(Option_t* opt="");
70 Int_t LoadDigits(Option_t* opt=""); //reads Digits from disk and sends them to folder; array as well as tree
71 Int_t LoadRecPoints(Option_t* opt=""); //reads RecPoints from disk and sends them to folder; array as well as tree
72 Int_t LoadTracks(Option_t* opt=""); //reads Tracks from disk and sends them to folder; array as well as tree
73 Int_t LoadRecParticles(Option_t* opt="");
75 Int_t PostHits(); //Posts the
78 Int_t PostRecPoints();
80 Int_t PostRecParticles();
82 void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean
87 void CleanRecPoints();
89 void CleanRecParticles();
91 //up to now it is only here -> no definition about global/incremental tracking/PID
93 // Int_t WriteRecParticles(Option_t* opt="");//writes the reconstructed particles
94 // Int_t WritePID(Option_t* opt="");//writes the task for PID to file
95 // Bool_t PostPID (AliPHOSPID * pid) const {return kTRUE;}
97 /*******************************************************************/
98 /*******************************************************************/
99 /*******************************************************************/
101 TObject** HitsRef(){return GetDetectorDataRef(Hits());}
102 TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());}
103 TObject** DigitsRef(){return GetDetectorDataRef(Digits());}
104 TObject** EmcRecPointsRef(){return GetDetectorDataRef(EmcRecPoints());}
105 TObject** CpvRecPointsRef(){return GetDetectorDataRef(CpvRecPoints());}
106 TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());}
107 TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());}
108 TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());}
109 void Track(Int_t itrack) ;
111 static AliPHOSGeometry* GetPHOSGeometry();
112 static AliPHOSLoader* GetPHOSLoader(const char* eventfoldername);
114 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
115 Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();}
116 Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();}
118 const AliPHOS * PHOS();
119 const AliPHOSGeometry *PHOSGeometry() ;
121 // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); }
122 TObjArray * Alarms() {return 0x0;}
124 /*********************************************/
125 /************ TClonesArrays ***********/
126 /*********************************************/
128 TClonesArray* Hits(void);
129 const AliPHOSHit* Hit(Int_t index);
130 void MakeHitsArray();
131 /**** S D i g i t s ****/
132 TClonesArray* SDigits();
133 const AliPHOSDigit* SDigit(Int_t index);
134 void MakeSDigitsArray();
135 /**** D i g i t s ****/
136 TClonesArray* Digits();
137 const AliPHOSDigit * Digit(Int_t index);
138 void MakeDigitsArray();
139 /**** R e c P o i n t s ****/
140 TObjArray * EmcRecPoints();
141 TObjArray * CpvRecPoints();
142 const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) ;
143 const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) ;
144 void MakeRecPointsArray();
145 /**** T r a c k S e g m e n t s ****/
146 TClonesArray * TrackSegments();
147 const AliPHOSTrackSegment * TrackSegment(Int_t index);
148 void MakeTrackSegmentsArray();
149 /**** R e c P a r t ic l e s ****/
150 TClonesArray * RecParticles() ;
151 const AliPHOSRecParticle * RecParticle(Int_t index);
152 void MakeRecParticlesArray();
154 /*********************************************/
155 /************ T A S K S **************/
156 /*********************************************/
158 // AliPHOSSDigitizer* PHOSSDigitizer(TString name = AliConfig::GetDefaultEventFolderName());
159 //AliPHOSDigitizer* PHOSDigitizer() { return dynamic_cast<AliPHOSDigitizer*>(Digitizer()) ;}
161 AliPHOSClusterizer* Clusterizer () const {return dynamic_cast<AliPHOSClusterizer*>(Reconstructioner()) ;}
162 Int_t PostClusterizer(TTask* clust) const {return PostReconstructioner(clust);}
163 Int_t LoadClusterizer(Option_t * opt="") const {return LoadReconstructioner(opt);}
164 Int_t WriteClusterizer(Option_t * opt="") const {return WriteReconstructioner(opt);}
166 AliPHOSPID * PID () const {return dynamic_cast<AliPHOSPID*>(PIDTask()) ;}
167 Int_t PostPID(TTask* pid) const {return PostPIDTask(pid);}
168 Int_t LoadPID(Option_t * opt="") const {return LoadPIDTask(opt);}
169 Int_t WritePID(Option_t * opt="") const {return WritePIDTask(opt);}
172 AliPHOSTrackSegmentMaker * TrackSegmentMaker () const { return dynamic_cast<AliPHOSTrackSegmentMaker *>(Tracker()) ;}
173 Int_t PostTrackSegmentMaker(TTask* segmaker) const {return PostTracker(segmaker);}
174 Int_t LoadTrackSegmentMaker(Option_t * opt="") const {return LoadTracker(opt);}
175 Int_t WriteTrackSegmentMaker(Option_t * opt="") const {return WriteTracker(opt);}
178 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
179 void SetBranchTitle(const TString& btitle);
181 AliPHOSCalibrationDB * CalibrationDB(){return fcdb; }
182 void ReadCalibrationDB(const char * name, const char * filename);
185 TString fBranchTitle; //Title of the branch
186 AliPHOSCalibrationDB * fcdb ; //!
193 Int_t ReadRecPoints();
195 Int_t ReadRecParticles();
197 Int_t fDebug ; // Debug level
199 static const TString fgkHitsName;//Name for TClonesArray with hits from one event
200 static const TString fgkSDigitsName;//Name for TClonesArray
201 static const TString fgkDigitsName;//Name for TClonesArray
202 static const TString fgkEmcRecPointsName;//Name for TClonesArray
203 static const TString fgkCpvRecPointsName;//Name for TClonesArray
204 static const TString fgkTracksName;//Name for TClonesArray
205 static const TString fgkRecParticlesName;//Name for TClonesArray
207 static const TString fgkEmcRecPointsBranchName;//Name for branch
208 static const TString fgkCpvRecPointsBranchName;//Name for branch
209 static const TString fgkTrackSegmentsBranchName;//Name for branch
210 static const TString fgkRecParticlesBranchName;//Name for branch
213 ClassDef(AliPHOSLoader,3) // Algorithm class that provides methods to retrieve objects from a list knowing the index
217 /******************************************************************************/
218 /**************** I N L I N E S ****************************************/
219 /******************************************************************************/
221 inline TClonesArray* AliPHOSLoader::Hits()
223 return (TClonesArray*)GetDetectorData(fgkHitsName);
225 /******************************************************************************/
227 inline const AliPHOSHit* AliPHOSLoader::Hit(Int_t index)
229 const TClonesArray* tcarr = Hits();
231 return (const AliPHOSHit*) tcarr->At(index);
234 /******************************************************************************/
236 inline TClonesArray* AliPHOSLoader::SDigits()
238 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName));
240 /******************************************************************************/
242 inline const AliPHOSDigit* AliPHOSLoader::SDigit(Int_t index)
244 const TClonesArray* tcarr = SDigits();
246 return (const AliPHOSDigit*) tcarr->At(index);
249 /******************************************************************************/
251 inline TClonesArray* AliPHOSLoader::Digits()
253 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName));
255 /******************************************************************************/
257 inline const AliPHOSDigit* AliPHOSLoader::Digit(Int_t index)
259 const TClonesArray* tcarr = Digits();
261 return (const AliPHOSDigit*) tcarr->At(index);
264 /******************************************************************************/
266 inline TObjArray * AliPHOSLoader::EmcRecPoints()
268 return dynamic_cast<TObjArray*>(GetDetectorData(fgkEmcRecPointsName));
270 /******************************************************************************/
272 inline const AliPHOSEmcRecPoint * AliPHOSLoader::EmcRecPoint(Int_t index)
274 TObjArray* tcarr = EmcRecPoints();
276 return (const AliPHOSEmcRecPoint*) tcarr->At(index);
279 /******************************************************************************/
281 inline TObjArray * AliPHOSLoader::CpvRecPoints()
283 return dynamic_cast<TObjArray*>(GetDetectorData(fgkCpvRecPointsName));
285 /******************************************************************************/
287 inline const AliPHOSCpvRecPoint * AliPHOSLoader::CpvRecPoint(Int_t index)
289 TObjArray* tcarr = CpvRecPoints();
291 return (const AliPHOSCpvRecPoint*) tcarr->At(index);
294 /******************************************************************************/
296 inline TClonesArray * AliPHOSLoader::TrackSegments()
298 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName));
300 /******************************************************************************/
302 inline const AliPHOSTrackSegment * AliPHOSLoader::TrackSegment(Int_t index)
304 const TClonesArray* tcarr = TrackSegments();
306 return (const AliPHOSTrackSegment*) tcarr->At(index);
309 /******************************************************************************/
311 inline TClonesArray * AliPHOSLoader::RecParticles()
313 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName));
315 /******************************************************************************/
317 inline const AliPHOSRecParticle* AliPHOSLoader::RecParticle(Int_t index)
319 TClonesArray* tcarr = RecParticles();
321 return (const AliPHOSRecParticle*) tcarr->At(index);
325 #endif // AliPHOSLOADER_H