]>
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 ; | |
4ae78bb1 | 23 | |
24 | // --- Standard library --- | |
25 | ||
26 | // --- AliRoot header files --- | |
88cb7938 | 27 | #include "AliConfig.h" |
28 | ||
29 | // #include "AliRun.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 ; |
4ae78bb1 | 45 | |
46 | class AliPHOSGetter : public TObject { | |
47 | ||
88cb7938 | 48 | public: |
cb34a1fa | 49 | AliPHOSGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public |
f1611b7c | 50 | Fatal("ctor", "AliPHOSGetter is a singleton default ctor not callable") ; |
4ae78bb1 | 51 | } |
a8c47ab6 | 52 | AliPHOSGetter(const AliPHOSGetter & obj) : TObject(obj) { |
4ae78bb1 | 53 | // cpy ctor requested by Coding Convention |
f1611b7c | 54 | Fatal("cpy ctor", "not implemented") ; |
4ae78bb1 | 55 | } |
56 | ||
fbf811ec | 57 | AliPHOSGetter & operator = (const AliPHOSGetter & ) { |
58 | // assignement operator requested by coding convention, but not needed | |
f1611b7c | 59 | Fatal("operator =", "not implemented") ; |
fbf811ec | 60 | return *this ; |
61 | } | |
d071065d | 62 | virtual ~AliPHOSGetter() ; |
548f0134 | 63 | |
fbf811ec | 64 | //=========== Instantiators ================ |
88cb7938 | 65 | static AliPHOSGetter * Instance(const char* headerFile, |
66 | const char* version = AliConfig::fgkDefaultEventFolderName, | |
67 | Option_t * openingOption = "READ" ) ; | |
68 | static AliPHOSGetter * Instance() ; | |
69 | ||
70 | static void Print() ; | |
548f0134 | 71 | |
88cb7938 | 72 | // //=========== General information about run ============== |
73 | Bool_t IsLoaded(const TString tree) const { return fLoadingStatus.Contains(tree) ; } | |
74 | void SetLoaded(const TString tree) { fLoadingStatus += tree ; } | |
75 | ||
76 | Int_t MaxEvent() const ; | |
77 | Int_t EventNumber() const ; | |
78 | Bool_t VersionExists(TString & opt) const ; | |
79 | UShort_t EventPattern(void) const ; | |
80 | Float_t BeamEnergy(void) const ; | |
b0bba0af | 81 | |
88cb7938 | 82 | // //========== PHOSGeometry and PHOS ============= |
83 | AliPHOS * PHOS() const ; | |
84 | AliPHOSGeometry * PHOSGeometry() const ; | |
548f0134 | 85 | |
88cb7938 | 86 | // //========== Methods to read something from file ========== |
fbf811ec | 87 | void Event(const Int_t event, const char * opt = "HSDRP") ; |
88 | void Track(const Int_t itrack) ; | |
548f0134 | 89 | |
88cb7938 | 90 | // //-----------------now getter's data-------------------------------------- |
91 | // // AliPHOSCalibrationDB * CalibrationDB(){return fcdb; } | |
92 | // // void ReadCalibrationDB(const char * name, const char * filename) ; | |
7bb289a7 | 93 | |
fbf811ec | 94 | //=========== Primaries ============ |
88cb7938 | 95 | // TTree * TreeK(TString filename="") ; |
e957fea8 | 96 | TClonesArray * Primaries(void) ; |
88cb7938 | 97 | TParticle * Primary(Int_t index) const ; |
98 | Int_t NPrimaries()const { return fNPrimaries; } | |
99 | TParticle * Secondary(const TParticle * p, const Int_t index=1) const ; | |
100 | ||
101 | // //=========== Hits ================= | |
102 | // TTree * TreeH(TString filename="") ; | |
103 | TClonesArray * Hits(void) ; | |
104 | AliPHOSHit * Hit(const Int_t index) { return dynamic_cast<AliPHOSHit*>(Hits()->At(index) );} | |
105 | TTree * TreeH() const ; | |
cb34a1fa | 106 | |
fbf811ec | 107 | //=========== SDigits ============== |
88cb7938 | 108 | TClonesArray * SDigits() ; |
109 | AliPHOSDigit * SDigit(const Int_t index) { return static_cast<AliPHOSDigit *>(SDigits()->At(index)) ;} | |
110 | TTree * TreeS() const ; | |
111 | AliPHOSSDigitizer * SDigitizer() ; | |
112 | ||
e957fea8 | 113 | TString GetSDigitsFileName() const { return PhosLoader()->GetSDigitsFileName() ; } |
114 | Int_t LoadSDigits(Option_t* opt="") const { return PhosLoader()->LoadSDigits(opt) ; } | |
115 | Int_t LoadSDigitizer(Option_t* opt="") const { return PhosLoader()->LoadSDigitizer(opt) ; } | |
116 | Int_t WriteSDigits(Option_t* opt="") const { return PhosLoader()->WriteSDigits(opt) ; } | |
117 | Int_t WriteSDigitizer(Option_t* opt="") const { | |
88cb7938 | 118 | return PhosLoader()->WriteSDigitizer(opt) ; } |
548f0134 | 119 | |
fbf811ec | 120 | //========== Digits ================ |
88cb7938 | 121 | TClonesArray * Digits() ; |
122 | AliPHOSDigit * Digit(const Int_t index) { return static_cast<AliPHOSDigit *>(Digits()->At(index)) ;} | |
123 | TTree * TreeD() const ; | |
124 | AliPHOSDigitizer * Digitizer() ; | |
e957fea8 | 125 | TString GetDigitsFileName() const { return PhosLoader()->GetDigitsFileName() ; } |
126 | Int_t LoadDigits(Option_t* opt="") const { return PhosLoader()->LoadDigits(opt) ; } | |
127 | Int_t LoadDigitizer(Option_t* opt="") const { | |
88cb7938 | 128 | return PhosLoader()->LoadDigitizer(opt) ; } |
e957fea8 | 129 | Int_t WriteDigits(Option_t* opt="") const { return PhosLoader()->WriteDigits(opt) ; } |
130 | Int_t WriteDigitizer(Option_t* opt="") const { | |
88cb7938 | 131 | return PhosLoader()->WriteDigitizer(opt) ; } |
cb34a1fa | 132 | |
fbf811ec | 133 | //========== RecPoints ============= |
88cb7938 | 134 | TObjArray * EmcRecPoints() ; |
135 | AliPHOSEmcRecPoint * EmcRecPoint(const Int_t index) { return static_cast<AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ;} | |
136 | TObjArray * CpvRecPoints() ; | |
137 | AliPHOSCpvRecPoint * CpvRecPoint(const Int_t index) { return static_cast<AliPHOSCpvRecPoint *>(CpvRecPoints()->At(index)) ;} | |
138 | TTree * TreeR() const ; | |
e957fea8 | 139 | AliPHOSClusterizer * Clusterizer() ; |
140 | TString GetRecPointsFileName() const { return PhosLoader()->GetRecPointsFileName() ; } | |
141 | Int_t LoadRecPoints(Option_t* opt="") const { return PhosLoader()->LoadRecPoints(opt) ; } | |
142 | Int_t LoadClusterizer(Option_t* opt="") const { | |
88cb7938 | 143 | return PhosLoader()->LoadClusterizer(opt) ; } |
e957fea8 | 144 | Int_t WriteRecPoints(Option_t* opt="") const { return PhosLoader()->WriteRecPoints(opt) ; } |
145 | Int_t WriteClusterizer(Option_t* opt="") const { | |
88cb7938 | 146 | return PhosLoader()->WriteClusterizer(opt) ; } |
147 | ||
148 | //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) { | |
149 | TClonesArray * TrackSegments() ; | |
150 | AliPHOSTrackSegment * TrackSegments(const Int_t index) { return static_cast<AliPHOSTrackSegment *>(TrackSegments()->At(index)) ;} | |
151 | TTree * TreeT() const ; | |
152 | AliPHOSTrackSegmentMaker * TrackSegmentMaker() ; | |
e957fea8 | 153 | TString GetTracksFileName() const { return PhosLoader()->GetTracksFileName() ; } |
154 | Int_t LoadTracks(Option_t* opt="") const { return PhosLoader()->LoadTracks(opt) ; } | |
155 | Int_t LoadTrackSegementMaker(Option_t* opt="") const { | |
88cb7938 | 156 | return PhosLoader()->LoadTrackSegmentMaker(opt) ; } |
e957fea8 | 157 | Int_t WriteTracks(Option_t* opt="") const { return PhosLoader()->WriteTracks(opt) ; } |
158 | Int_t WriteTrackSegmentMaker(Option_t* opt="") const { | |
88cb7938 | 159 | return PhosLoader()->WriteTracker(opt) ; } |
fbf811ec | 160 | //========== RecParticles =========== |
fbf811ec | 161 | |
88cb7938 | 162 | TClonesArray * RecParticles() ; |
163 | AliPHOSRecParticle * RecPaticles(const Int_t index) { return static_cast<AliPHOSRecParticle *>(RecParticles()->At(index)) ;} | |
164 | TTree * TreeP() const ; | |
165 | AliPHOSPID * PID() ; | |
e957fea8 | 166 | TString GetRecParticlesFileName() const { return PhosLoader()->GetRecParticlesFileName() ; } |
167 | Int_t LoadRecParticles(Option_t* opt="") const { return PhosLoader()->LoadRecParticles(opt) ; } | |
168 | Int_t LoadPID(Option_t* opt="") const { | |
88cb7938 | 169 | return PhosLoader()->LoadPID(opt) ; } |
e957fea8 | 170 | Int_t WriteRecParticles(Option_t* opt="") const { return PhosLoader()->WriteRecParticles(opt) ; } |
171 | Int_t WritePID(Option_t* opt="") const { | |
88cb7938 | 172 | return PhosLoader()->WritePID(opt) ; } |
173 | ||
174 | ||
175 | void SetDebug(Int_t level) {fgDebug = level;} // Set debug level | |
176 | void PostClusterizer(AliPHOSClusterizer * clu) | |
177 | const{PhosLoader()->PostClusterizer(clu) ; } | |
178 | void PostPID(AliPHOSPID * pid) | |
179 | const{PhosLoader()->PostPID(pid) ; } | |
180 | void PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tr) | |
181 | const{PhosLoader()->PostTrackSegmentMaker(tr) ; } | |
182 | void PostSDigitizer (AliPHOSSDigitizer * sdigitizer) | |
183 | const {PhosLoader()->PostSDigitizer(sdigitizer);} | |
184 | void PostDigitizer (AliPHOSDigitizer * digitizer) | |
185 | const {PhosLoader()->PostDigitizer(dynamic_cast<AliDigitizer *>(digitizer));} | |
186 | ||
187 | TString Version() const { return PhosLoader()->GetTitle() ; } | |
188 | AliPHOSLoader * PhosLoader() const { return fgPhosLoader ; } | |
189 | ||
cb34a1fa | 190 | private: |
191 | ||
88cb7938 | 192 | AliPHOSGetter(const char* headerFile, |
193 | const char* version = AliConfig::fgkDefaultEventFolderName, | |
194 | Option_t * openingOption = "READ") ; | |
195 | ||
196 | Int_t ReadTreeD(void) ; | |
fbf811ec | 197 | Int_t ReadTreeH(void) ; |
88cb7938 | 198 | Int_t ReadTreeR(void) ; |
199 | Int_t ReadTreeT(void) ; | |
200 | Int_t ReadTreeS(void) ; | |
201 | Int_t ReadTreeP(void) ; | |
202 | ||
203 | ||
fbf811ec | 204 | void ReadPrimaries(void) ; |
88cb7938 | 205 | |
206 | private: | |
207 | ||
208 | // static TFile * fgFile; //! | |
209 | ||
7bb289a7 | 210 | AliPHOSBeamTestEvent * fBTE ; //! Header if BeamTest Event |
88cb7938 | 211 | |
212 | static Int_t fgDebug ; //! Debug level | |
213 | ||
214 | TString fLoadingStatus ; //! tells which trees are loaded | |
215 | Int_t fNPrimaries ; //! # of primaries | |
216 | TClonesArray * fPrimaries ; //! list of lists of primaries | |
c2cd5471 | 217 | |
7bb289a7 | 218 | // AliPHOSCalibrationDB * fcdb ; //! |
9bd3caba | 219 | |
e957fea8 | 220 | static AliPHOSLoader * fgPhosLoader ; // the loader for the NewIO |
b0bba0af | 221 | static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton |
88cb7938 | 222 | |
223 | enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes}; | |
224 | ||
4ae78bb1 | 225 | |
226 | ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index | |
227 | ||
228 | }; | |
229 | ||
230 | #endif // AliPHOSGETTER_H |