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