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"
25 // --- Standard library ---
27 // --- AliRoot header files ---
28 #include "AliConfig.h"
30 // #include "AliRun.h"
31 #include "AliEMCALHit.h"
32 #include "AliEMCALRecParticle.h"
33 #include "AliEMCALDigitizer.h"
34 #include "AliEMCALSDigitizer.h"
35 #include "AliEMCALLoader.h"
37 class AliEMCALGeometry ;
38 class AliEMCALClusterizer ;
39 class AliEMCALRecPoint ;
40 class AliEMCALTrackSegmentMaker ;
41 class AliEMCALTrackSegment ;
43 class AliEMCALBeamTestEvent ;
46 class AliEMCALGetter : public TObject {
50 // ctor: this is a singleton, the ctor should never be called but cint needs it as public
51 Fatal("ctor", "AliEMCALGetter is a singleton default ctor not callable") ;
53 AliEMCALGetter(const AliEMCALGetter & obj):TObject(obj) {
54 // cpy ctor requested by Coding Convention
55 Fatal("cpy ctor", "not implemented") ;
58 AliEMCALGetter & operator = (const AliEMCALGetter & ) {
59 // assignement operator requested by coding convention, but not needed
60 Fatal("operator =", "not implemented") ;
63 virtual ~AliEMCALGetter() ;
65 //=========== Instantiators ================
66 static AliEMCALGetter * Instance(const char* headerFile,
67 const char* version = AliConfig::GetDefaultEventFolderName(),
68 Option_t * openingOption = "READ" ) ;
69 static AliEMCALGetter * Instance() ;
70 void OpenFile(const char* headerFile,
71 const char* version = AliConfig::GetDefaultEventFolderName(),
72 Option_t * openingOption = "READ" );
76 // //=========== General information about run ==============
77 Bool_t IsLoaded(TString tree) const { return fLoadingStatus.Contains(tree) ; }
78 void SetLoaded(TString tree) { fLoadingStatus += tree ; }
80 Int_t MaxEvent() const ;
81 Int_t EventNumber() const ;
82 Bool_t VersionExists(TString & opt) const ;
83 UShort_t EventPattern(void) const ;
84 Float_t BeamEnergy(void) const ;
86 // //========== EMCALGeometry and EMCAL =============
87 AliEMCAL * EMCAL() const ;
88 AliEMCALGeometry * EMCALGeometry() const ;
90 // //========== Methods to read something from file ==========
91 void Event(Int_t event, const char * opt = "HSDRP") ;
92 void Track(Int_t itrack) ;
94 // //-----------------now getter's data--------------------------------------
95 // // AliEMCALCalibrationDB * CalibrationDB(){return fcdb; }
96 // // void ReadCalibrationDB(const char * name, const char * filename) ;
98 //=========== Primaries ============
99 // TTree * TreeK(TString filename="") ;
100 TParticle * Primary(Int_t index) const ;
101 Int_t NPrimaries() const;
102 TParticle * Secondary(const TParticle * p, Int_t index=1) const ;
104 // //=========== Hits =================
105 // TTree * TreeH(TString filename="") ;
106 TClonesArray * Hits(void) const ;
107 AliEMCALHit * Hit(Int_t index) const { return dynamic_cast<AliEMCALHit*>(Hits()->At(index) );}
108 TTree * TreeH() const ;
110 //=========== SDigits ==============
111 TClonesArray * SDigits() const ;
112 AliEMCALDigit * SDigit(Int_t index) const { return static_cast<AliEMCALDigit *>(SDigits()->At(index)) ;}
113 TTree * TreeS() const ;
114 AliEMCALSDigitizer * SDigitizer() ;
116 TString GetSDigitsFileName() const { return EmcalLoader()->GetSDigitsFileName() ; }
117 Int_t LoadSDigits(Option_t* opt="") const { return EmcalLoader()->LoadSDigits(opt) ; }
118 Int_t LoadSDigitizer(Option_t* opt="") const { return EmcalLoader()->LoadSDigitizer(opt) ; }
119 Int_t WriteSDigits(Option_t* opt="") const { return EmcalLoader()->WriteSDigits(opt) ; }
120 Int_t WriteSDigitizer(Option_t* opt="") const {
121 return EmcalLoader()->WriteSDigitizer(opt) ; }
123 //========== Digits ================
124 TClonesArray * Digits() const ;
125 AliEMCALDigit * Digit(Int_t index) const { return static_cast<AliEMCALDigit *>(Digits()->At(index)) ;}
126 TTree * TreeD() const ;
127 AliEMCALDigitizer * Digitizer() ;
128 TString GetDigitsFileName() const { return EmcalLoader()->GetDigitsFileName() ; }
129 Int_t LoadDigits(Option_t* opt="") const { return EmcalLoader()->LoadDigits(opt) ; }
130 Int_t LoadDigitizer(Option_t* opt="") const {
131 return EmcalLoader()->LoadDigitizer(opt) ; }
132 Int_t WriteDigits(Option_t* opt="") const { return EmcalLoader()->WriteDigits(opt) ; }
133 Int_t WriteDigitizer(Option_t* opt="") const {
134 return EmcalLoader()->WriteDigitizer(opt) ; }
136 //========== RecPoints =============
137 TObjArray * ECARecPoints() const;
138 AliEMCALRecPoint * ECARecPoint(Int_t index) const{ return static_cast<AliEMCALRecPoint *>(ECARecPoints()->At(index)) ;}
139 TTree * TreeR() const ;
140 AliEMCALClusterizer * Clusterizer() ;
141 TString GetRecPointsFileName() const { return EmcalLoader()->GetRecPointsFileName() ; }
142 Int_t LoadRecPoints(Option_t* opt="") const { return EmcalLoader()->LoadRecPoints(opt) ; }
143 Int_t LoadClusterizer(Option_t* opt="") const {
144 return EmcalLoader()->LoadClusterizer(opt) ; }
145 Int_t WriteRecPoints(Option_t* opt="") const { return EmcalLoader()->WriteRecPoints(opt) ; }
146 Int_t WriteClusterizer(Option_t* opt="") const {
147 return EmcalLoader()->WriteClusterizer(opt) ; }
149 //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) {
150 TClonesArray * TrackSegments() const ;
151 AliEMCALTrackSegment * TrackSegments(Int_t index) const { return static_cast<AliEMCALTrackSegment *>(TrackSegments()->At(index)) ;}
152 TTree * TreeT() const ;
153 AliEMCALTrackSegmentMaker * TrackSegmentMaker() ;
154 TString GetTracksFileName() const { return EmcalLoader()->GetTracksFileName() ; }
155 Int_t LoadTracks(Option_t* opt="") const { return EmcalLoader()->LoadTracks(opt) ; }
156 Int_t LoadTrackSegementMaker(Option_t* opt="") const {
157 return EmcalLoader()->LoadTrackSegmentMaker(opt) ; }
158 Int_t WriteTracks(Option_t* opt="") const { return EmcalLoader()->WriteTracks(opt) ; }
159 Int_t WriteTrackSegmentMaker(Option_t* opt="") const {
160 return EmcalLoader()->WriteTracker(opt) ; }
161 //========== RecParticles ===========
163 TClonesArray * RecParticles() const ;
164 AliEMCALRecParticle * RecParticle(Int_t index) const { return static_cast<AliEMCALRecParticle *>(RecParticles()->At(index)) ;}
165 TTree * TreeP() const ;
166 AliEMCALPID * PID() ;
167 TString GetRecParticlesFileName() const { return EmcalLoader()->GetRecParticlesFileName() ; }
168 Int_t LoadRecParticles(Option_t* opt="") const { return EmcalLoader()->LoadRecParticles(opt) ; }
169 Int_t LoadPID(Option_t* opt="") const {
170 return EmcalLoader()->LoadPID(opt) ; }
171 Int_t WriteRecParticles(Option_t* opt="") const { return EmcalLoader()->WriteRecParticles(opt) ; }
172 Int_t WritePID(Option_t* opt="") const {
173 return EmcalLoader()->WritePID(opt) ; }
176 void SetDebug(Int_t level) {fgDebug = level;} // Set debug level
177 void PostClusterizer(AliEMCALClusterizer * clu)
178 const{EmcalLoader()->PostClusterizer(clu) ; }
179 void PostPID(AliEMCALPID * pid)
180 const{EmcalLoader()->PostPID(pid) ; }
181 void PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tr)
182 const{EmcalLoader()->PostTrackSegmentMaker(tr) ; }
183 void PostSDigitizer (AliEMCALSDigitizer * sdigitizer)
184 const {EmcalLoader()->PostSDigitizer(sdigitizer);}
185 void PostDigitizer (AliEMCALDigitizer * digitizer)
186 const {EmcalLoader()->PostDigitizer(dynamic_cast<AliDigitizer *>(digitizer));}
188 TString Version() const { return EmcalLoader()->GetTitle() ; }
189 AliEMCALLoader * EmcalLoader() const { return fgEmcalLoader; }
194 AliEMCALGetter(const char* headerFile,
195 const char* version = AliConfig::GetDefaultEventFolderName(),
196 Option_t * openingOption = "READ") ;
199 Int_t ReadTreeD(void) ;
200 Int_t ReadTreeH(void) ;
201 Int_t ReadTreeR(void) ;
202 Int_t ReadTreeT(void) ;
203 Int_t ReadTreeS(void) ;
204 Int_t ReadTreeP(void) ;
207 void ReadPrimaries(void) ;
211 // static TFile * fgFile; //!
213 // AliEMCALBeamTestEvent * fBTE ; //! Header if BeamTest Event
215 static Int_t fgDebug ; //! Debug level
217 TString fLoadingStatus ; //! tells which trees are loaded
218 static TString fVersion; //! stores the current folder name
220 // AliEMCALCalibrationDB * fcdb ; //!
222 static AliEMCALLoader * fgEmcalLoader ; // pointer to EMCAL Loader
223 static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton
225 enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes};
228 ClassDef(AliEMCALGetter,5) // Algorithm class that provides methods to retrieve objects from a list knowing the index
232 #endif // AliEMCALGETTER_H