]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSLoader.h
Initial classes for Lee Yang Zeroes from Naomi van der Kolk
[u/mrichter/AliRoot.git] / PHOS / AliPHOSLoader.h
CommitLineData
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.
29//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
30//
31
32
33// --- ROOT system ---
34#include "TClonesArray.h"
88cb7938 35class TString ;
36class TParticle ;
37class TTask ;
38
39// --- Standard library ---
88cb7938 40
41// --- AliRoot header files ---
42
43#include "AliRun.h"
44#include "AliLoader.h"
45#include "AliRunLoader.h"
88cb7938 46#include "AliPHOSClusterizer.h"
47#include "AliPHOSTrackSegmentMaker.h"
48#include "AliPHOSPID.h"
e957fea8 49class AliPHOS ;
50class AliPHOSGeometry ;
51class AliPHOSHit ;
52class AliPHOSDigit ;
53class AliPHOSEmcRecPoint ;
54class AliPHOSCpvRecPoint ;
55class AliPHOSTrackSegment ;
56class AliPHOSRecParticle ;
88cb7938 57class AliPHOSCalibrationDB ;
e957fea8 58class AliPHOSSDigitizer ;
59class AliPHOSDigitizer ;
60
88cb7938 61
62
63//
64
65class AliPHOSLoader : public AliLoader {
66
8f9475fc 67public:
88cb7938 68
69 AliPHOSLoader();
e2429969 70 AliPHOSLoader(const AliPHOSLoader & obj);
88cb7938 71 AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername);
e15840a7 72 AliPHOSLoader(const Char_t *detname,TFolder *topfolder);
88cb7938 73
74 virtual ~AliPHOSLoader() ;
75
76 // assignement operator requested by coding convention, but not needed
77 AliPHOSLoader & operator = (const AliPHOSLoader & ) {return *this;}
78
79 Int_t GetEvent();//extends the method on PHOS RecPart posting
80 Int_t SetEvent();//extends the method on PHOS RecPart posting
81
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="");
89
702ab87e 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;
88cb7938 96
97 void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean
98
702ab87e 99 void CleanHits()const;
100 void CleanSDigits()const;
101 void CleanDigits()const;
102 void CleanRecPoints()const;
103 void CleanTracks()const;
88cb7938 104 void CleanRecParticles();
105
106//up to now it is only here -> no definition about global/incremental tracking/PID
107
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;}
88cb7938 111
112/*******************************************************************/
113/*******************************************************************/
114/*******************************************************************/
115
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) ;
125
126 static AliPHOSGeometry* GetPHOSGeometry();
127 static AliPHOSLoader* GetPHOSLoader(const char* eventfoldername);
128
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();}
132
133 const AliPHOS * PHOS();
134 const AliPHOSGeometry *PHOSGeometry() ;
135 // Alarms
136 // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); }
b6b12ef4 137 TObjArray * Alarms() {return 0x0;}
88cb7938 138
139 /*********************************************/
140 /************ TClonesArrays ***********/
141 /*********************************************/
142 /**** H i t s ****/
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();
168
169 /*********************************************/
170 /************ T A S K S **************/
171 /*********************************************/
172 //
e191bb57 173 // AliPHOSSDigitizer* PHOSSDigitizer(TString name = AliConfig::GetDefaultEventFolderName());
88cb7938 174 //AliPHOSDigitizer* PHOSDigitizer() { return dynamic_cast<AliPHOSDigitizer*>(Digitizer()) ;}
175
8f9475fc 176 AliPHOSPID * PID () const {return dynamic_cast<AliPHOSPID*>(PIDTask()) ;}
8f9475fc 177 Int_t LoadPID(Option_t * opt="") const {return LoadPIDTask(opt);}
178 Int_t WritePID(Option_t * opt="") const {return WritePIDTask(opt);}
88cb7938 179
180
8f9475fc 181 AliPHOSTrackSegmentMaker * TrackSegmentMaker () const { return dynamic_cast<AliPHOSTrackSegmentMaker *>(Tracker()) ;}
8f9475fc 182 Int_t LoadTrackSegmentMaker(Option_t * opt="") const {return LoadTracker(opt);}
183 Int_t WriteTrackSegmentMaker(Option_t * opt="") const {return WriteTracker(opt);}
88cb7938 184
185
186 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
187 void SetBranchTitle(const TString& btitle);
e2429969 188
189 Int_t GetDebug() const {return fDebug; }
190 TString GetBranchTitle() const {return fBranchTitle;}
191 AliPHOSCalibrationDB * CalibrationDB() const {return fcdb; }
88cb7938 192 void ReadCalibrationDB(const char * name, const char * filename);
193
194protected:
195 TString fBranchTitle; //Title of the branch
196 AliPHOSCalibrationDB * fcdb ; //!
197
198private:
199
200 Int_t ReadHits();
201 Int_t ReadDigits();
202 Int_t ReadSDigits();
203 Int_t ReadRecPoints();
204 Int_t ReadTracks();
205 Int_t ReadRecParticles();
206
88cb7938 207 Int_t fDebug ; // Debug level
8f9475fc 208
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
216
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
221
88cb7938 222
88cb7938 223 ClassDef(AliPHOSLoader,3) // Algorithm class that provides methods to retrieve objects from a list knowing the index
224
225};
226
227/******************************************************************************/
228/**************** I N L I N E S ****************************************/
229/******************************************************************************/
230
231inline TClonesArray* AliPHOSLoader::Hits()
232{
233 return (TClonesArray*)GetDetectorData(fgkHitsName);
234}
235/******************************************************************************/
236
237inline const AliPHOSHit* AliPHOSLoader::Hit(Int_t index)
238{
239 const TClonesArray* tcarr = Hits();
240 if (tcarr)
241 return (const AliPHOSHit*) tcarr->At(index);
242 return 0x0;
243}
244/******************************************************************************/
245
246inline TClonesArray* AliPHOSLoader::SDigits()
247{
248 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName));
249}
250/******************************************************************************/
251
252inline const AliPHOSDigit* AliPHOSLoader::SDigit(Int_t index)
253{
254 const TClonesArray* tcarr = SDigits();
255 if (tcarr)
256 return (const AliPHOSDigit*) tcarr->At(index);
257 return 0x0;
258}
259/******************************************************************************/
260
261inline TClonesArray* AliPHOSLoader::Digits()
262{
263 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName));
264}
265/******************************************************************************/
266
267inline const AliPHOSDigit* AliPHOSLoader::Digit(Int_t index)
268{
269 const TClonesArray* tcarr = Digits();
270 if (tcarr)
271 return (const AliPHOSDigit*) tcarr->At(index);
272 return 0x0;
273}
274/******************************************************************************/
275
276inline TObjArray * AliPHOSLoader::EmcRecPoints()
277{
278 return dynamic_cast<TObjArray*>(GetDetectorData(fgkEmcRecPointsName));
279}
280/******************************************************************************/
281
282inline const AliPHOSEmcRecPoint * AliPHOSLoader::EmcRecPoint(Int_t index)
283{
284 TObjArray* tcarr = EmcRecPoints();
285 if (tcarr)
286 return (const AliPHOSEmcRecPoint*) tcarr->At(index);
287 return 0x0;
288}
289/******************************************************************************/
290
291inline TObjArray * AliPHOSLoader::CpvRecPoints()
292{
293 return dynamic_cast<TObjArray*>(GetDetectorData(fgkCpvRecPointsName));
294}
295/******************************************************************************/
296
297inline const AliPHOSCpvRecPoint * AliPHOSLoader::CpvRecPoint(Int_t index)
298{
299 TObjArray* tcarr = CpvRecPoints();
300 if (tcarr)
301 return (const AliPHOSCpvRecPoint*) tcarr->At(index);
302 return 0x0;
303}
304/******************************************************************************/
305
306inline TClonesArray * AliPHOSLoader::TrackSegments()
307{
308 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName));
309}
310/******************************************************************************/
311
312inline const AliPHOSTrackSegment * AliPHOSLoader::TrackSegment(Int_t index)
313{
314 const TClonesArray* tcarr = TrackSegments();
315 if (tcarr)
316 return (const AliPHOSTrackSegment*) tcarr->At(index);
317 return 0x0;
318}
319/******************************************************************************/
320
321inline TClonesArray * AliPHOSLoader::RecParticles()
322{
323 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName));
324}
325/******************************************************************************/
326
327inline const AliPHOSRecParticle* AliPHOSLoader::RecParticle(Int_t index)
328{
329 TClonesArray* tcarr = RecParticles();
330 if (tcarr)
331 return (const AliPHOSRecParticle*) tcarr->At(index);
332 return 0x0;
333}
88cb7938 334
335#endif // AliPHOSLOADER_H