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