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