4ae78bb1 |
1 | #ifndef ALIPHOSGETTER_H |
2 | #define ALIPHOSGETTER_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 --- |
88cb7938 |
20 | #include "TObject.h" |
e957fea8 |
21 | class TParticle ; |
22 | class TTree ; |
45c1ce6f |
23 | class TGraph ; |
24 | class TF1 ; |
4ae78bb1 |
25 | |
26 | // --- Standard library --- |
27 | |
28 | // --- AliRoot header files --- |
88cb7938 |
29 | #include "AliConfig.h" |
e957fea8 |
30 | #include "AliPHOSLoader.h" |
31 | #include "AliPHOSHit.h" |
32 | #include "AliPHOSDigit.h" |
33 | #include "AliPHOSEmcRecPoint.h" |
34 | #include "AliPHOSCpvRecPoint.h" |
35 | #include "AliPHOSTrackSegment.h" |
36 | #include "AliPHOSRecParticle.h" |
88cb7938 |
37 | #include "AliPHOSDigitizer.h" |
e957fea8 |
38 | #include "AliPHOSSDigitizer.h" |
39 | class AliPHOS ; |
40 | class AliPHOSGeometry ; |
41 | class AliPHOSClusterizer ; |
42 | class AliPHOSTrackSegmentMaker ; |
43 | class AliPHOSPID ; |
7bb289a7 |
44 | class AliPHOSBeamTestEvent ; |
95635748 |
45 | class AliESD ; |
3cf4f75f |
46 | class AliRawReader ; |
4ae78bb1 |
47 | |
48 | class AliPHOSGetter : public TObject { |
49 | |
95635748 |
50 | public: |
cb34a1fa |
51 | AliPHOSGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public |
f1611b7c |
52 | Fatal("ctor", "AliPHOSGetter is a singleton default ctor not callable") ; |
4ae78bb1 |
53 | } |
66f895c8 |
54 | protected : |
55 | AliPHOSGetter(Int_t /*i*/){ // special constructor for onflight |
56 | |
57 | } |
58 | private: |
59 | AliPHOSGetter(const char* headerFile, |
60 | const char* version = AliConfig::GetDefaultEventFolderName(), |
61 | Option_t * openingOption = "READ") ; |
62 | |
63 | public: |
a8c47ab6 |
64 | AliPHOSGetter(const AliPHOSGetter & obj) : TObject(obj) { |
4ae78bb1 |
65 | // cpy ctor requested by Coding Convention |
f1611b7c |
66 | Fatal("cpy ctor", "not implemented") ; |
4ae78bb1 |
67 | } |
68 | |
fbf811ec |
69 | AliPHOSGetter & operator = (const AliPHOSGetter & ) { |
70 | // assignement operator requested by coding convention, but not needed |
f1611b7c |
71 | Fatal("operator =", "not implemented") ; |
fbf811ec |
72 | return *this ; |
73 | } |
d071065d |
74 | virtual ~AliPHOSGetter() ; |
548f0134 |
75 | |
fbf811ec |
76 | //=========== Instantiators ================ |
88cb7938 |
77 | static AliPHOSGetter * Instance(const char* headerFile, |
e191bb57 |
78 | const char* version = AliConfig::GetDefaultEventFolderName(), |
88cb7938 |
79 | Option_t * openingOption = "READ" ) ; |
80 | static AliPHOSGetter * Instance() ; |
95635748 |
81 | |
702ab87e |
82 | void Print(const Option_t *)const{} |
88cb7938 |
83 | static void Print() ; |
548f0134 |
84 | |
95635748 |
85 | //=========== General information about run ============== |
66f895c8 |
86 | virtual Bool_t IsLoaded(TString tree) const { return fLoadingStatus.Contains(tree) ; } |
87 | virtual void SetLoaded(TString tree) { fLoadingStatus += tree ; } |
95635748 |
88 | |
66f895c8 |
89 | virtual Int_t MaxEvent() const ; |
90 | virtual Int_t EventNumber() const ; |
91 | virtual Bool_t VersionExists(TString & opt) const ; |
92 | virtual UShort_t EventPattern(void) const ; |
93 | virtual Float_t BeamEnergy(void) const ; |
b0bba0af |
94 | |
95635748 |
95 | //========== PHOSGeometry and PHOS ============= |
66f895c8 |
96 | virtual AliPHOS * PHOS() const ; |
97 | virtual AliPHOSGeometry * PHOSGeometry() const ; |
548f0134 |
98 | |
95635748 |
99 | //========== Methods to read something from file ========== |
66f895c8 |
100 | virtual void Event(Int_t event, const char * opt = "HSDRTP") ; |
3cf4f75f |
101 | void Event(AliRawReader *rawReader, const char * opt = "W") ; |
66f895c8 |
102 | virtual void Track(Int_t itrack) ; |
103 | |
548f0134 |
104 | |
95635748 |
105 | //-----------------now getter's data-------------------------------------- |
3b844b86 |
106 | AliPHOSCalibrationDB * CalibrationDB(){return fcdb; } |
107 | void ReadCalibrationDB(const char * /*name*/, const char * /*filename*/){ ;} |
108 | void SetCalibrationDB(AliPHOSCalibrationDB * cdb) {fcdb = cdb ;} |
95635748 |
109 | |
fbf811ec |
110 | //=========== Primaries ============ |
66f895c8 |
111 | virtual TClonesArray * Primaries(void) ; |
112 | virtual TParticle * Primary(Int_t index) const ; |
113 | virtual Int_t NPrimaries()const { return fNPrimaries; } |
114 | virtual TParticle * Secondary(const TParticle * p, Int_t index=1) const ; |
88cb7938 |
115 | |
95635748 |
116 | //=========== Hits ================= |
66f895c8 |
117 | virtual TClonesArray * Hits(void) ; |
118 | virtual AliPHOSHit * Hit(Int_t index) { return dynamic_cast<AliPHOSHit*>(Hits()->At(index) );} |
119 | virtual TTree * TreeH() const ; |
cb34a1fa |
120 | |
fbf811ec |
121 | //=========== SDigits ============== |
66f895c8 |
122 | virtual TClonesArray * SDigits() ; |
123 | virtual AliPHOSDigit * SDigit(Int_t index) { return static_cast<AliPHOSDigit *>(SDigits()->At(index)) ;} |
124 | virtual TTree * TreeS() const ; |
125 | virtual AliPHOSSDigitizer * SDigitizer() ; |
126 | |
127 | virtual TString GetSDigitsFileName() const { return PhosLoader()->GetSDigitsFileName() ; } |
128 | virtual Int_t LoadSDigits(Option_t* opt="") const { return PhosLoader()->LoadSDigits(opt) ; } |
129 | virtual Int_t LoadSDigitizer(Option_t* opt="") const { return PhosLoader()->LoadSDigitizer(opt) ; } |
130 | virtual Int_t WriteSDigits(Option_t* opt="") const { return PhosLoader()->WriteSDigits(opt) ; } |
131 | virtual Int_t WriteSDigitizer(Option_t* opt="") const { |
88cb7938 |
132 | return PhosLoader()->WriteSDigitizer(opt) ; } |
548f0134 |
133 | |
fbf811ec |
134 | //========== Digits ================ |
66f895c8 |
135 | virtual TClonesArray * Digits() ; |
136 | virtual AliPHOSDigit * Digit(Int_t index) { return static_cast<AliPHOSDigit *>(Digits()->At(index)) ;} |
137 | virtual TTree * TreeD() const ; |
138 | virtual AliPHOSDigitizer * Digitizer() ; |
139 | virtual TString GetDigitsFileName() const { return PhosLoader()->GetDigitsFileName() ; } |
140 | virtual Int_t LoadDigits(Option_t* opt="") const { return PhosLoader()->LoadDigits(opt) ; } |
141 | virtual Int_t LoadDigitizer(Option_t* opt="") const { |
88cb7938 |
142 | return PhosLoader()->LoadDigitizer(opt) ; } |
66f895c8 |
143 | virtual Int_t WriteDigits(Option_t* opt="") const { return PhosLoader()->WriteDigits(opt) ; } |
144 | virtual Int_t WriteDigitizer(Option_t* opt="") const { |
88cb7938 |
145 | return PhosLoader()->WriteDigitizer(opt) ; } |
66f895c8 |
146 | |
147 | //Methods to distinguish raw and simulated digits |
148 | virtual Bool_t IsRawDigits(void) const {return fRawDigits;} |
149 | virtual void SetRawDigits(Bool_t isRaw = kTRUE){fRawDigits = isRaw;} |
cb34a1fa |
150 | |
fbf811ec |
151 | //========== RecPoints ============= |
66f895c8 |
152 | virtual TObjArray * EmcRecPoints() ; |
153 | virtual AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) { return static_cast<AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ;} |
154 | virtual TObjArray * CpvRecPoints() ; |
155 | virtual AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) { return static_cast<AliPHOSCpvRecPoint *>(CpvRecPoints()->At(index)) ;} |
156 | virtual TTree * TreeR() const ; |
157 | virtual AliPHOSClusterizer * Clusterizer() ; |
158 | virtual TString GetRecPointsFileName() const { return PhosLoader()->GetRecPointsFileName() ; } |
159 | virtual Int_t LoadRecPoints(Option_t* opt="") const { return PhosLoader()->LoadRecPoints(opt) ; } |
160 | virtual Int_t LoadClusterizer(Option_t* opt="") const { |
88cb7938 |
161 | return PhosLoader()->LoadClusterizer(opt) ; } |
66f895c8 |
162 | virtual Int_t WriteRecPoints(Option_t* opt="") const { return PhosLoader()->WriteRecPoints(opt) ; } |
163 | virtual Int_t WriteClusterizer(Option_t* opt="") const { |
88cb7938 |
164 | return PhosLoader()->WriteClusterizer(opt) ; } |
95635748 |
165 | |
88cb7938 |
166 | //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) { |
66f895c8 |
167 | virtual TClonesArray * TrackSegments() ; |
168 | virtual AliPHOSTrackSegment * TrackSegment(Int_t index) { return static_cast<AliPHOSTrackSegment *>(TrackSegments()->At(index)) ;} |
169 | virtual TTree * TreeT() const ; |
170 | virtual AliPHOSTrackSegmentMaker * TrackSegmentMaker() ; |
171 | virtual TString GetTracksFileName() const { return PhosLoader()->GetTracksFileName() ; } |
172 | virtual Int_t LoadTracks(Option_t* opt="") const { return PhosLoader()->LoadTracks(opt) ; } |
173 | virtual Int_t LoadTrackSegementMaker(Option_t* opt="") const { |
88cb7938 |
174 | return PhosLoader()->LoadTrackSegmentMaker(opt) ; } |
66f895c8 |
175 | virtual Int_t WriteTracks(Option_t* opt="") const { return PhosLoader()->WriteTracks(opt) ; } |
176 | virtual Int_t WriteTrackSegmentMaker(Option_t* opt="") const { |
88cb7938 |
177 | return PhosLoader()->WriteTracker(opt) ; } |
95635748 |
178 | |
fbf811ec |
179 | //========== RecParticles =========== |
66f895c8 |
180 | virtual TClonesArray * RecParticles() ; |
181 | virtual AliPHOSRecParticle * RecParticle(Int_t index) { return static_cast<AliPHOSRecParticle *>(RecParticles()->At(index)) ;} |
182 | virtual TTree * TreeP() const ; |
183 | virtual AliPHOSPID * PID() ; |
184 | virtual TString GetRecParticlesFileName() const { return PhosLoader()->GetRecParticlesFileName() ; } |
185 | virtual Int_t LoadRecParticles(Option_t* opt="") const { return PhosLoader()->LoadRecParticles(opt) ; } |
186 | virtual Int_t LoadPID(Option_t* opt="") const { |
88cb7938 |
187 | return PhosLoader()->LoadPID(opt) ; } |
66f895c8 |
188 | virtual Int_t WriteRecParticles(Option_t* opt="") const { return PhosLoader()->WriteRecParticles(opt) ; } |
189 | virtual Int_t WritePID(Option_t* opt="") const { |
88cb7938 |
190 | return PhosLoader()->WritePID(opt) ; } |
a43c51c3 |
191 | |
192 | //========== Raw =========== |
3cf4f75f |
193 | virtual Int_t ReadRaw(AliRawReader *rawReader) ; |
a43c51c3 |
194 | |
3b844b86 |
195 | void SetDebug(Int_t level) {fgDebug = level;} // Set debug level |
66f895c8 |
196 | virtual void PostClusterizer(AliPHOSClusterizer * clu) |
88cb7938 |
197 | const{PhosLoader()->PostClusterizer(clu) ; } |
66f895c8 |
198 | virtual void PostPID(AliPHOSPID * pid) |
88cb7938 |
199 | const{PhosLoader()->PostPID(pid) ; } |
66f895c8 |
200 | virtual void PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tr) |
88cb7938 |
201 | const{PhosLoader()->PostTrackSegmentMaker(tr) ; } |
66f895c8 |
202 | virtual void PostSDigitizer (AliPHOSSDigitizer * sdigitizer) |
88cb7938 |
203 | const {PhosLoader()->PostSDigitizer(sdigitizer);} |
66f895c8 |
204 | virtual void PostDigitizer (AliPHOSDigitizer * digitizer) |
bf6adc12 |
205 | const {PhosLoader()->PostDigitizer(digitizer);} |
95635748 |
206 | |
66f895c8 |
207 | virtual TString Version() const { return PhosLoader()->GetTitle() ; } |
208 | virtual AliPHOSLoader * PhosLoader() const { return fgPhosLoader ; } |
209 | virtual void Reset() ; |
88cb7938 |
210 | |
66f895c8 |
211 | virtual AliESD * ESD() const { return fESD ; } |
95635748 |
212 | |
cb34a1fa |
213 | private: |
214 | |
88cb7938 |
215 | Int_t ReadTreeD(void) ; |
fbf811ec |
216 | Int_t ReadTreeH(void) ; |
88cb7938 |
217 | Int_t ReadTreeR(void) ; |
218 | Int_t ReadTreeT(void) ; |
219 | Int_t ReadTreeS(void) ; |
220 | Int_t ReadTreeP(void) ; |
677c8a30 |
221 | |
222 | Int_t ReadTreeE(Int_t event) ; |
223 | Bool_t OpenESDFile() ; |
fbf811ec |
224 | void ReadPrimaries(void) ; |
e4d04cf1 |
225 | |
45c1ce6f |
226 | void FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Int_t & amp, Double_t & time) ; |
e4d04cf1 |
227 | |
88cb7938 |
228 | private: |
95635748 |
229 | |
7bb289a7 |
230 | AliPHOSBeamTestEvent * fBTE ; //! Header if BeamTest Event |
88cb7938 |
231 | static Int_t fgDebug ; //! Debug level |
95635748 |
232 | |
88cb7938 |
233 | TString fLoadingStatus ; //! tells which trees are loaded |
234 | Int_t fNPrimaries ; //! # of primaries |
235 | TClonesArray * fPrimaries ; //! list of lists of primaries |
95635748 |
236 | TFile * fESDFile ; //! ESD file |
237 | TString fESDFileName ; //! ESD File Name |
677c8a30 |
238 | AliESD * fESD ; //! ESD object |
239 | TTree * fESDTree ; //! ESD Tree |
66f895c8 |
240 | |
241 | Bool_t fRawDigits ; //! |
677c8a30 |
242 | |
66f895c8 |
243 | AliPHOSCalibrationDB * fcdb ; //! |
95635748 |
244 | |
e957fea8 |
245 | static AliPHOSLoader * fgPhosLoader ; // the loader for the NewIO |
88cb7938 |
246 | |
247 | enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes}; |
66f895c8 |
248 | |
249 | protected: |
250 | static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton |
95635748 |
251 | |
252 | |
4ae78bb1 |
253 | ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index |
95635748 |
254 | |
255 | }; |
4ae78bb1 |
256 | |
257 | #endif // AliPHOSGETTER_H |