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.12 2006/08/25 16:00:53 kharlov
12 * Compliance with Effective C++AliPHOSHit.cxx
14 * Revision 1.11 2006/08/01 12:15:03 cvetan
15 * Adding a constructor from TFolder. Needed by AliReconstruction plugin scheme
17 * Revision 1.10 2005/05/28 14:19:04 schutz
18 * Compilation warnings fixed by T.P.
22 //_________________________________________________________________________
23 // A singleton that returns various objects
24 // Should be used on the analysis stage to avoid confusing between different
25 // branches of reconstruction tree: e.g. reading RecPoints and TS made from
26 // another set of RecPoints.
28 // The objects are retrived from folders.
29 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
33 // --- ROOT system ---
34 #include "TClonesArray.h"
39 // --- Standard library ---
41 // --- AliRoot header files ---
44 #include "AliLoader.h"
45 #include "AliRunLoader.h"
46 #include "AliPHOSClusterizer.h"
47 #include "AliPHOSTrackSegmentMaker.h"
48 #include "AliPHOSPID.h"
50 class AliPHOSGeometry ;
53 class AliPHOSEmcRecPoint ;
54 class AliPHOSCpvRecPoint ;
55 class AliPHOSTrackSegment ;
56 class AliPHOSRecParticle ;
57 class AliPHOSCalibrationDB ;
58 class AliPHOSSDigitizer ;
59 class AliPHOSDigitizer ;
65 class AliPHOSLoader : public AliLoader {
70 AliPHOSLoader(const AliPHOSLoader & obj);
71 AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername);
72 AliPHOSLoader(const Char_t *detname,TFolder *topfolder);
74 virtual ~AliPHOSLoader() ;
76 // assignement operator requested by coding convention, but not needed
77 AliPHOSLoader & operator = (const AliPHOSLoader & ) {return *this;}
79 Int_t GetEvent();//extends the method on PHOS RecPart posting
80 Int_t SetEvent();//extends the method on PHOS RecPart posting
82 Bool_t BranchExists(const TString& recName);
83 Int_t LoadHits(Option_t* opt=""); //reads from disk and sends them to folder; array as well as tree
84 Int_t LoadSDigits(Option_t* opt="");
85 Int_t LoadDigits(Option_t* opt=""); //reads Digits from disk and sends them to folder; array as well as tree
86 Int_t LoadRecPoints(Option_t* opt=""); //reads RecPoints from disk and sends them to folder; array as well as tree
87 Int_t LoadTracks(Option_t* opt=""); //reads Tracks from disk and sends them to folder; array as well as tree
88 Int_t LoadRecParticles(Option_t* opt="");
90 Int_t PostHits()const; //Posts the
91 Int_t PostSDigits()const;
92 Int_t PostDigits()const;
93 Int_t PostRecPoints()const;
94 Int_t PostTracks()const;
95 Int_t PostRecParticles()const;
97 void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean
99 void CleanHits()const;
100 void CleanSDigits()const;
101 void CleanDigits()const;
102 void CleanRecPoints()const;
103 void CleanTracks()const;
104 void CleanRecParticles();
106 //up to now it is only here -> no definition about global/incremental tracking/PID
108 // Int_t WriteRecParticles(Option_t* opt="");//writes the reconstructed particles
109 // Int_t WritePID(Option_t* opt="");//writes the task for PID to file
110 // Bool_t PostPID (AliPHOSPID * pid) const {return kTRUE;}
112 /*******************************************************************/
113 /*******************************************************************/
114 /*******************************************************************/
116 TObject** HitsRef(){return GetDetectorDataRef(Hits());}
117 TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());}
118 TObject** DigitsRef(){return GetDetectorDataRef(Digits());}
119 TObject** EmcRecPointsRef(){return GetDetectorDataRef(EmcRecPoints());}
120 TObject** CpvRecPointsRef(){return GetDetectorDataRef(CpvRecPoints());}
121 TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());}
122 TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());}
123 TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());}
124 void Track(Int_t itrack) ;
126 static AliPHOSGeometry* GetPHOSGeometry();
127 static AliPHOSLoader* GetPHOSLoader(const char* eventfoldername);
129 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
130 Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();}
131 Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();}
133 const AliPHOS * PHOS();
134 const AliPHOSGeometry *PHOSGeometry() ;
136 // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); }
137 TObjArray * Alarms() {return 0x0;}
139 /*********************************************/
140 /************ TClonesArrays ***********/
141 /*********************************************/
143 TClonesArray* Hits(void);
144 const AliPHOSHit* Hit(Int_t index);
145 void MakeHitsArray();
146 /**** S D i g i t s ****/
147 TClonesArray* SDigits();
148 const AliPHOSDigit* SDigit(Int_t index);
149 void MakeSDigitsArray();
150 /**** D i g i t s ****/
151 TClonesArray* Digits();
152 const AliPHOSDigit * Digit(Int_t index);
153 void MakeDigitsArray();
154 /**** R e c P o i n t s ****/
155 TObjArray * EmcRecPoints();
156 TObjArray * CpvRecPoints();
157 const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) ;
158 const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) ;
159 void MakeRecPointsArray();
160 /**** T r a c k S e g m e n t s ****/
161 TClonesArray * TrackSegments();
162 const AliPHOSTrackSegment * TrackSegment(Int_t index);
163 void MakeTrackSegmentsArray();
164 /**** R e c P a r t ic l e s ****/
165 TClonesArray * RecParticles() ;
166 const AliPHOSRecParticle * RecParticle(Int_t index);
167 void MakeRecParticlesArray();
169 /*********************************************/
170 /************ T A S K S **************/
171 /*********************************************/
173 // AliPHOSSDigitizer* PHOSSDigitizer(TString name = AliConfig::GetDefaultEventFolderName());
174 //AliPHOSDigitizer* PHOSDigitizer() { return dynamic_cast<AliPHOSDigitizer*>(Digitizer()) ;}
176 AliPHOSPID * PID () const {return dynamic_cast<AliPHOSPID*>(PIDTask()) ;}
177 Int_t LoadPID(Option_t * opt="") const {return LoadPIDTask(opt);}
178 Int_t WritePID(Option_t * opt="") const {return WritePIDTask(opt);}
181 AliPHOSTrackSegmentMaker * TrackSegmentMaker () const { return dynamic_cast<AliPHOSTrackSegmentMaker *>(Tracker()) ;}
182 Int_t LoadTrackSegmentMaker(Option_t * opt="") const {return LoadTracker(opt);}
183 Int_t WriteTrackSegmentMaker(Option_t * opt="") const {return WriteTracker(opt);}
186 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
187 void SetBranchTitle(const TString& btitle);
189 Int_t GetDebug() const {return fDebug; }
190 TString GetBranchTitle() const {return fBranchTitle;}
191 AliPHOSCalibrationDB * CalibrationDB() const {return fcdb; }
192 void ReadCalibrationDB(const char * name, const char * filename);
195 TString fBranchTitle; //Title of the branch
196 AliPHOSCalibrationDB * fcdb ; //!
203 Int_t ReadRecPoints();
205 Int_t ReadRecParticles();
207 Int_t fDebug ; // Debug level
209 static const TString fgkHitsName;//Name for TClonesArray with hits from one event
210 static const TString fgkSDigitsName;//Name for TClonesArray
211 static const TString fgkDigitsName;//Name for TClonesArray
212 static const TString fgkEmcRecPointsName;//Name for TClonesArray
213 static const TString fgkCpvRecPointsName;//Name for TClonesArray
214 static const TString fgkTracksName;//Name for TClonesArray
215 static const TString fgkRecParticlesName;//Name for TClonesArray
217 static const TString fgkEmcRecPointsBranchName;//Name for branch
218 static const TString fgkCpvRecPointsBranchName;//Name for branch
219 static const TString fgkTrackSegmentsBranchName;//Name for branch
220 static const TString fgkRecParticlesBranchName;//Name for branch
223 ClassDef(AliPHOSLoader,3) // Algorithm class that provides methods to retrieve objects from a list knowing the index
227 /******************************************************************************/
228 /**************** I N L I N E S ****************************************/
229 /******************************************************************************/
231 inline TClonesArray* AliPHOSLoader::Hits()
233 return (TClonesArray*)GetDetectorData(fgkHitsName);
235 /******************************************************************************/
237 inline const AliPHOSHit* AliPHOSLoader::Hit(Int_t index)
239 const TClonesArray* tcarr = Hits();
241 return (const AliPHOSHit*) tcarr->At(index);
244 /******************************************************************************/
246 inline TClonesArray* AliPHOSLoader::SDigits()
248 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName));
250 /******************************************************************************/
252 inline const AliPHOSDigit* AliPHOSLoader::SDigit(Int_t index)
254 const TClonesArray* tcarr = SDigits();
256 return (const AliPHOSDigit*) tcarr->At(index);
259 /******************************************************************************/
261 inline TClonesArray* AliPHOSLoader::Digits()
263 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName));
265 /******************************************************************************/
267 inline const AliPHOSDigit* AliPHOSLoader::Digit(Int_t index)
269 const TClonesArray* tcarr = Digits();
271 return (const AliPHOSDigit*) tcarr->At(index);
274 /******************************************************************************/
276 inline TObjArray * AliPHOSLoader::EmcRecPoints()
278 return dynamic_cast<TObjArray*>(GetDetectorData(fgkEmcRecPointsName));
280 /******************************************************************************/
282 inline const AliPHOSEmcRecPoint * AliPHOSLoader::EmcRecPoint(Int_t index)
284 TObjArray* tcarr = EmcRecPoints();
286 return (const AliPHOSEmcRecPoint*) tcarr->At(index);
289 /******************************************************************************/
291 inline TObjArray * AliPHOSLoader::CpvRecPoints()
293 return dynamic_cast<TObjArray*>(GetDetectorData(fgkCpvRecPointsName));
295 /******************************************************************************/
297 inline const AliPHOSCpvRecPoint * AliPHOSLoader::CpvRecPoint(Int_t index)
299 TObjArray* tcarr = CpvRecPoints();
301 return (const AliPHOSCpvRecPoint*) tcarr->At(index);
304 /******************************************************************************/
306 inline TClonesArray * AliPHOSLoader::TrackSegments()
308 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName));
310 /******************************************************************************/
312 inline const AliPHOSTrackSegment * AliPHOSLoader::TrackSegment(Int_t index)
314 const TClonesArray* tcarr = TrackSegments();
316 return (const AliPHOSTrackSegment*) tcarr->At(index);
319 /******************************************************************************/
321 inline TClonesArray * AliPHOSLoader::RecParticles()
323 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName));
325 /******************************************************************************/
327 inline const AliPHOSRecParticle* AliPHOSLoader::RecParticle(Int_t index)
329 TClonesArray* tcarr = RecParticles();
331 return (const AliPHOSRecParticle*) tcarr->At(index);
335 #endif // AliPHOSLOADER_H