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