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 /* History of cvs commits:
13 //_________________________________________________________________________
14 // A singleton that returns various objects
15 // Should be used on the analysis stage to avoid confusing between different
16 // branches of reconstruction tree: e.g. reading RecPoints and TS made from
17 // another set of RecPoints.
19 // The objects are retrived from folders.
20 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
24 // --- ROOT system ---
25 #include "TClonesArray.h"
30 // --- Standard library ---
32 // --- AliRoot header files ---
35 #include "AliLoader.h"
36 #include "AliRunLoader.h"
37 #include "AliPHOSClusterizer.h"
38 #include "AliPHOSTrackSegmentMaker.h"
39 #include "AliPHOSPID.h"
41 class AliPHOSGeometry ;
44 class AliPHOSEmcRecPoint ;
45 class AliPHOSCpvRecPoint ;
46 class AliPHOSTrackSegment ;
47 class AliPHOSRecParticle ;
48 class AliPHOSCalibrationDB ;
49 class AliPHOSSDigitizer ;
50 class AliPHOSDigitizer ;
56 class AliPHOSLoader : public AliLoader {
61 AliPHOSLoader(const AliPHOSLoader & obj) : AliLoader(obj) {}
62 AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername);
64 virtual ~AliPHOSLoader() ;
66 // assignement operator requested by coding convention, but not needed
67 AliPHOSLoader & operator = (const AliPHOSLoader & ) {return *this;}
69 Int_t GetEvent();//extends the method on PHOS RecPart posting
70 Int_t SetEvent();//extends the method on PHOS RecPart posting
72 Bool_t BranchExists(const TString& recName);
73 Int_t LoadHits(Option_t* opt=""); //reads from disk and sends them to folder; array as well as tree
74 Int_t LoadSDigits(Option_t* opt="");
75 Int_t LoadDigits(Option_t* opt=""); //reads Digits from disk and sends them to folder; array as well as tree
76 Int_t LoadRecPoints(Option_t* opt=""); //reads RecPoints from disk and sends them to folder; array as well as tree
77 Int_t LoadTracks(Option_t* opt=""); //reads Tracks from disk and sends them to folder; array as well as tree
78 Int_t LoadRecParticles(Option_t* opt="");
80 Int_t PostHits()const; //Posts the
81 Int_t PostSDigits()const;
82 Int_t PostDigits()const;
83 Int_t PostRecPoints()const;
84 Int_t PostTracks()const;
85 Int_t PostRecParticles()const;
87 void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean
89 void CleanHits()const;
90 void CleanSDigits()const;
91 void CleanDigits()const;
92 void CleanRecPoints()const;
93 void CleanTracks()const;
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 (AliPHOSPID * pid) const {return kTRUE;}
102 /*******************************************************************/
103 /*******************************************************************/
104 /*******************************************************************/
106 TObject** HitsRef(){return GetDetectorDataRef(Hits());}
107 TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());}
108 TObject** DigitsRef(){return GetDetectorDataRef(Digits());}
109 TObject** EmcRecPointsRef(){return GetDetectorDataRef(EmcRecPoints());}
110 TObject** CpvRecPointsRef(){return GetDetectorDataRef(CpvRecPoints());}
111 TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());}
112 TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());}
113 TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());}
114 void Track(Int_t itrack) ;
116 static AliPHOSGeometry* GetPHOSGeometry();
117 static AliPHOSLoader* GetPHOSLoader(const char* eventfoldername);
119 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
120 Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();}
121 Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();}
123 const AliPHOS * PHOS();
124 const AliPHOSGeometry *PHOSGeometry() ;
126 // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); }
127 TObjArray * Alarms() {return 0x0;}
129 /*********************************************/
130 /************ TClonesArrays ***********/
131 /*********************************************/
133 TClonesArray* Hits(void);
134 const AliPHOSHit* Hit(Int_t index);
135 void MakeHitsArray();
136 /**** S D i g i t s ****/
137 TClonesArray* SDigits();
138 const AliPHOSDigit* SDigit(Int_t index);
139 void MakeSDigitsArray();
140 /**** D i g i t s ****/
141 TClonesArray* Digits();
142 const AliPHOSDigit * Digit(Int_t index);
143 void MakeDigitsArray();
144 /**** R e c P o i n t s ****/
145 TObjArray * EmcRecPoints();
146 TObjArray * CpvRecPoints();
147 const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) ;
148 const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) ;
149 void MakeRecPointsArray();
150 /**** T r a c k S e g m e n t s ****/
151 TClonesArray * TrackSegments();
152 const AliPHOSTrackSegment * TrackSegment(Int_t index);
153 void MakeTrackSegmentsArray();
154 /**** R e c P a r t ic l e s ****/
155 TClonesArray * RecParticles() ;
156 const AliPHOSRecParticle * RecParticle(Int_t index);
157 void MakeRecParticlesArray();
159 /*********************************************/
160 /************ T A S K S **************/
161 /*********************************************/
163 // AliPHOSSDigitizer* PHOSSDigitizer(TString name = AliConfig::GetDefaultEventFolderName());
164 //AliPHOSDigitizer* PHOSDigitizer() { return dynamic_cast<AliPHOSDigitizer*>(Digitizer()) ;}
166 AliPHOSClusterizer* Clusterizer () const {return dynamic_cast<AliPHOSClusterizer*>(Reconstructioner()) ;}
167 Int_t PostClusterizer(TTask* clust) const {return PostReconstructioner(clust);}
168 Int_t LoadClusterizer(Option_t * opt="") const {return LoadReconstructioner(opt);}
169 Int_t WriteClusterizer(Option_t * opt="") const {return WriteReconstructioner(opt);}
171 AliPHOSPID * PID () const {return dynamic_cast<AliPHOSPID*>(PIDTask()) ;}
172 Int_t PostPID(TTask* pid) const {return PostPIDTask(pid);}
173 Int_t LoadPID(Option_t * opt="") const {return LoadPIDTask(opt);}
174 Int_t WritePID(Option_t * opt="") const {return WritePIDTask(opt);}
177 AliPHOSTrackSegmentMaker * TrackSegmentMaker () const { return dynamic_cast<AliPHOSTrackSegmentMaker *>(Tracker()) ;}
178 Int_t PostTrackSegmentMaker(TTask* segmaker) const {return PostTracker(segmaker);}
179 Int_t LoadTrackSegmentMaker(Option_t * opt="") const {return LoadTracker(opt);}
180 Int_t WriteTrackSegmentMaker(Option_t * opt="") const {return WriteTracker(opt);}
183 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
184 void SetBranchTitle(const TString& btitle);
186 AliPHOSCalibrationDB * CalibrationDB(){return fcdb; }
187 void ReadCalibrationDB(const char * name, const char * filename);
190 TString fBranchTitle; //Title of the branch
191 AliPHOSCalibrationDB * fcdb ; //!
198 Int_t ReadRecPoints();
200 Int_t ReadRecParticles();
202 Int_t fDebug ; // Debug level
204 static const TString fgkHitsName;//Name for TClonesArray with hits from one event
205 static const TString fgkSDigitsName;//Name for TClonesArray
206 static const TString fgkDigitsName;//Name for TClonesArray
207 static const TString fgkEmcRecPointsName;//Name for TClonesArray
208 static const TString fgkCpvRecPointsName;//Name for TClonesArray
209 static const TString fgkTracksName;//Name for TClonesArray
210 static const TString fgkRecParticlesName;//Name for TClonesArray
212 static const TString fgkEmcRecPointsBranchName;//Name for branch
213 static const TString fgkCpvRecPointsBranchName;//Name for branch
214 static const TString fgkTrackSegmentsBranchName;//Name for branch
215 static const TString fgkRecParticlesBranchName;//Name for branch
218 ClassDef(AliPHOSLoader,3) // Algorithm class that provides methods to retrieve objects from a list knowing the index
222 /******************************************************************************/
223 /**************** I N L I N E S ****************************************/
224 /******************************************************************************/
226 inline TClonesArray* AliPHOSLoader::Hits()
228 return (TClonesArray*)GetDetectorData(fgkHitsName);
230 /******************************************************************************/
232 inline const AliPHOSHit* AliPHOSLoader::Hit(Int_t index)
234 const TClonesArray* tcarr = Hits();
236 return (const AliPHOSHit*) tcarr->At(index);
239 /******************************************************************************/
241 inline TClonesArray* AliPHOSLoader::SDigits()
243 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName));
245 /******************************************************************************/
247 inline const AliPHOSDigit* AliPHOSLoader::SDigit(Int_t index)
249 const TClonesArray* tcarr = SDigits();
251 return (const AliPHOSDigit*) tcarr->At(index);
254 /******************************************************************************/
256 inline TClonesArray* AliPHOSLoader::Digits()
258 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName));
260 /******************************************************************************/
262 inline const AliPHOSDigit* AliPHOSLoader::Digit(Int_t index)
264 const TClonesArray* tcarr = Digits();
266 return (const AliPHOSDigit*) tcarr->At(index);
269 /******************************************************************************/
271 inline TObjArray * AliPHOSLoader::EmcRecPoints()
273 return dynamic_cast<TObjArray*>(GetDetectorData(fgkEmcRecPointsName));
275 /******************************************************************************/
277 inline const AliPHOSEmcRecPoint * AliPHOSLoader::EmcRecPoint(Int_t index)
279 TObjArray* tcarr = EmcRecPoints();
281 return (const AliPHOSEmcRecPoint*) tcarr->At(index);
284 /******************************************************************************/
286 inline TObjArray * AliPHOSLoader::CpvRecPoints()
288 return dynamic_cast<TObjArray*>(GetDetectorData(fgkCpvRecPointsName));
290 /******************************************************************************/
292 inline const AliPHOSCpvRecPoint * AliPHOSLoader::CpvRecPoint(Int_t index)
294 TObjArray* tcarr = CpvRecPoints();
296 return (const AliPHOSCpvRecPoint*) tcarr->At(index);
299 /******************************************************************************/
301 inline TClonesArray * AliPHOSLoader::TrackSegments()
303 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName));
305 /******************************************************************************/
307 inline const AliPHOSTrackSegment * AliPHOSLoader::TrackSegment(Int_t index)
309 const TClonesArray* tcarr = TrackSegments();
311 return (const AliPHOSTrackSegment*) tcarr->At(index);
314 /******************************************************************************/
316 inline TClonesArray * AliPHOSLoader::RecParticles()
318 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName));
320 /******************************************************************************/
322 inline const AliPHOSRecParticle* AliPHOSLoader::RecParticle(Int_t index)
324 TClonesArray* tcarr = RecParticles();
326 return (const AliPHOSRecParticle*) tcarr->At(index);
330 #endif // AliPHOSLOADER_H