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 */
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.
14 // The objects are retrived from folders.
15 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
19 // --- ROOT system ---
26 // --- Standard library ---
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"
40 class AliPHOSGeometry ;
41 class AliPHOSClusterizer ;
42 class AliPHOSTrackSegmentMaker ;
44 class AliPHOSBeamTestEvent ;
47 class AliPHOSGetter : public TObject {
50 AliPHOSGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public
51 Fatal("ctor", "AliPHOSGetter is a singleton default ctor not callable") ;
53 AliPHOSGetter(const AliPHOSGetter & obj) : TObject(obj) {
54 // cpy ctor requested by Coding Convention
55 Fatal("cpy ctor", "not implemented") ;
58 AliPHOSGetter & operator = (const AliPHOSGetter & ) {
59 // assignement operator requested by coding convention, but not needed
60 Fatal("operator =", "not implemented") ;
63 virtual ~AliPHOSGetter() ;
65 //=========== Instantiators ================
66 static AliPHOSGetter * Instance(const char* headerFile,
67 const char* version = AliConfig::GetDefaultEventFolderName(),
68 Option_t * openingOption = "READ" ) ;
69 static AliPHOSGetter * Instance() ;
73 //=========== General information about run ==============
74 Bool_t IsLoaded(TString tree) const { return fLoadingStatus.Contains(tree) ; }
75 void SetLoaded(TString tree) { fLoadingStatus += tree ; }
77 Int_t MaxEvent() const ;
78 Int_t EventNumber() const ;
79 Bool_t VersionExists(TString & opt) const ;
80 UShort_t EventPattern(void) const ;
81 Float_t BeamEnergy(void) const ;
83 //========== PHOSGeometry and PHOS =============
84 AliPHOS * PHOS() const ;
85 AliPHOSGeometry * PHOSGeometry() const ;
87 //========== Methods to read something from file ==========
88 void Event(Int_t event, const char * opt = "HSDRTP") ;
89 void Track(Int_t itrack) ;
91 //-----------------now getter's data--------------------------------------
92 // AliPHOSCalibrationDB * CalibrationDB(){return fcdb; }
93 // void ReadCalibrationDB(const char * name, const char * filename) ;
95 //=========== Primaries ============
96 TClonesArray * Primaries(void) ;
97 TParticle * Primary(Int_t index) const ;
98 Int_t NPrimaries()const { return fNPrimaries; }
99 TParticle * Secondary(const TParticle * p, Int_t index=1) const ;
101 //=========== Hits =================
102 TClonesArray * Hits(void) ;
103 AliPHOSHit * Hit(Int_t index) { return dynamic_cast<AliPHOSHit*>(Hits()->At(index) );}
104 TTree * TreeH() const ;
106 //=========== SDigits ==============
107 TClonesArray * SDigits() ;
108 AliPHOSDigit * SDigit(Int_t index) { return static_cast<AliPHOSDigit *>(SDigits()->At(index)) ;}
109 TTree * TreeS() const ;
110 AliPHOSSDigitizer * SDigitizer() ;
112 TString GetSDigitsFileName() const { return PhosLoader()->GetSDigitsFileName() ; }
113 Int_t LoadSDigits(Option_t* opt="") const { return PhosLoader()->LoadSDigits(opt) ; }
114 Int_t LoadSDigitizer(Option_t* opt="") const { return PhosLoader()->LoadSDigitizer(opt) ; }
115 Int_t WriteSDigits(Option_t* opt="") const { return PhosLoader()->WriteSDigits(opt) ; }
116 Int_t WriteSDigitizer(Option_t* opt="") const {
117 return PhosLoader()->WriteSDigitizer(opt) ; }
119 //========== Digits ================
120 TClonesArray * Digits() ;
121 AliPHOSDigit * Digit(Int_t index) { return static_cast<AliPHOSDigit *>(Digits()->At(index)) ;}
122 TTree * TreeD() const ;
123 AliPHOSDigitizer * Digitizer() ;
124 TString GetDigitsFileName() const { return PhosLoader()->GetDigitsFileName() ; }
125 Int_t LoadDigits(Option_t* opt="") const { return PhosLoader()->LoadDigits(opt) ; }
126 Int_t LoadDigitizer(Option_t* opt="") const {
127 return PhosLoader()->LoadDigitizer(opt) ; }
128 Int_t WriteDigits(Option_t* opt="") const { return PhosLoader()->WriteDigits(opt) ; }
129 Int_t WriteDigitizer(Option_t* opt="") const {
130 return PhosLoader()->WriteDigitizer(opt) ; }
132 //========== RecPoints =============
133 TObjArray * EmcRecPoints() ;
134 AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) { return static_cast<AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ;}
135 TObjArray * CpvRecPoints() ;
136 AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) { return static_cast<AliPHOSCpvRecPoint *>(CpvRecPoints()->At(index)) ;}
137 TTree * TreeR() const ;
138 AliPHOSClusterizer * Clusterizer() ;
139 TString GetRecPointsFileName() const { return PhosLoader()->GetRecPointsFileName() ; }
140 Int_t LoadRecPoints(Option_t* opt="") const { return PhosLoader()->LoadRecPoints(opt) ; }
141 Int_t LoadClusterizer(Option_t* opt="") const {
142 return PhosLoader()->LoadClusterizer(opt) ; }
143 Int_t WriteRecPoints(Option_t* opt="") const { return PhosLoader()->WriteRecPoints(opt) ; }
144 Int_t WriteClusterizer(Option_t* opt="") const {
145 return PhosLoader()->WriteClusterizer(opt) ; }
147 //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) {
148 TClonesArray * TrackSegments() ;
149 AliPHOSTrackSegment * TrackSegment(Int_t index) { return static_cast<AliPHOSTrackSegment *>(TrackSegments()->At(index)) ;}
150 TTree * TreeT() const ;
151 AliPHOSTrackSegmentMaker * TrackSegmentMaker() ;
152 TString GetTracksFileName() const { return PhosLoader()->GetTracksFileName() ; }
153 Int_t LoadTracks(Option_t* opt="") const { return PhosLoader()->LoadTracks(opt) ; }
154 Int_t LoadTrackSegementMaker(Option_t* opt="") const {
155 return PhosLoader()->LoadTrackSegmentMaker(opt) ; }
156 Int_t WriteTracks(Option_t* opt="") const { return PhosLoader()->WriteTracks(opt) ; }
157 Int_t WriteTrackSegmentMaker(Option_t* opt="") const {
158 return PhosLoader()->WriteTracker(opt) ; }
160 //========== RecParticles ===========
161 TClonesArray * RecParticles() ;
162 AliPHOSRecParticle * RecParticle(Int_t index) { return static_cast<AliPHOSRecParticle *>(RecParticles()->At(index)) ;}
163 TTree * TreeP() const ;
165 TString GetRecParticlesFileName() const { return PhosLoader()->GetRecParticlesFileName() ; }
166 Int_t LoadRecParticles(Option_t* opt="") const { return PhosLoader()->LoadRecParticles(opt) ; }
167 Int_t LoadPID(Option_t* opt="") const {
168 return PhosLoader()->LoadPID(opt) ; }
169 Int_t WriteRecParticles(Option_t* opt="") const { return PhosLoader()->WriteRecParticles(opt) ; }
170 Int_t WritePID(Option_t* opt="") const {
171 return PhosLoader()->WritePID(opt) ; }
173 //========== Raw ===========
174 Int_t ReadRaw(Int_t event) ;
176 void SetDebug(Int_t level) {fgDebug = level;} // Set debug level
177 void PostClusterizer(AliPHOSClusterizer * clu)
178 const{PhosLoader()->PostClusterizer(clu) ; }
179 void PostPID(AliPHOSPID * pid)
180 const{PhosLoader()->PostPID(pid) ; }
181 void PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tr)
182 const{PhosLoader()->PostTrackSegmentMaker(tr) ; }
183 void PostSDigitizer (AliPHOSSDigitizer * sdigitizer)
184 const {PhosLoader()->PostSDigitizer(sdigitizer);}
185 void PostDigitizer (AliPHOSDigitizer * digitizer)
186 const {PhosLoader()->PostDigitizer(dynamic_cast<AliDigitizer *>(digitizer));}
188 TString Version() const { return PhosLoader()->GetTitle() ; }
189 AliPHOSLoader * PhosLoader() const { return fgPhosLoader ; }
192 AliESD * ESD() const { return fESD ; }
196 AliPHOSGetter(const char* headerFile,
197 const char* version = AliConfig::GetDefaultEventFolderName(),
198 Option_t * openingOption = "READ") ;
200 Int_t ReadTreeD(void) ;
201 Int_t ReadTreeH(void) ;
202 Int_t ReadTreeR(void) ;
203 Int_t ReadTreeT(void) ;
204 Int_t ReadTreeS(void) ;
205 Int_t ReadTreeP(void) ;
207 Int_t ReadTreeE(Int_t event) ;
208 Bool_t OpenESDFile() ;
209 void ReadPrimaries(void) ;
211 void FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Int_t & amp, Double_t & time) ;
215 AliPHOSBeamTestEvent * fBTE ; //! Header if BeamTest Event
216 static Int_t fgDebug ; //! Debug level
218 TString fLoadingStatus ; //! tells which trees are loaded
219 Int_t fNPrimaries ; //! # of primaries
220 TClonesArray * fPrimaries ; //! list of lists of primaries
221 TFile * fESDFile ; //! ESD file
222 TString fESDFileName ; //! ESD File Name
223 AliESD * fESD ; //! ESD object
224 TTree * fESDTree ; //! ESD Tree
226 // AliPHOSCalibrationDB * fcdb ; //!
228 static AliPHOSLoader * fgPhosLoader ; // the loader for the NewIO
229 static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton
231 enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes};
234 ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
238 #endif // AliPHOSGETTER_H