]>
Commit | Line | Data |
---|---|---|
88cb7938 | 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 */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
702ab87e | 8 | /* History of cvs commits: |
9 | * | |
10 | * $Log$ | |
9a2cdbdf | 11 | * Revision 1.12 2006/08/25 16:00:53 kharlov |
12 | * Compliance with Effective C++AliPHOSHit.cxx | |
13 | * | |
e2429969 | 14 | * Revision 1.11 2006/08/01 12:15:03 cvetan |
15 | * Adding a constructor from TFolder. Needed by AliReconstruction plugin scheme | |
16 | * | |
e15840a7 | 17 | * Revision 1.10 2005/05/28 14:19:04 schutz |
18 | * Compilation warnings fixed by T.P. | |
19 | * | |
702ab87e | 20 | */ |
21 | ||
88cb7938 | 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. | |
27 | // | |
28 | // The objects are retrived from folders. | |
8d8258f6 | 29 | //-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) |
88cb7938 | 30 | // |
31 | ||
32 | ||
33 | // --- ROOT system --- | |
34 | #include "TClonesArray.h" | |
88cb7938 | 35 | class TString ; |
36 | class TParticle ; | |
37 | class TTask ; | |
38 | ||
39 | // --- Standard library --- | |
88cb7938 | 40 | |
41 | // --- AliRoot header files --- | |
88cb7938 | 42 | #include "AliRun.h" |
43 | #include "AliLoader.h" | |
44 | #include "AliRunLoader.h" | |
88cb7938 | 45 | #include "AliPHOSClusterizer.h" |
46 | #include "AliPHOSTrackSegmentMaker.h" | |
47 | #include "AliPHOSPID.h" | |
e957fea8 | 48 | class AliPHOS ; |
e957fea8 | 49 | class AliPHOSHit ; |
50 | class AliPHOSDigit ; | |
51 | class AliPHOSEmcRecPoint ; | |
52 | class AliPHOSCpvRecPoint ; | |
53 | class AliPHOSTrackSegment ; | |
54 | class AliPHOSRecParticle ; | |
88cb7938 | 55 | class AliPHOSCalibrationDB ; |
e957fea8 | 56 | class AliPHOSSDigitizer ; |
57 | class AliPHOSDigitizer ; | |
58 | ||
88cb7938 | 59 | class AliPHOSLoader : public AliLoader { |
60 | ||
8f9475fc | 61 | public: |
88cb7938 | 62 | |
63 | AliPHOSLoader(); | |
e2429969 | 64 | AliPHOSLoader(const AliPHOSLoader & obj); |
88cb7938 | 65 | AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername); |
e15840a7 | 66 | AliPHOSLoader(const Char_t *detname,TFolder *topfolder); |
88cb7938 | 67 | |
68 | virtual ~AliPHOSLoader() ; | |
69 | ||
70 | // assignement operator requested by coding convention, but not needed | |
71 | AliPHOSLoader & operator = (const AliPHOSLoader & ) {return *this;} | |
72 | ||
73 | Int_t GetEvent();//extends the method on PHOS RecPart posting | |
74 | Int_t SetEvent();//extends the method on PHOS RecPart posting | |
75 | ||
76 | Bool_t BranchExists(const TString& recName); | |
77 | Int_t LoadHits(Option_t* opt=""); //reads from disk and sends them to folder; array as well as tree | |
78 | Int_t LoadSDigits(Option_t* opt=""); | |
79 | Int_t LoadDigits(Option_t* opt=""); //reads Digits from disk and sends them to folder; array as well as tree | |
80 | Int_t LoadRecPoints(Option_t* opt=""); //reads RecPoints from disk and sends them to folder; array as well as tree | |
81 | Int_t LoadTracks(Option_t* opt=""); //reads Tracks from disk and sends them to folder; array as well as tree | |
82 | Int_t LoadRecParticles(Option_t* opt=""); | |
83 | ||
702ab87e | 84 | Int_t PostHits()const; //Posts the |
85 | Int_t PostSDigits()const; | |
86 | Int_t PostDigits()const; | |
87 | Int_t PostRecPoints()const; | |
88 | Int_t PostTracks()const; | |
89 | Int_t PostRecParticles()const; | |
88cb7938 | 90 | |
91 | void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean | |
92 | ||
702ab87e | 93 | void CleanHits()const; |
94 | void CleanSDigits()const; | |
95 | void CleanDigits()const; | |
96 | void CleanRecPoints()const; | |
97 | void CleanTracks()const; | |
88cb7938 | 98 | void CleanRecParticles(); |
99 | ||
100 | //up to now it is only here -> no definition about global/incremental tracking/PID | |
101 | ||
102 | // Int_t WriteRecParticles(Option_t* opt="");//writes the reconstructed particles | |
103 | // Int_t WritePID(Option_t* opt="");//writes the task for PID to file | |
104 | // Bool_t PostPID (AliPHOSPID * pid) const {return kTRUE;} | |
88cb7938 | 105 | |
106 | /*******************************************************************/ | |
107 | /*******************************************************************/ | |
108 | /*******************************************************************/ | |
109 | ||
110 | TObject** HitsRef(){return GetDetectorDataRef(Hits());} | |
111 | TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());} | |
112 | TObject** DigitsRef(){return GetDetectorDataRef(Digits());} | |
113 | TObject** EmcRecPointsRef(){return GetDetectorDataRef(EmcRecPoints());} | |
114 | TObject** CpvRecPointsRef(){return GetDetectorDataRef(CpvRecPoints());} | |
115 | TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());} | |
116 | TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());} | |
117 | TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());} | |
118 | void Track(Int_t itrack) ; | |
119 | ||
88cb7938 | 120 | static AliPHOSLoader* GetPHOSLoader(const char* eventfoldername); |
121 | ||
122 | //Method to be used when digitizing under AliRunDigitizer, who opens all files etc. | |
123 | Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();} | |
124 | Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();} | |
125 | ||
ba999b0a | 126 | /* const AliPHOS * PHOS(); */ |
88cb7938 | 127 | // Alarms |
128 | // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); } | |
b6b12ef4 | 129 | TObjArray * Alarms() {return 0x0;} |
88cb7938 | 130 | |
131 | /*********************************************/ | |
132 | /************ TClonesArrays ***********/ | |
133 | /*********************************************/ | |
134 | /**** H i t s ****/ | |
135 | TClonesArray* Hits(void); | |
136 | const AliPHOSHit* Hit(Int_t index); | |
137 | void MakeHitsArray(); | |
138 | /**** S D i g i t s ****/ | |
139 | TClonesArray* SDigits(); | |
140 | const AliPHOSDigit* SDigit(Int_t index); | |
141 | void MakeSDigitsArray(); | |
142 | /**** D i g i t s ****/ | |
143 | TClonesArray* Digits(); | |
144 | const AliPHOSDigit * Digit(Int_t index); | |
145 | void MakeDigitsArray(); | |
146 | /**** R e c P o i n t s ****/ | |
147 | TObjArray * EmcRecPoints(); | |
148 | TObjArray * CpvRecPoints(); | |
149 | const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) ; | |
150 | const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) ; | |
151 | void MakeRecPointsArray(); | |
152 | /**** T r a c k S e g m e n t s ****/ | |
153 | TClonesArray * TrackSegments(); | |
154 | const AliPHOSTrackSegment * TrackSegment(Int_t index); | |
155 | void MakeTrackSegmentsArray(); | |
156 | /**** R e c P a r t ic l e s ****/ | |
157 | TClonesArray * RecParticles() ; | |
158 | const AliPHOSRecParticle * RecParticle(Int_t index); | |
159 | void MakeRecParticlesArray(); | |
160 | ||
161 | /*********************************************/ | |
162 | /************ T A S K S **************/ | |
163 | /*********************************************/ | |
164 | // | |
e191bb57 | 165 | // AliPHOSSDigitizer* PHOSSDigitizer(TString name = AliConfig::GetDefaultEventFolderName()); |
88cb7938 | 166 | //AliPHOSDigitizer* PHOSDigitizer() { return dynamic_cast<AliPHOSDigitizer*>(Digitizer()) ;} |
167 | ||
8f9475fc | 168 | AliPHOSPID * PID () const {return dynamic_cast<AliPHOSPID*>(PIDTask()) ;} |
8f9475fc | 169 | Int_t LoadPID(Option_t * opt="") const {return LoadPIDTask(opt);} |
170 | Int_t WritePID(Option_t * opt="") const {return WritePIDTask(opt);} | |
88cb7938 | 171 | |
172 | ||
8f9475fc | 173 | AliPHOSTrackSegmentMaker * TrackSegmentMaker () const { return dynamic_cast<AliPHOSTrackSegmentMaker *>(Tracker()) ;} |
8f9475fc | 174 | Int_t LoadTrackSegmentMaker(Option_t * opt="") const {return LoadTracker(opt);} |
175 | Int_t WriteTrackSegmentMaker(Option_t * opt="") const {return WriteTracker(opt);} | |
88cb7938 | 176 | |
177 | ||
178 | void SetDebug(Int_t level) {fDebug = level;} // Set debug level | |
179 | void SetBranchTitle(const TString& btitle); | |
e2429969 | 180 | |
181 | Int_t GetDebug() const {return fDebug; } | |
182 | TString GetBranchTitle() const {return fBranchTitle;} | |
183 | AliPHOSCalibrationDB * CalibrationDB() const {return fcdb; } | |
88cb7938 | 184 | void ReadCalibrationDB(const char * name, const char * filename); |
185 | ||
186 | protected: | |
187 | TString fBranchTitle; //Title of the branch | |
188 | AliPHOSCalibrationDB * fcdb ; //! | |
189 | ||
190 | private: | |
191 | ||
192 | Int_t ReadHits(); | |
193 | Int_t ReadDigits(); | |
194 | Int_t ReadSDigits(); | |
195 | Int_t ReadRecPoints(); | |
196 | Int_t ReadTracks(); | |
197 | Int_t ReadRecParticles(); | |
198 | ||
88cb7938 | 199 | Int_t fDebug ; // Debug level |
8d8258f6 | 200 | TClonesArray *fTmpHits; //! Temporary array of hits per track |
8f9475fc | 201 | |
202 | static const TString fgkHitsName;//Name for TClonesArray with hits from one event | |
203 | static const TString fgkSDigitsName;//Name for TClonesArray | |
204 | static const TString fgkDigitsName;//Name for TClonesArray | |
205 | static const TString fgkEmcRecPointsName;//Name for TClonesArray | |
206 | static const TString fgkCpvRecPointsName;//Name for TClonesArray | |
207 | static const TString fgkTracksName;//Name for TClonesArray | |
208 | static const TString fgkRecParticlesName;//Name for TClonesArray | |
209 | ||
210 | static const TString fgkEmcRecPointsBranchName;//Name for branch | |
211 | static const TString fgkCpvRecPointsBranchName;//Name for branch | |
212 | static const TString fgkTrackSegmentsBranchName;//Name for branch | |
213 | static const TString fgkRecParticlesBranchName;//Name for branch | |
214 | ||
88cb7938 | 215 | |
8d8258f6 | 216 | ClassDef(AliPHOSLoader,4) // Algorithm class that provides methods to retrieve objects from a list knowing the index |
88cb7938 | 217 | |
218 | }; | |
219 | ||
220 | /******************************************************************************/ | |
221 | /**************** I N L I N E S ****************************************/ | |
222 | /******************************************************************************/ | |
223 | ||
224 | inline TClonesArray* AliPHOSLoader::Hits() | |
225 | { | |
226 | return (TClonesArray*)GetDetectorData(fgkHitsName); | |
227 | } | |
228 | /******************************************************************************/ | |
229 | ||
230 | inline const AliPHOSHit* AliPHOSLoader::Hit(Int_t index) | |
231 | { | |
232 | const TClonesArray* tcarr = Hits(); | |
233 | if (tcarr) | |
234 | return (const AliPHOSHit*) tcarr->At(index); | |
235 | return 0x0; | |
236 | } | |
237 | /******************************************************************************/ | |
238 | ||
239 | inline TClonesArray* AliPHOSLoader::SDigits() | |
240 | { | |
241 | return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName)); | |
242 | } | |
243 | /******************************************************************************/ | |
244 | ||
245 | inline const AliPHOSDigit* AliPHOSLoader::SDigit(Int_t index) | |
246 | { | |
247 | const TClonesArray* tcarr = SDigits(); | |
248 | if (tcarr) | |
249 | return (const AliPHOSDigit*) tcarr->At(index); | |
250 | return 0x0; | |
251 | } | |
252 | /******************************************************************************/ | |
253 | ||
254 | inline TClonesArray* AliPHOSLoader::Digits() | |
255 | { | |
256 | return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName)); | |
257 | } | |
258 | /******************************************************************************/ | |
259 | ||
260 | inline const AliPHOSDigit* AliPHOSLoader::Digit(Int_t index) | |
261 | { | |
262 | const TClonesArray* tcarr = Digits(); | |
263 | if (tcarr) | |
264 | return (const AliPHOSDigit*) tcarr->At(index); | |
265 | return 0x0; | |
266 | } | |
267 | /******************************************************************************/ | |
268 | ||
269 | inline TObjArray * AliPHOSLoader::EmcRecPoints() | |
270 | { | |
271 | return dynamic_cast<TObjArray*>(GetDetectorData(fgkEmcRecPointsName)); | |
272 | } | |
273 | /******************************************************************************/ | |
274 | ||
275 | inline const AliPHOSEmcRecPoint * AliPHOSLoader::EmcRecPoint(Int_t index) | |
276 | { | |
277 | TObjArray* tcarr = EmcRecPoints(); | |
278 | if (tcarr) | |
279 | return (const AliPHOSEmcRecPoint*) tcarr->At(index); | |
280 | return 0x0; | |
281 | } | |
282 | /******************************************************************************/ | |
283 | ||
284 | inline TObjArray * AliPHOSLoader::CpvRecPoints() | |
285 | { | |
286 | return dynamic_cast<TObjArray*>(GetDetectorData(fgkCpvRecPointsName)); | |
287 | } | |
288 | /******************************************************************************/ | |
289 | ||
290 | inline const AliPHOSCpvRecPoint * AliPHOSLoader::CpvRecPoint(Int_t index) | |
291 | { | |
292 | TObjArray* tcarr = CpvRecPoints(); | |
293 | if (tcarr) | |
294 | return (const AliPHOSCpvRecPoint*) tcarr->At(index); | |
295 | return 0x0; | |
296 | } | |
297 | /******************************************************************************/ | |
298 | ||
299 | inline TClonesArray * AliPHOSLoader::TrackSegments() | |
300 | { | |
301 | return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName)); | |
302 | } | |
303 | /******************************************************************************/ | |
304 | ||
305 | inline const AliPHOSTrackSegment * AliPHOSLoader::TrackSegment(Int_t index) | |
306 | { | |
307 | const TClonesArray* tcarr = TrackSegments(); | |
308 | if (tcarr) | |
309 | return (const AliPHOSTrackSegment*) tcarr->At(index); | |
310 | return 0x0; | |
311 | } | |
312 | /******************************************************************************/ | |
313 | ||
314 | inline TClonesArray * AliPHOSLoader::RecParticles() | |
315 | { | |
316 | return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName)); | |
317 | } | |
318 | /******************************************************************************/ | |
319 | ||
320 | inline const AliPHOSRecParticle* AliPHOSLoader::RecParticle(Int_t index) | |
321 | { | |
322 | TClonesArray* tcarr = RecParticles(); | |
323 | if (tcarr) | |
324 | return (const AliPHOSRecParticle*) tcarr->At(index); | |
325 | return 0x0; | |
326 | } | |
88cb7938 | 327 | |
328 | #endif // AliPHOSLOADER_H |