1 #ifndef ALIEMCALGETTER_H
2 #define ALIEMCALGETTER_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 ---
21 #include "TClonesArray.h"
27 // --- Standard library ---
29 // --- AliRoot header files ---
30 #include "AliConfig.h"
32 // #include "AliRun.h"
33 #include "AliEMCALHit.h"
34 #include "AliEMCALRecParticle.h"
35 #include "AliEMCALDigitizer.h"
36 #include "AliEMCALSDigitizer.h"
37 #include "AliEMCALLoader.h"
39 class AliEMCALGeometry ;
40 class AliEMCALClusterizer ;
41 class AliEMCALRecPoint ;
42 class AliEMCALTrackSegmentMaker ;
43 class AliEMCALTrackSegment ;
45 class AliEMCALBeamTestEvent ;
48 class AliEMCALGetter : public TObject {
52 // ctor: this is a singleton, the ctor should never be called but cint needs it as public
53 Fatal("ctor", "AliEMCALGetter is a singleton default ctor not callable") ;
55 AliEMCALGetter(const AliEMCALGetter & obj):TObject(obj) {
56 // cpy ctor requested by Coding Convention
57 Fatal("cpy ctor", "not implemented") ;
60 AliEMCALGetter & operator = (const AliEMCALGetter & ) {
61 // assignement operator requested by coding convention, but not needed
62 Fatal("operator =", "not implemented") ;
65 virtual ~AliEMCALGetter() ;
67 //=========== Instantiators ================
68 static AliEMCALGetter * Instance(const char* headerFile,
69 const char* version = AliConfig::GetDefaultEventFolderName(),
70 Option_t * openingOption = "READ" ) ;
71 static AliEMCALGetter * Instance() ;
75 // //=========== General information about run ==============
76 Bool_t IsLoaded(TString tree) const { return fLoadingStatus.Contains(tree) ; }
77 void SetLoaded(TString tree) { fLoadingStatus += tree ; }
79 Int_t MaxEvent() const ;
80 Int_t EventNumber() const ;
81 Bool_t VersionExists(TString & opt) const ;
82 UShort_t EventPattern(void) const ;
83 Float_t BeamEnergy(void) const ;
85 // //========== EMCALGeometry and EMCAL =============
86 AliEMCAL * EMCAL() const ;
87 AliEMCALGeometry * EMCALGeometry() const ;
89 // //========== Methods to read something from file ==========
90 void Event(Int_t event, const char * opt = "HSDRP") ;
91 void Track(Int_t itrack) ;
93 // //-----------------now getter's data--------------------------------------
94 // // AliEMCALCalibrationDB * CalibrationDB(){return fcdb; }
95 // // void ReadCalibrationDB(const char * name, const char * filename) ;
97 //=========== Primaries ============
98 // TTree * TreeK(TString filename="") ;
99 TParticle * Primary(Int_t index) const ;
100 Int_t NPrimaries() const;
101 TParticle * Secondary(const TParticle * p, Int_t index=1) const ;
103 // //=========== Hits =================
104 // TTree * TreeH(TString filename="") ;
105 TClonesArray * Hits(void) const ;
106 AliEMCALHit * Hit(Int_t index) const { return dynamic_cast<AliEMCALHit*>(Hits()->At(index) );}
107 TTree * TreeH() const ;
109 //=========== SDigits ==============
110 TClonesArray * SDigits() const ;
111 AliEMCALDigit * SDigit(Int_t index) const { return static_cast<AliEMCALDigit *>(SDigits()->At(index)) ;}
112 TTree * TreeS() const ;
113 AliEMCALSDigitizer * SDigitizer() ;
115 TString GetSDigitsFileName() const { return EmcalLoader()->GetSDigitsFileName() ; }
116 Int_t LoadSDigits(Option_t* opt="") const { return EmcalLoader()->LoadSDigits(opt) ; }
117 Int_t LoadSDigitizer(Option_t* opt="") const { return EmcalLoader()->LoadSDigitizer(opt) ; }
118 Int_t WriteSDigits(Option_t* opt="") const { return EmcalLoader()->WriteSDigits(opt) ; }
119 Int_t WriteSDigitizer(Option_t* opt="") const {
120 return EmcalLoader()->WriteSDigitizer(opt) ; }
122 //========== Digits ================
123 TClonesArray * Digits() const ;
124 AliEMCALDigit * Digit(Int_t index) const { return static_cast<AliEMCALDigit *>(Digits()->At(index)) ;}
125 TTree * TreeD() const ;
126 AliEMCALDigitizer * Digitizer() ;
127 TString GetDigitsFileName() const { return EmcalLoader()->GetDigitsFileName() ; }
128 Int_t LoadDigits(Option_t* opt="") const { return EmcalLoader()->LoadDigits(opt) ; }
129 Int_t LoadDigitizer(Option_t* opt="") const {
130 return EmcalLoader()->LoadDigitizer(opt) ; }
131 Int_t WriteDigits(Option_t* opt="") const { return EmcalLoader()->WriteDigits(opt) ; }
132 Int_t WriteDigitizer(Option_t* opt="") const {
133 return EmcalLoader()->WriteDigitizer(opt) ; }
135 //========== RecPoints =============
136 TObjArray * ECARecPoints() const;
137 AliEMCALRecPoint * ECARecPoint(Int_t index) const{ return static_cast<AliEMCALRecPoint *>(ECARecPoints()->At(index)) ;}
138 TTree * TreeR() const ;
139 AliEMCALClusterizer * Clusterizer() ;
140 TString GetRecPointsFileName() const { return EmcalLoader()->GetRecPointsFileName() ; }
141 Int_t LoadRecPoints(Option_t* opt="") const { return EmcalLoader()->LoadRecPoints(opt) ; }
142 Int_t LoadClusterizer(Option_t* opt="") const {
143 return EmcalLoader()->LoadClusterizer(opt) ; }
144 Int_t WriteRecPoints(Option_t* opt="") const { return EmcalLoader()->WriteRecPoints(opt) ; }
145 Int_t WriteClusterizer(Option_t* opt="") const {
146 return EmcalLoader()->WriteClusterizer(opt) ; }
148 //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) {
149 TClonesArray * TrackSegments() const ;
150 AliEMCALTrackSegment * TrackSegments(Int_t index) const { return static_cast<AliEMCALTrackSegment *>(TrackSegments()->At(index)) ;}
151 TTree * TreeT() const ;
152 AliEMCALTrackSegmentMaker * TrackSegmentMaker() ;
153 TString GetTracksFileName() const { return EmcalLoader()->GetTracksFileName() ; }
154 Int_t LoadTracks(Option_t* opt="") const { return EmcalLoader()->LoadTracks(opt) ; }
155 Int_t LoadTrackSegementMaker(Option_t* opt="") const {
156 return EmcalLoader()->LoadTrackSegmentMaker(opt) ; }
157 Int_t WriteTracks(Option_t* opt="") const { return EmcalLoader()->WriteTracks(opt) ; }
158 Int_t WriteTrackSegmentMaker(Option_t* opt="") const {
159 return EmcalLoader()->WriteTracker(opt) ; }
160 //========== RecParticles ===========
162 TClonesArray * RecParticles() const ;
163 AliEMCALRecParticle * RecParticle(Int_t index) const { return static_cast<AliEMCALRecParticle *>(RecParticles()->At(index)) ;}
164 TTree * TreeP() const ;
165 AliEMCALPID * PID() ;
166 TString GetRecParticlesFileName() const { return EmcalLoader()->GetRecParticlesFileName() ; }
167 Int_t LoadRecParticles(Option_t* opt="") const { return EmcalLoader()->LoadRecParticles(opt) ; }
168 Int_t LoadPID(Option_t* opt="") const {
169 return EmcalLoader()->LoadPID(opt) ; }
170 Int_t WriteRecParticles(Option_t* opt="") const { return EmcalLoader()->WriteRecParticles(opt) ; }
171 Int_t WritePID(Option_t* opt="") const {
172 return EmcalLoader()->WritePID(opt) ; }
174 //========== Raw ===========
175 Int_t ReadRaw(Int_t event) ;
177 void SetDebug(Int_t level) {fgDebug = level;} // Set debug level
178 void PostClusterizer(AliEMCALClusterizer * clu)
179 const{EmcalLoader()->PostClusterizer(clu) ; }
180 void PostPID(AliEMCALPID * pid)
181 const{EmcalLoader()->PostPID(pid) ; }
182 void PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tr)
183 const{EmcalLoader()->PostTrackSegmentMaker(tr) ; }
184 void PostSDigitizer (AliEMCALSDigitizer * sdigitizer)
185 const {EmcalLoader()->PostSDigitizer(sdigitizer);}
186 void PostDigitizer (AliEMCALDigitizer * digitizer)
187 const {EmcalLoader()->PostDigitizer(dynamic_cast<AliDigitizer *>(digitizer));}
189 TString Version() const { return EmcalLoader()->GetTitle() ; }
190 AliEMCALLoader * EmcalLoader() const { return fgEmcalLoader; }
195 AliEMCALGetter(const char* headerFile,
196 const char* version = AliConfig::GetDefaultEventFolderName(),
197 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) ;
208 void ReadPrimaries(void) ;
210 void FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Int_t & amp, Double_t & time) ;
215 static Int_t fgDebug ; //! Debug level
217 TString fLoadingStatus ; //! tells which trees are loaded
219 // AliEMCALCalibrationDB * fcdb ; //!
221 static AliEMCALLoader * fgEmcalLoader ; // pointer to EMCAL Loader
222 static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton
224 enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes};
227 ClassDef(AliEMCALGetter,6) // Algorithm class that provides methods to retrieve objects from a list knowing the index
231 #endif // AliEMCALGETTER_H