]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALGetter.h
Extracting PHOS and EMCAL trackers from the correspondig reconstructors (Yu.Belikov)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGetter.h
CommitLineData
ffa6d63b 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 */
88cb7938 5
ffa6d63b 6/* $Id$ */
88cb7938 7
8//_________________________________________________________________________
ffa6d63b 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.
d75bea67 13//
ffa6d63b 14// The objects are retrived from folders.
d75bea67 15//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
16//
ffa6d63b 17
88cb7938 18
ffa6d63b 19// --- ROOT system ---
88cb7938 20#include "TObject.h"
1ce25ac8 21#include "TClonesArray.h"
22class TParticle ;
23class TTree ;
56088960 24class TGraph ;
25class TF1 ;
ffa6d63b 26
27// --- Standard library ---
173558f2 28
ffa6d63b 29// --- AliRoot header files ---
88cb7938 30#include "AliConfig.h"
31
32// #include "AliRun.h"
88cb7938 33#include "AliEMCALHit.h"
d64c959b 34#include "AliEMCALRecParticle.h"
88cb7938 35#include "AliEMCALDigitizer.h"
36#include "AliEMCALSDigitizer.h"
1ce25ac8 37#include "AliEMCALLoader.h"
38class AliEMCAL ;
39class AliEMCALGeometry ;
40class AliEMCALClusterizer ;
41class AliEMCALRecPoint ;
1ce25ac8 42class AliEMCALTrackSegmentMaker ;
43class AliEMCALTrackSegment ;
44class AliEMCALPID ;
88cb7938 45class AliEMCALBeamTestEvent ;
46
173558f2 47
ffa6d63b 48class AliEMCALGetter : public TObject {
49
88cb7938 50 public:
6b10bdac 51 AliEMCALGetter() {
52 // ctor: this is a singleton, the ctor should never be called but cint needs it as public
88cb7938 53 Fatal("ctor", "AliEMCALGetter is a singleton default ctor not callable") ;
ffa6d63b 54 }
39200c71 55 AliEMCALGetter(const AliEMCALGetter & obj):TObject(obj) {
ffa6d63b 56 // cpy ctor requested by Coding Convention
88cb7938 57 Fatal("cpy ctor", "not implemented") ;
ffa6d63b 58 }
59
05a92d59 60 AliEMCALGetter & operator = (const AliEMCALGetter & ) {
61 // assignement operator requested by coding convention, but not needed
88cb7938 62 Fatal("operator =", "not implemented") ;
05a92d59 63 return *this ;
64 }
ffa6d63b 65 virtual ~AliEMCALGetter() ;
66
88cb7938 67 //=========== Instantiators ================
68 static AliEMCALGetter * Instance(const char* headerFile,
e191bb57 69 const char* version = AliConfig::GetDefaultEventFolderName(),
88cb7938 70 Option_t * openingOption = "READ" ) ;
71 static AliEMCALGetter * Instance() ;
6b10bdac 72 void OpenFile(const char* headerFile,
73 const char* version = AliConfig::GetDefaultEventFolderName(),
74 Option_t * openingOption = "READ" );
88cb7938 75
76 static void Print() ;
77
78// //=========== General information about run ==============
09884213 79 Bool_t IsLoaded(TString tree) const { return fLoadingStatus.Contains(tree) ; }
80 void SetLoaded(TString tree) { fLoadingStatus += tree ; }
88cb7938 81
82 Int_t MaxEvent() const ;
83 Int_t EventNumber() const ;
84 Bool_t VersionExists(TString & opt) const ;
85 UShort_t EventPattern(void) const ;
86 Float_t BeamEnergy(void) const ;
87
88// //========== EMCALGeometry and EMCAL =============
89 AliEMCAL * EMCAL() const ;
90 AliEMCALGeometry * EMCALGeometry() const ;
91
92// //========== Methods to read something from file ==========
09884213 93 void Event(Int_t event, const char * opt = "HSDRP") ;
94 void Track(Int_t itrack) ;
88cb7938 95
96// //-----------------now getter's data--------------------------------------
97// // AliEMCALCalibrationDB * CalibrationDB(){return fcdb; }
98// // void ReadCalibrationDB(const char * name, const char * filename) ;
05a92d59 99
100 //=========== Primaries ============
88cb7938 101// TTree * TreeK(TString filename="") ;
88cb7938 102 TParticle * Primary(Int_t index) const ;
6b10bdac 103 Int_t NPrimaries() const;
09884213 104 TParticle * Secondary(const TParticle * p, Int_t index=1) const ;
88cb7938 105
106// //=========== Hits =================
107// TTree * TreeH(TString filename="") ;
1ce25ac8 108 TClonesArray * Hits(void) const ;
09884213 109 AliEMCALHit * Hit(Int_t index) const { return dynamic_cast<AliEMCALHit*>(Hits()->At(index) );}
88cb7938 110 TTree * TreeH() const ;
111
05a92d59 112 //=========== SDigits ==============
1ce25ac8 113 TClonesArray * SDigits() const ;
09884213 114 AliEMCALDigit * SDigit(Int_t index) const { return static_cast<AliEMCALDigit *>(SDigits()->At(index)) ;}
88cb7938 115 TTree * TreeS() const ;
116 AliEMCALSDigitizer * SDigitizer() ;
117
1ce25ac8 118 TString GetSDigitsFileName() const { return EmcalLoader()->GetSDigitsFileName() ; }
119 Int_t LoadSDigits(Option_t* opt="") const { return EmcalLoader()->LoadSDigits(opt) ; }
120 Int_t LoadSDigitizer(Option_t* opt="") const { return EmcalLoader()->LoadSDigitizer(opt) ; }
121 Int_t WriteSDigits(Option_t* opt="") const { return EmcalLoader()->WriteSDigits(opt) ; }
122 Int_t WriteSDigitizer(Option_t* opt="") const {
88cb7938 123 return EmcalLoader()->WriteSDigitizer(opt) ; }
124
05a92d59 125 //========== Digits ================
1ce25ac8 126 TClonesArray * Digits() const ;
09884213 127 AliEMCALDigit * Digit(Int_t index) const { return static_cast<AliEMCALDigit *>(Digits()->At(index)) ;}
88cb7938 128 TTree * TreeD() const ;
129 AliEMCALDigitizer * Digitizer() ;
1ce25ac8 130 TString GetDigitsFileName() const { return EmcalLoader()->GetDigitsFileName() ; }
131 Int_t LoadDigits(Option_t* opt="") const { return EmcalLoader()->LoadDigits(opt) ; }
132 Int_t LoadDigitizer(Option_t* opt="") const {
88cb7938 133 return EmcalLoader()->LoadDigitizer(opt) ; }
1ce25ac8 134 Int_t WriteDigits(Option_t* opt="") const { return EmcalLoader()->WriteDigits(opt) ; }
135 Int_t WriteDigitizer(Option_t* opt="") const {
88cb7938 136 return EmcalLoader()->WriteDigitizer(opt) ; }
137
05a92d59 138 //========== RecPoints =============
fdebddeb 139 TObjArray * ECARecPoints() const;
70a93198 140 AliEMCALRecPoint * ECARecPoint(Int_t index) const{ return static_cast<AliEMCALRecPoint *>(ECARecPoints()->At(index)) ;}
88cb7938 141 TTree * TreeR() const ;
142 AliEMCALClusterizer * Clusterizer() ;
1ce25ac8 143 TString GetRecPointsFileName() const { return EmcalLoader()->GetRecPointsFileName() ; }
144 Int_t LoadRecPoints(Option_t* opt="") const { return EmcalLoader()->LoadRecPoints(opt) ; }
145 Int_t LoadClusterizer(Option_t* opt="") const {
88cb7938 146 return EmcalLoader()->LoadClusterizer(opt) ; }
1ce25ac8 147 Int_t WriteRecPoints(Option_t* opt="") const { return EmcalLoader()->WriteRecPoints(opt) ; }
148 Int_t WriteClusterizer(Option_t* opt="") const {
88cb7938 149 return EmcalLoader()->WriteClusterizer(opt) ; }
150
151 //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) {
1ce25ac8 152 TClonesArray * TrackSegments() const ;
09884213 153 AliEMCALTrackSegment * TrackSegments(Int_t index) const { return static_cast<AliEMCALTrackSegment *>(TrackSegments()->At(index)) ;}
88cb7938 154 TTree * TreeT() const ;
155 AliEMCALTrackSegmentMaker * TrackSegmentMaker() ;
1ce25ac8 156 TString GetTracksFileName() const { return EmcalLoader()->GetTracksFileName() ; }
157 Int_t LoadTracks(Option_t* opt="") const { return EmcalLoader()->LoadTracks(opt) ; }
158 Int_t LoadTrackSegementMaker(Option_t* opt="") const {
88cb7938 159 return EmcalLoader()->LoadTrackSegmentMaker(opt) ; }
1ce25ac8 160 Int_t WriteTracks(Option_t* opt="") const { return EmcalLoader()->WriteTracks(opt) ; }
161 Int_t WriteTrackSegmentMaker(Option_t* opt="") const {
88cb7938 162 return EmcalLoader()->WriteTracker(opt) ; }
516fff8e 163 //========== RecParticles ===========
173558f2 164
1ce25ac8 165 TClonesArray * RecParticles() const ;
e3bb24cf 166 AliEMCALRecParticle * RecParticle(Int_t index) const { return static_cast<AliEMCALRecParticle *>(RecParticles()->At(index)) ;}
88cb7938 167 TTree * TreeP() const ;
168 AliEMCALPID * PID() ;
1ce25ac8 169 TString GetRecParticlesFileName() const { return EmcalLoader()->GetRecParticlesFileName() ; }
170 Int_t LoadRecParticles(Option_t* opt="") const { return EmcalLoader()->LoadRecParticles(opt) ; }
171 Int_t LoadPID(Option_t* opt="") const {
88cb7938 172 return EmcalLoader()->LoadPID(opt) ; }
1ce25ac8 173 Int_t WriteRecParticles(Option_t* opt="") const { return EmcalLoader()->WriteRecParticles(opt) ; }
174 Int_t WritePID(Option_t* opt="") const {
88cb7938 175 return EmcalLoader()->WritePID(opt) ; }
176
a43c51c3 177 //========== Raw ===========
178 Int_t ReadRaw(Int_t event) ;
88cb7938 179
180 void SetDebug(Int_t level) {fgDebug = level;} // Set debug level
1ce25ac8 181 void PostClusterizer(AliEMCALClusterizer * clu)
88cb7938 182 const{EmcalLoader()->PostClusterizer(clu) ; }
183 void PostPID(AliEMCALPID * pid)
184 const{EmcalLoader()->PostPID(pid) ; }
185 void PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tr)
186 const{EmcalLoader()->PostTrackSegmentMaker(tr) ; }
187 void PostSDigitizer (AliEMCALSDigitizer * sdigitizer)
188 const {EmcalLoader()->PostSDigitizer(sdigitizer);}
189 void PostDigitizer (AliEMCALDigitizer * digitizer)
190 const {EmcalLoader()->PostDigitizer(dynamic_cast<AliDigitizer *>(digitizer));}
191
192 TString Version() const { return EmcalLoader()->GetTitle() ; }
6b10bdac 193 AliEMCALLoader * EmcalLoader() const { return fgEmcalLoader; }
0ef40383 194 void Reset() ;
64c1dcb3 195
9859bfc0 196private:
88cb7938 197
198 AliEMCALGetter(const char* headerFile,
6b10bdac 199 const char* version = AliConfig::GetDefaultEventFolderName(),
200 Option_t * openingOption = "READ") ;
201
173558f2 202
88cb7938 203 Int_t ReadTreeD(void) ;
05a92d59 204 Int_t ReadTreeH(void) ;
88cb7938 205 Int_t ReadTreeR(void) ;
206 Int_t ReadTreeT(void) ;
207 Int_t ReadTreeS(void) ;
208 Int_t ReadTreeP(void) ;
209
210
05a92d59 211 void ReadPrimaries(void) ;
56088960 212
213 void FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Int_t & amp, Double_t & time) ;
88cb7938 214
215private:
216
217// static TFile * fgFile; //!
218
219// AliEMCALBeamTestEvent * fBTE ; //! Header if BeamTest Event
220
221 static Int_t fgDebug ; //! Debug level
222
223 TString fLoadingStatus ; //! tells which trees are loaded
48401f0d 224 static TString fVersion; //! stores the current folder name
88cb7938 225
226// AliEMCALCalibrationDB * fcdb ; //!
227
1ce25ac8 228 static AliEMCALLoader * fgEmcalLoader ; // pointer to EMCAL Loader
ffa6d63b 229 static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton
88cb7938 230
231 enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes};
232
ffa6d63b 233
48401f0d 234 ClassDef(AliEMCALGetter,5) // Algorithm class that provides methods to retrieve objects from a list knowing the index
ffa6d63b 235
236};
237
238#endif // AliEMCALGETTER_H