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:
11 * Revision 1.11 2006/08/01 12:15:03 cvetan
12 * Adding a constructor from TFolder. Needed by AliReconstruction plugin scheme
14 * Revision 1.10 2005/05/28 14:19:04 schutz
15 * Compilation warnings fixed by T.P.
19 //_________________________________________________________________________
20 // A singleton that returns various objects
21 // Should be used on the analysis stage to avoid confusing between different
22 // branches of reconstruction tree: e.g. reading RecPoints and TS made from
23 // another set of RecPoints.
25 // The objects are retrived from folders.
26 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
30 // --- ROOT system ---
31 #include "TClonesArray.h"
36 // --- Standard library ---
38 // --- AliRoot header files ---
41 #include "AliLoader.h"
42 #include "AliRunLoader.h"
43 #include "AliPHOSClusterizer.h"
44 #include "AliPHOSTrackSegmentMaker.h"
45 #include "AliPHOSPID.h"
47 class AliPHOSGeometry ;
50 class AliPHOSEmcRecPoint ;
51 class AliPHOSCpvRecPoint ;
52 class AliPHOSTrackSegment ;
53 class AliPHOSRecParticle ;
54 class AliPHOSCalibrationDB ;
55 class AliPHOSSDigitizer ;
56 class AliPHOSDigitizer ;
62 class AliPHOSLoader : public AliLoader {
67 AliPHOSLoader(const AliPHOSLoader & obj);
68 AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername);
69 AliPHOSLoader(const Char_t *detname,TFolder *topfolder);
71 virtual ~AliPHOSLoader() ;
73 // assignement operator requested by coding convention, but not needed
74 AliPHOSLoader & operator = (const AliPHOSLoader & ) {return *this;}
76 Int_t GetEvent();//extends the method on PHOS RecPart posting
77 Int_t SetEvent();//extends the method on PHOS RecPart posting
79 Bool_t BranchExists(const TString& recName);
80 Int_t LoadHits(Option_t* opt=""); //reads from disk and sends them to folder; array as well as tree
81 Int_t LoadSDigits(Option_t* opt="");
82 Int_t LoadDigits(Option_t* opt=""); //reads Digits from disk and sends them to folder; array as well as tree
83 Int_t LoadRecPoints(Option_t* opt=""); //reads RecPoints from disk and sends them to folder; array as well as tree
84 Int_t LoadTracks(Option_t* opt=""); //reads Tracks from disk and sends them to folder; array as well as tree
85 Int_t LoadRecParticles(Option_t* opt="");
87 Int_t PostHits()const; //Posts the
88 Int_t PostSDigits()const;
89 Int_t PostDigits()const;
90 Int_t PostRecPoints()const;
91 Int_t PostTracks()const;
92 Int_t PostRecParticles()const;
94 void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean
96 void CleanHits()const;
97 void CleanSDigits()const;
98 void CleanDigits()const;
99 void CleanRecPoints()const;
100 void CleanTracks()const;
101 void CleanRecParticles();
103 //up to now it is only here -> no definition about global/incremental tracking/PID
105 // Int_t WriteRecParticles(Option_t* opt="");//writes the reconstructed particles
106 // Int_t WritePID(Option_t* opt="");//writes the task for PID to file
107 // Bool_t PostPID (AliPHOSPID * pid) const {return kTRUE;}
109 /*******************************************************************/
110 /*******************************************************************/
111 /*******************************************************************/
113 TObject** HitsRef(){return GetDetectorDataRef(Hits());}
114 TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());}
115 TObject** DigitsRef(){return GetDetectorDataRef(Digits());}
116 TObject** EmcRecPointsRef(){return GetDetectorDataRef(EmcRecPoints());}
117 TObject** CpvRecPointsRef(){return GetDetectorDataRef(CpvRecPoints());}
118 TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());}
119 TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());}
120 TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());}
121 void Track(Int_t itrack) ;
123 static AliPHOSGeometry* GetPHOSGeometry();
124 static AliPHOSLoader* GetPHOSLoader(const char* eventfoldername);
126 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
127 Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();}
128 Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();}
130 const AliPHOS * PHOS();
131 const AliPHOSGeometry *PHOSGeometry() ;
133 // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); }
134 TObjArray * Alarms() {return 0x0;}
136 /*********************************************/
137 /************ TClonesArrays ***********/
138 /*********************************************/
140 TClonesArray* Hits(void);
141 const AliPHOSHit* Hit(Int_t index);
142 void MakeHitsArray();
143 /**** S D i g i t s ****/
144 TClonesArray* SDigits();
145 const AliPHOSDigit* SDigit(Int_t index);
146 void MakeSDigitsArray();
147 /**** D i g i t s ****/
148 TClonesArray* Digits();
149 const AliPHOSDigit * Digit(Int_t index);
150 void MakeDigitsArray();
151 /**** R e c P o i n t s ****/
152 TObjArray * EmcRecPoints();
153 TObjArray * CpvRecPoints();
154 const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) ;
155 const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) ;
156 void MakeRecPointsArray();
157 /**** T r a c k S e g m e n t s ****/
158 TClonesArray * TrackSegments();
159 const AliPHOSTrackSegment * TrackSegment(Int_t index);
160 void MakeTrackSegmentsArray();
161 /**** R e c P a r t ic l e s ****/
162 TClonesArray * RecParticles() ;
163 const AliPHOSRecParticle * RecParticle(Int_t index);
164 void MakeRecParticlesArray();
166 /*********************************************/
167 /************ T A S K S **************/
168 /*********************************************/
170 // AliPHOSSDigitizer* PHOSSDigitizer(TString name = AliConfig::GetDefaultEventFolderName());
171 //AliPHOSDigitizer* PHOSDigitizer() { return dynamic_cast<AliPHOSDigitizer*>(Digitizer()) ;}
173 AliPHOSClusterizer* Clusterizer () const {return dynamic_cast<AliPHOSClusterizer*>(Reconstructioner()) ;}
174 Int_t PostClusterizer(TTask* clust) const {return PostReconstructioner(clust);}
175 Int_t LoadClusterizer(Option_t * opt="") const {return LoadReconstructioner(opt);}
176 Int_t WriteClusterizer(Option_t * opt="") const {return WriteReconstructioner(opt);}
178 AliPHOSPID * PID () const {return dynamic_cast<AliPHOSPID*>(PIDTask()) ;}
179 Int_t PostPID(TTask* pid) const {return PostPIDTask(pid);}
180 Int_t LoadPID(Option_t * opt="") const {return LoadPIDTask(opt);}
181 Int_t WritePID(Option_t * opt="") const {return WritePIDTask(opt);}
184 AliPHOSTrackSegmentMaker * TrackSegmentMaker () const { return dynamic_cast<AliPHOSTrackSegmentMaker *>(Tracker()) ;}
185 Int_t PostTrackSegmentMaker(TTask* segmaker) const {return PostTracker(segmaker);}
186 Int_t LoadTrackSegmentMaker(Option_t * opt="") const {return LoadTracker(opt);}
187 Int_t WriteTrackSegmentMaker(Option_t * opt="") const {return WriteTracker(opt);}
190 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
191 void SetBranchTitle(const TString& btitle);
193 Int_t GetDebug() const {return fDebug; }
194 TString GetBranchTitle() const {return fBranchTitle;}
195 AliPHOSCalibrationDB * CalibrationDB() const {return fcdb; }
196 void ReadCalibrationDB(const char * name, const char * filename);
199 TString fBranchTitle; //Title of the branch
200 AliPHOSCalibrationDB * fcdb ; //!
207 Int_t ReadRecPoints();
209 Int_t ReadRecParticles();
211 Int_t fDebug ; // Debug level
213 static const TString fgkHitsName;//Name for TClonesArray with hits from one event
214 static const TString fgkSDigitsName;//Name for TClonesArray
215 static const TString fgkDigitsName;//Name for TClonesArray
216 static const TString fgkEmcRecPointsName;//Name for TClonesArray
217 static const TString fgkCpvRecPointsName;//Name for TClonesArray
218 static const TString fgkTracksName;//Name for TClonesArray
219 static const TString fgkRecParticlesName;//Name for TClonesArray
221 static const TString fgkEmcRecPointsBranchName;//Name for branch
222 static const TString fgkCpvRecPointsBranchName;//Name for branch
223 static const TString fgkTrackSegmentsBranchName;//Name for branch
224 static const TString fgkRecParticlesBranchName;//Name for branch
227 ClassDef(AliPHOSLoader,3) // Algorithm class that provides methods to retrieve objects from a list knowing the index
231 /******************************************************************************/
232 /**************** I N L I N E S ****************************************/
233 /******************************************************************************/
235 inline TClonesArray* AliPHOSLoader::Hits()
237 return (TClonesArray*)GetDetectorData(fgkHitsName);
239 /******************************************************************************/
241 inline const AliPHOSHit* AliPHOSLoader::Hit(Int_t index)
243 const TClonesArray* tcarr = Hits();
245 return (const AliPHOSHit*) tcarr->At(index);
248 /******************************************************************************/
250 inline TClonesArray* AliPHOSLoader::SDigits()
252 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName));
254 /******************************************************************************/
256 inline const AliPHOSDigit* AliPHOSLoader::SDigit(Int_t index)
258 const TClonesArray* tcarr = SDigits();
260 return (const AliPHOSDigit*) tcarr->At(index);
263 /******************************************************************************/
265 inline TClonesArray* AliPHOSLoader::Digits()
267 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName));
269 /******************************************************************************/
271 inline const AliPHOSDigit* AliPHOSLoader::Digit(Int_t index)
273 const TClonesArray* tcarr = Digits();
275 return (const AliPHOSDigit*) tcarr->At(index);
278 /******************************************************************************/
280 inline TObjArray * AliPHOSLoader::EmcRecPoints()
282 return dynamic_cast<TObjArray*>(GetDetectorData(fgkEmcRecPointsName));
284 /******************************************************************************/
286 inline const AliPHOSEmcRecPoint * AliPHOSLoader::EmcRecPoint(Int_t index)
288 TObjArray* tcarr = EmcRecPoints();
290 return (const AliPHOSEmcRecPoint*) tcarr->At(index);
293 /******************************************************************************/
295 inline TObjArray * AliPHOSLoader::CpvRecPoints()
297 return dynamic_cast<TObjArray*>(GetDetectorData(fgkCpvRecPointsName));
299 /******************************************************************************/
301 inline const AliPHOSCpvRecPoint * AliPHOSLoader::CpvRecPoint(Int_t index)
303 TObjArray* tcarr = CpvRecPoints();
305 return (const AliPHOSCpvRecPoint*) tcarr->At(index);
308 /******************************************************************************/
310 inline TClonesArray * AliPHOSLoader::TrackSegments()
312 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName));
314 /******************************************************************************/
316 inline const AliPHOSTrackSegment * AliPHOSLoader::TrackSegment(Int_t index)
318 const TClonesArray* tcarr = TrackSegments();
320 return (const AliPHOSTrackSegment*) tcarr->At(index);
323 /******************************************************************************/
325 inline TClonesArray * AliPHOSLoader::RecParticles()
327 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName));
329 /******************************************************************************/
331 inline const AliPHOSRecParticle* AliPHOSLoader::RecParticle(Int_t index)
333 TClonesArray* tcarr = RecParticles();
335 return (const AliPHOSRecParticle*) tcarr->At(index);
339 #endif // AliPHOSLOADER_H