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"
22 // #include "TFolder.h"
29 // --- Standard library ---
31 // --- AliRoot header files ---
32 #include "AliConfig.h"
34 // #include "AliRun.h"
36 #include "AliEMCALHit.h"
37 // #include "AliEMCALDigit.h"
38 // #include "AliEMCALRecPoint.h"
39 // #include "AliEMCALRecPoint.h"
40 // #include "AliEMCALTrackSegment.h"
41 // #include "AliEMCALRecParticle.h"
42 class AliEMCALGeometry ;
43 #include "AliEMCALDigitizer.h"
44 #include "AliEMCALSDigitizer.h"
45 // class AliEMCALClusterizer ;
46 // class AliEMCALTrackSegmentMaker ;
47 // class AliEMCALPID ;
48 // //class AliEMCALCalibrationDB ;
49 // class AliEMCALConTableDB ;
50 class AliEMCALBeamTestEvent ;
52 #include "AliEMCALLoader.h"
54 class AliEMCALGetter : public TObject {
57 AliEMCALGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public
58 Fatal("ctor", "AliEMCALGetter is a singleton default ctor not callable") ;
60 AliEMCALGetter(const AliEMCALGetter & obj) {
61 // cpy ctor requested by Coding Convention
62 Fatal("cpy ctor", "not implemented") ;
65 AliEMCALGetter & operator = (const AliEMCALGetter & ) {
66 // assignement operator requested by coding convention, but not needed
67 Fatal("operator =", "not implemented") ;
70 virtual ~AliEMCALGetter() ;
72 //=========== Instantiators ================
73 static AliEMCALGetter * Instance(const char* headerFile,
74 const char* version = AliConfig::fgkDefaultEventFolderName,
75 Option_t * openingOption = "READ" ) ;
76 static AliEMCALGetter * Instance() ;
80 // //=========== General information about run ==============
81 Bool_t IsLoaded(const TString tree) const { return fLoadingStatus.Contains(tree) ; }
82 void SetLoaded(const TString tree) { fLoadingStatus += tree ; }
84 Int_t MaxEvent() const ;
85 Int_t EventNumber() const ;
86 Bool_t VersionExists(TString & opt) const ;
87 UShort_t EventPattern(void) const ;
88 Float_t BeamEnergy(void) const ;
90 // //========== EMCALGeometry and EMCAL =============
91 AliEMCAL * EMCAL() const ;
92 AliEMCALGeometry * EMCALGeometry() const ;
94 // //========== Methods to read something from file ==========
95 void Event(const Int_t event, const char * opt = "HSDRP") ;
96 void Track(const Int_t itrack) ;
98 // //-----------------now getter's data--------------------------------------
99 // // AliEMCALCalibrationDB * CalibrationDB(){return fcdb; }
100 // // void ReadCalibrationDB(const char * name, const char * filename) ;
102 //=========== Primaries ============
103 // TTree * TreeK(TString filename="") ;
104 TClonesArray * Primaries(void) ;
105 TParticle * Primary(Int_t index) const ;
106 Int_t NPrimaries()const { return fNPrimaries; }
107 TParticle * Secondary(const TParticle * p, const Int_t index=1) const ;
109 // //=========== Hits =================
110 // TTree * TreeH(TString filename="") ;
111 TClonesArray * Hits(void) ;
112 AliEMCALHit * Hit(const Int_t index) { return dynamic_cast<AliEMCALHit*>(Hits()->At(index) );}
113 TTree * TreeH() const ;
115 //=========== SDigits ==============
116 TClonesArray * SDigits() ;
117 AliEMCALDigit * SDigit(const Int_t index) { return static_cast<AliEMCALDigit *>(SDigits()->At(index)) ;}
118 TTree * TreeS() const ;
119 AliEMCALSDigitizer * SDigitizer() ;
121 TString GetSDigitsFileName() { return EmcalLoader()->GetSDigitsFileName() ; }
122 Int_t LoadSDigits(Option_t* opt="") { return EmcalLoader()->LoadSDigits(opt) ; }
123 Int_t LoadSDigitizer(Option_t* opt=""){ return EmcalLoader()->LoadSDigitizer(opt) ; }
124 Int_t WriteSDigits(Option_t* opt="") { return EmcalLoader()->WriteSDigits(opt) ; }
125 Int_t WriteSDigitizer(Option_t* opt=""){
126 return EmcalLoader()->WriteSDigitizer(opt) ; }
128 //========== Digits ================
129 TClonesArray * Digits() ;
130 AliEMCALDigit * Digit(const Int_t index) { return static_cast<AliEMCALDigit *>(Digits()->At(index)) ;}
131 TTree * TreeD() const ;
132 AliEMCALDigitizer * Digitizer() ;
133 TString GetDigitsFileName() { return EmcalLoader()->GetDigitsFileName() ; }
134 Int_t LoadDigits(Option_t* opt="") { return EmcalLoader()->LoadDigits(opt) ; }
135 Int_t LoadDigitizer(Option_t* opt=""){
136 return EmcalLoader()->LoadDigitizer(opt) ; }
137 Int_t WriteDigits(Option_t* opt="") { return EmcalLoader()->WriteDigits(opt) ; }
138 Int_t WriteDigitizer(Option_t* opt=""){
139 return EmcalLoader()->WriteDigitizer(opt) ; }
141 //========== RecPoints =============
142 TObjArray * PRERecPoints() ;
143 AliEMCALRecPoint * PRERecPoint(const Int_t index) { return static_cast<AliEMCALRecPoint *>(PRERecPoints()->At(index)) ;}
144 TObjArray * ECARecPoints() ;
145 AliEMCALTowerRecPoint * ECARecPoint(const Int_t index) { return static_cast<AliEMCALTowerRecPoint *>(ECARecPoints()->At(index)) ;}
146 TObjArray * HCARecPoints() ;
147 AliEMCALTowerRecPoint * HCARecPoint(const Int_t index) { return static_cast<AliEMCALTowerRecPoint *>(HCARecPoints()->At(index)) ;}
148 TTree * TreeR() const ;
149 AliEMCALClusterizer * Clusterizer() ;
150 TString GetRecPointsFileName() { return EmcalLoader()->GetRecPointsFileName() ; }
151 Int_t LoadRecPoints(Option_t* opt="") { return EmcalLoader()->LoadRecPoints(opt) ; }
152 Int_t LoadClusterizer(Option_t* opt=""){
153 return EmcalLoader()->LoadClusterizer(opt) ; }
154 Int_t WriteRecPoints(Option_t* opt="") { return EmcalLoader()->WriteRecPoints(opt) ; }
155 Int_t WriteClusterizer(Option_t* opt=""){
156 return EmcalLoader()->WriteClusterizer(opt) ; }
158 //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) {
159 TClonesArray * TrackSegments() ;
160 AliEMCALTrackSegment * TrackSegments(const Int_t index) { return static_cast<AliEMCALTrackSegment *>(TrackSegments()->At(index)) ;}
161 TTree * TreeT() const ;
162 AliEMCALTrackSegmentMaker * TrackSegmentMaker() ;
163 TString GetTracksFileName() { return EmcalLoader()->GetTracksFileName() ; }
164 Int_t LoadTracks(Option_t* opt="") { return EmcalLoader()->LoadTracks(opt) ; }
165 Int_t LoadTrackSegementMaker(Option_t* opt=""){
166 return EmcalLoader()->LoadTrackSegmentMaker(opt) ; }
167 Int_t WriteTracks(Option_t* opt="") { return EmcalLoader()->WriteTracks(opt) ; }
168 Int_t WriteTrackSegmentMaker(Option_t* opt=""){
169 return EmcalLoader()->WriteTracker(opt) ; }
170 //========== RecParticles ===========
172 TClonesArray * RecParticles() ;
173 AliEMCALRecParticle * RecPaticles(const Int_t index) { return static_cast<AliEMCALRecParticle *>(RecParticles()->At(index)) ;}
174 TTree * TreeP() const ;
175 AliEMCALPID * PID() ;
176 TString GetRecParticlesFileName() { return EmcalLoader()->GetRecParticlesFileName() ; }
177 Int_t LoadRecParticles(Option_t* opt="") { return EmcalLoader()->LoadRecParticles(opt) ; }
178 Int_t LoadPID(Option_t* opt=""){
179 return EmcalLoader()->LoadPID(opt) ; }
180 Int_t WriteRecParticles(Option_t* opt="") { return EmcalLoader()->WriteRecParticles(opt) ; }
181 Int_t WritePID(Option_t* opt=""){
182 return EmcalLoader()->WritePID(opt) ; }
185 void SetDebug(Int_t level) {fgDebug = level;} // Set debug level
186 void PostClusterizer(AliEMCALClusterizer * clu)
187 const{EmcalLoader()->PostClusterizer(clu) ; }
188 void PostPID(AliEMCALPID * pid)
189 const{EmcalLoader()->PostPID(pid) ; }
190 void PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tr)
191 const{EmcalLoader()->PostTrackSegmentMaker(tr) ; }
192 void PostSDigitizer (AliEMCALSDigitizer * sdigitizer)
193 const {EmcalLoader()->PostSDigitizer(sdigitizer);}
194 void PostDigitizer (AliEMCALDigitizer * digitizer)
195 const {EmcalLoader()->PostDigitizer(dynamic_cast<AliDigitizer *>(digitizer));}
197 TString Version() const { return EmcalLoader()->GetTitle() ; }
198 AliEMCALLoader * EmcalLoader() const { return fgEmcalLoader ; }
202 AliEMCALGetter(const char* headerFile,
203 const char* version = AliConfig::fgkDefaultEventFolderName,
204 Option_t * openingOption = "READ") ;
206 Int_t ReadTreeD(void) ;
207 Int_t ReadTreeH(void) ;
208 Int_t ReadTreeR(void) ;
209 Int_t ReadTreeT(void) ;
210 Int_t ReadTreeS(void) ;
211 Int_t ReadTreeP(void) ;
214 void ReadPrimaries(void) ;
218 // static TFile * fgFile; //!
220 // AliEMCALBeamTestEvent * fBTE ; //! Header if BeamTest Event
222 static Int_t fgDebug ; //! Debug level
224 TString fLoadingStatus ; //! tells which trees are loaded
225 Int_t fNPrimaries ; //! # of primaries
226 TClonesArray * fPrimaries ; //! list of lists of primaries
228 // AliEMCALCalibrationDB * fcdb ; //!
230 static AliEMCALLoader * fgEmcalLoader ;
231 static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton
233 enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes};
236 ClassDef(AliEMCALGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
240 #endif // AliEMCALGETTER_H