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