Removing useless flag.
[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 ;
c93255fe 36#include <TClonesArray.h>
37#include <TTree.h>
88cb7938 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
88cb7938 95
96/*******************************************************************/
97/*******************************************************************/
98/*******************************************************************/
99
100 TObject** HitsRef(){return GetDetectorDataRef(Hits());}
101 TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());}
102 TObject** DigitsRef(){return GetDetectorDataRef(Digits());}
103 TObject** EmcRecPointsRef(){return GetDetectorDataRef(EmcRecPoints());}
104 TObject** CpvRecPointsRef(){return GetDetectorDataRef(CpvRecPoints());}
105 TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());}
106 TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());}
107 TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());}
108 void Track(Int_t itrack) ;
109
88cb7938 110 static AliPHOSLoader* GetPHOSLoader(const char* eventfoldername);
111
f21fc003 112 //Method to be used when digitizing under AliDigitizationInput, who opens all files etc.
88cb7938 113 Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();}
114 Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();}
115
ba999b0a 116/* const AliPHOS * PHOS(); */
88cb7938 117 // Alarms
118 // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); }
b6b12ef4 119 TObjArray * Alarms() {return 0x0;}
88cb7938 120
121 /*********************************************/
122 /************ TClonesArrays ***********/
123 /*********************************************/
124 /**** H i t s ****/
125 TClonesArray* Hits(void);
126 const AliPHOSHit* Hit(Int_t index);
127 void MakeHitsArray();
128 /**** S D i g i t s ****/
129 TClonesArray* SDigits();
130 const AliPHOSDigit* SDigit(Int_t index);
131 void MakeSDigitsArray();
132 /**** D i g i t s ****/
133 TClonesArray* Digits();
134 const AliPHOSDigit * Digit(Int_t index);
135 void MakeDigitsArray();
136 /**** R e c P o i n t s ****/
137 TObjArray * EmcRecPoints();
138 TObjArray * CpvRecPoints();
139 const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) ;
140 const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) ;
141 void MakeRecPointsArray();
142 /**** T r a c k S e g m e n t s ****/
143 TClonesArray * TrackSegments();
144 const AliPHOSTrackSegment * TrackSegment(Int_t index);
145 void MakeTrackSegmentsArray();
146 /**** R e c P a r t ic l e s ****/
147 TClonesArray * RecParticles() ;
148 const AliPHOSRecParticle * RecParticle(Int_t index);
149 void MakeRecParticlesArray();
88cb7938 150
151 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
152 void SetBranchTitle(const TString& btitle);
e2429969 153
154 Int_t GetDebug() const {return fDebug; }
155 TString GetBranchTitle() const {return fBranchTitle;}
88cb7938 156
157protected:
158 TString fBranchTitle; //Title of the branch
88cb7938 159
160private:
161
dc86eb51 162 // assignement operator requested by coding convention, but not needed
163 AliPHOSLoader(const AliPHOSLoader &); //Not implemented
164 AliPHOSLoader & operator = (const AliPHOSLoader & ); //Not implemented
165
88cb7938 166 Int_t ReadHits();
167 Int_t ReadDigits();
168 Int_t ReadSDigits();
169 Int_t ReadRecPoints();
170 Int_t ReadTracks();
171 Int_t ReadRecParticles();
172
88cb7938 173 Int_t fDebug ; // Debug level
8d8258f6 174 TClonesArray *fTmpHits; //! Temporary array of hits per track
8f9475fc 175
176 static const TString fgkHitsName;//Name for TClonesArray with hits from one event
177 static const TString fgkSDigitsName;//Name for TClonesArray
178 static const TString fgkDigitsName;//Name for TClonesArray
179 static const TString fgkEmcRecPointsName;//Name for TClonesArray
180 static const TString fgkCpvRecPointsName;//Name for TClonesArray
181 static const TString fgkTracksName;//Name for TClonesArray
182 static const TString fgkRecParticlesName;//Name for TClonesArray
183
184 static const TString fgkEmcRecPointsBranchName;//Name for branch
185 static const TString fgkCpvRecPointsBranchName;//Name for branch
186 static const TString fgkTrackSegmentsBranchName;//Name for branch
187 static const TString fgkRecParticlesBranchName;//Name for branch
188
88cb7938 189
8d8258f6 190 ClassDef(AliPHOSLoader,4) // Algorithm class that provides methods to retrieve objects from a list knowing the index
88cb7938 191
192};
193
194/******************************************************************************/
195/**************** I N L I N E S ****************************************/
196/******************************************************************************/
197
198inline TClonesArray* AliPHOSLoader::Hits()
199{
200 return (TClonesArray*)GetDetectorData(fgkHitsName);
201}
202/******************************************************************************/
203
204inline const AliPHOSHit* AliPHOSLoader::Hit(Int_t index)
205{
206 const TClonesArray* tcarr = Hits();
207 if (tcarr)
208 return (const AliPHOSHit*) tcarr->At(index);
209 return 0x0;
210}
211/******************************************************************************/
212
213inline TClonesArray* AliPHOSLoader::SDigits()
214{
215 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName));
216}
217/******************************************************************************/
218
219inline const AliPHOSDigit* AliPHOSLoader::SDigit(Int_t index)
220{
221 const TClonesArray* tcarr = SDigits();
222 if (tcarr)
223 return (const AliPHOSDigit*) tcarr->At(index);
224 return 0x0;
225}
226/******************************************************************************/
227
228inline TClonesArray* AliPHOSLoader::Digits()
229{
230 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName));
231}
232/******************************************************************************/
233
234inline const AliPHOSDigit* AliPHOSLoader::Digit(Int_t index)
235{
236 const TClonesArray* tcarr = Digits();
237 if (tcarr)
238 return (const AliPHOSDigit*) tcarr->At(index);
239 return 0x0;
240}
241/******************************************************************************/
242
243inline TObjArray * AliPHOSLoader::EmcRecPoints()
244{
245 return dynamic_cast<TObjArray*>(GetDetectorData(fgkEmcRecPointsName));
246}
247/******************************************************************************/
248
249inline const AliPHOSEmcRecPoint * AliPHOSLoader::EmcRecPoint(Int_t index)
250{
251 TObjArray* tcarr = EmcRecPoints();
252 if (tcarr)
253 return (const AliPHOSEmcRecPoint*) tcarr->At(index);
254 return 0x0;
255}
256/******************************************************************************/
257
258inline TObjArray * AliPHOSLoader::CpvRecPoints()
259{
260 return dynamic_cast<TObjArray*>(GetDetectorData(fgkCpvRecPointsName));
261}
262/******************************************************************************/
263
264inline const AliPHOSCpvRecPoint * AliPHOSLoader::CpvRecPoint(Int_t index)
265{
266 TObjArray* tcarr = CpvRecPoints();
267 if (tcarr)
268 return (const AliPHOSCpvRecPoint*) tcarr->At(index);
269 return 0x0;
270}
271/******************************************************************************/
272
273inline TClonesArray * AliPHOSLoader::TrackSegments()
274{
275 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName));
276}
277/******************************************************************************/
278
279inline const AliPHOSTrackSegment * AliPHOSLoader::TrackSegment(Int_t index)
280{
281 const TClonesArray* tcarr = TrackSegments();
282 if (tcarr)
283 return (const AliPHOSTrackSegment*) tcarr->At(index);
284 return 0x0;
285}
286/******************************************************************************/
287
288inline TClonesArray * AliPHOSLoader::RecParticles()
289{
290 return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName));
291}
292/******************************************************************************/
293
294inline const AliPHOSRecParticle* AliPHOSLoader::RecParticle(Int_t index)
295{
296 TClonesArray* tcarr = RecParticles();
297 if (tcarr)
298 return (const AliPHOSRecParticle*) tcarr->At(index);
299 return 0x0;
300}
88cb7938 301
302#endif // AliPHOSLOADER_H