]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSGetter.h
Possible conflicts between Heavy Flavor and Atlas Tuning removed.
[u/mrichter/AliRoot.git] / PHOS / AliPHOSGetter.h
CommitLineData
4ae78bb1 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 */
5
6/* $Id$ */
7
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.
13//
14// The objects are retrived from folders.
15//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
16//
17
18
19// --- ROOT system ---
88cb7938 20#include "TObject.h"
e957fea8 21class TParticle ;
22class TTree ;
45c1ce6f 23class TGraph ;
24class TF1 ;
4ae78bb1 25
26// --- Standard library ---
27
28// --- AliRoot header files ---
88cb7938 29#include "AliConfig.h"
e957fea8 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"
88cb7938 37#include "AliPHOSDigitizer.h"
e957fea8 38#include "AliPHOSSDigitizer.h"
7ca0684e 39#include "AliPHOSCalibData.h"
ef868168 40#include "AliPHOSAlignData.h"
7ca0684e 41
e957fea8 42class AliPHOS ;
43class AliPHOSGeometry ;
44class AliPHOSClusterizer ;
45class AliPHOSTrackSegmentMaker ;
46class AliPHOSPID ;
7bb289a7 47class AliPHOSBeamTestEvent ;
95635748 48class AliESD ;
3cf4f75f 49class AliRawReader ;
4ae78bb1 50
51class AliPHOSGetter : public TObject {
52
95635748 53public:
cb34a1fa 54 AliPHOSGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public
f1611b7c 55 Fatal("ctor", "AliPHOSGetter is a singleton default ctor not callable") ;
4ae78bb1 56 }
66f895c8 57protected :
58 AliPHOSGetter(Int_t /*i*/){ // special constructor for onflight
59
60 }
61private:
62 AliPHOSGetter(const char* headerFile,
63 const char* version = AliConfig::GetDefaultEventFolderName(),
64 Option_t * openingOption = "READ") ;
65
66public:
a8c47ab6 67 AliPHOSGetter(const AliPHOSGetter & obj) : TObject(obj) {
4ae78bb1 68 // cpy ctor requested by Coding Convention
f1611b7c 69 Fatal("cpy ctor", "not implemented") ;
4ae78bb1 70 }
71
fbf811ec 72 AliPHOSGetter & operator = (const AliPHOSGetter & ) {
73 // assignement operator requested by coding convention, but not needed
f1611b7c 74 Fatal("operator =", "not implemented") ;
fbf811ec 75 return *this ;
76 }
d071065d 77 virtual ~AliPHOSGetter() ;
548f0134 78
fbf811ec 79 //=========== Instantiators ================
88cb7938 80 static AliPHOSGetter * Instance(const char* headerFile,
e191bb57 81 const char* version = AliConfig::GetDefaultEventFolderName(),
88cb7938 82 Option_t * openingOption = "READ" ) ;
83 static AliPHOSGetter * Instance() ;
95635748 84
702ab87e 85 void Print(const Option_t *)const{}
88cb7938 86 static void Print() ;
548f0134 87
95635748 88 //=========== General information about run ==============
66f895c8 89 virtual Bool_t IsLoaded(TString tree) const { return fLoadingStatus.Contains(tree) ; }
90 virtual void SetLoaded(TString tree) { fLoadingStatus += tree ; }
95635748 91
66f895c8 92 virtual Int_t MaxEvent() const ;
93 virtual Int_t EventNumber() const ;
94 virtual Bool_t VersionExists(TString & opt) const ;
95 virtual UShort_t EventPattern(void) const ;
96 virtual Float_t BeamEnergy(void) const ;
b0bba0af 97
95635748 98 //========== PHOSGeometry and PHOS =============
66f895c8 99 virtual AliPHOS * PHOS() const ;
100 virtual AliPHOSGeometry * PHOSGeometry() const ;
548f0134 101
95635748 102 //========== Methods to read something from file ==========
66f895c8 103 virtual void Event(Int_t event, const char * opt = "HSDRTP") ;
3cf4f75f 104 void Event(AliRawReader *rawReader, const char * opt = "W") ;
66f895c8 105 virtual void Track(Int_t itrack) ;
106
548f0134 107
95635748 108 //-----------------now getter's data--------------------------------------
3b844b86 109 AliPHOSCalibrationDB * CalibrationDB(){return fcdb; }
110 void ReadCalibrationDB(const char * /*name*/, const char * /*filename*/){ ;}
111 void SetCalibrationDB(AliPHOSCalibrationDB * cdb) {fcdb = cdb ;}
95635748 112
7ca0684e 113 void SetCalibData(AliPHOSCalibData* calibda) { fCalibData = calibda; }
ef868168 114 void SetAlignData(AliPHOSAlignData* alignda) { fAlignData = alignda; }
7ca0684e 115 AliPHOSCalibData * CalibData();
ef868168 116 AliPHOSAlignData * AlignData();
7ca0684e 117
fbf811ec 118 //=========== Primaries ============
66f895c8 119 virtual TClonesArray * Primaries(void) ;
120 virtual TParticle * Primary(Int_t index) const ;
121 virtual Int_t NPrimaries()const { return fNPrimaries; }
122 virtual TParticle * Secondary(const TParticle * p, Int_t index=1) const ;
88cb7938 123
95635748 124 //=========== Hits =================
66f895c8 125 virtual TClonesArray * Hits(void) ;
126 virtual AliPHOSHit * Hit(Int_t index) { return dynamic_cast<AliPHOSHit*>(Hits()->At(index) );}
127 virtual TTree * TreeH() const ;
cb34a1fa 128
fbf811ec 129 //=========== SDigits ==============
66f895c8 130 virtual TClonesArray * SDigits() ;
131 virtual AliPHOSDigit * SDigit(Int_t index) { return static_cast<AliPHOSDigit *>(SDigits()->At(index)) ;}
132 virtual TTree * TreeS() const ;
133 virtual AliPHOSSDigitizer * SDigitizer() ;
134
135 virtual TString GetSDigitsFileName() const { return PhosLoader()->GetSDigitsFileName() ; }
136 virtual Int_t LoadSDigits(Option_t* opt="") const { return PhosLoader()->LoadSDigits(opt) ; }
137 virtual Int_t LoadSDigitizer(Option_t* opt="") const { return PhosLoader()->LoadSDigitizer(opt) ; }
138 virtual Int_t WriteSDigits(Option_t* opt="") const { return PhosLoader()->WriteSDigits(opt) ; }
139 virtual Int_t WriteSDigitizer(Option_t* opt="") const {
88cb7938 140 return PhosLoader()->WriteSDigitizer(opt) ; }
548f0134 141
fbf811ec 142 //========== Digits ================
66f895c8 143 virtual TClonesArray * Digits() ;
144 virtual AliPHOSDigit * Digit(Int_t index) { return static_cast<AliPHOSDigit *>(Digits()->At(index)) ;}
145 virtual TTree * TreeD() const ;
146 virtual AliPHOSDigitizer * Digitizer() ;
147 virtual TString GetDigitsFileName() const { return PhosLoader()->GetDigitsFileName() ; }
148 virtual Int_t LoadDigits(Option_t* opt="") const { return PhosLoader()->LoadDigits(opt) ; }
149 virtual Int_t LoadDigitizer(Option_t* opt="") const {
88cb7938 150 return PhosLoader()->LoadDigitizer(opt) ; }
66f895c8 151 virtual Int_t WriteDigits(Option_t* opt="") const { return PhosLoader()->WriteDigits(opt) ; }
152 virtual Int_t WriteDigitizer(Option_t* opt="") const {
88cb7938 153 return PhosLoader()->WriteDigitizer(opt) ; }
66f895c8 154
155 //Methods to distinguish raw and simulated digits
156 virtual Bool_t IsRawDigits(void) const {return fRawDigits;}
157 virtual void SetRawDigits(Bool_t isRaw = kTRUE){fRawDigits = isRaw;}
cb34a1fa 158
fbf811ec 159 //========== RecPoints =============
66f895c8 160 virtual TObjArray * EmcRecPoints() ;
161 virtual AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) { return static_cast<AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ;}
162 virtual TObjArray * CpvRecPoints() ;
163 virtual AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) { return static_cast<AliPHOSCpvRecPoint *>(CpvRecPoints()->At(index)) ;}
164 virtual TTree * TreeR() const ;
165 virtual AliPHOSClusterizer * Clusterizer() ;
166 virtual TString GetRecPointsFileName() const { return PhosLoader()->GetRecPointsFileName() ; }
167 virtual Int_t LoadRecPoints(Option_t* opt="") const { return PhosLoader()->LoadRecPoints(opt) ; }
168 virtual Int_t LoadClusterizer(Option_t* opt="") const {
88cb7938 169 return PhosLoader()->LoadClusterizer(opt) ; }
66f895c8 170 virtual Int_t WriteRecPoints(Option_t* opt="") const { return PhosLoader()->WriteRecPoints(opt) ; }
171 virtual Int_t WriteClusterizer(Option_t* opt="") const {
88cb7938 172 return PhosLoader()->WriteClusterizer(opt) ; }
95635748 173
88cb7938 174 //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) {
66f895c8 175 virtual TClonesArray * TrackSegments() ;
176 virtual AliPHOSTrackSegment * TrackSegment(Int_t index) { return static_cast<AliPHOSTrackSegment *>(TrackSegments()->At(index)) ;}
177 virtual TTree * TreeT() const ;
178 virtual AliPHOSTrackSegmentMaker * TrackSegmentMaker() ;
179 virtual TString GetTracksFileName() const { return PhosLoader()->GetTracksFileName() ; }
180 virtual Int_t LoadTracks(Option_t* opt="") const { return PhosLoader()->LoadTracks(opt) ; }
181 virtual Int_t LoadTrackSegementMaker(Option_t* opt="") const {
88cb7938 182 return PhosLoader()->LoadTrackSegmentMaker(opt) ; }
66f895c8 183 virtual Int_t WriteTracks(Option_t* opt="") const { return PhosLoader()->WriteTracks(opt) ; }
184 virtual Int_t WriteTrackSegmentMaker(Option_t* opt="") const {
88cb7938 185 return PhosLoader()->WriteTracker(opt) ; }
95635748 186
fbf811ec 187 //========== RecParticles ===========
66f895c8 188 virtual TClonesArray * RecParticles() ;
189 virtual AliPHOSRecParticle * RecParticle(Int_t index) { return static_cast<AliPHOSRecParticle *>(RecParticles()->At(index)) ;}
190 virtual TTree * TreeP() const ;
191 virtual AliPHOSPID * PID() ;
192 virtual TString GetRecParticlesFileName() const { return PhosLoader()->GetRecParticlesFileName() ; }
193 virtual Int_t LoadRecParticles(Option_t* opt="") const { return PhosLoader()->LoadRecParticles(opt) ; }
194 virtual Int_t LoadPID(Option_t* opt="") const {
88cb7938 195 return PhosLoader()->LoadPID(opt) ; }
66f895c8 196 virtual Int_t WriteRecParticles(Option_t* opt="") const { return PhosLoader()->WriteRecParticles(opt) ; }
197 virtual Int_t WritePID(Option_t* opt="") const {
88cb7938 198 return PhosLoader()->WritePID(opt) ; }
a43c51c3 199
200 //========== Raw ===========
3cf4f75f 201 virtual Int_t ReadRaw(AliRawReader *rawReader) ;
a43c51c3 202
3b844b86 203 void SetDebug(Int_t level) {fgDebug = level;} // Set debug level
66f895c8 204 virtual void PostClusterizer(AliPHOSClusterizer * clu)
88cb7938 205 const{PhosLoader()->PostClusterizer(clu) ; }
66f895c8 206 virtual void PostPID(AliPHOSPID * pid)
88cb7938 207 const{PhosLoader()->PostPID(pid) ; }
66f895c8 208 virtual void PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tr)
88cb7938 209 const{PhosLoader()->PostTrackSegmentMaker(tr) ; }
66f895c8 210 virtual void PostSDigitizer (AliPHOSSDigitizer * sdigitizer)
88cb7938 211 const {PhosLoader()->PostSDigitizer(sdigitizer);}
66f895c8 212 virtual void PostDigitizer (AliPHOSDigitizer * digitizer)
bf6adc12 213 const {PhosLoader()->PostDigitizer(digitizer);}
95635748 214
66f895c8 215 virtual TString Version() const { return PhosLoader()->GetTitle() ; }
216 virtual AliPHOSLoader * PhosLoader() const { return fgPhosLoader ; }
217 virtual void Reset() ;
88cb7938 218
66f895c8 219 virtual AliESD * ESD() const { return fESD ; }
95635748 220
cb34a1fa 221private:
222
88cb7938 223 Int_t ReadTreeD(void) ;
fbf811ec 224 Int_t ReadTreeH(void) ;
88cb7938 225 Int_t ReadTreeR(void) ;
226 Int_t ReadTreeT(void) ;
227 Int_t ReadTreeS(void) ;
228 Int_t ReadTreeP(void) ;
677c8a30 229
230 Int_t ReadTreeE(Int_t event) ;
231 Bool_t OpenESDFile() ;
fbf811ec 232 void ReadPrimaries(void) ;
e4d04cf1 233
44ae287e 234 void FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Double_t & energy, Double_t & time) ;
235
236 Int_t CalibrateRaw (Double_t energy, Int_t *relId);
e4d04cf1 237
88cb7938 238private:
95635748 239
7bb289a7 240 AliPHOSBeamTestEvent * fBTE ; //! Header if BeamTest Event
88cb7938 241 static Int_t fgDebug ; //! Debug level
95635748 242
88cb7938 243 TString fLoadingStatus ; //! tells which trees are loaded
244 Int_t fNPrimaries ; //! # of primaries
245 TClonesArray * fPrimaries ; //! list of lists of primaries
95635748 246 TFile * fESDFile ; //! ESD file
247 TString fESDFileName ; //! ESD File Name
677c8a30 248 AliESD * fESD ; //! ESD object
249 TTree * fESDTree ; //! ESD Tree
66f895c8 250
44ae287e 251 Bool_t fRawDigits ; //! true is raw data
677c8a30 252
66f895c8 253 AliPHOSCalibrationDB * fcdb ; //!
7ca0684e 254 static AliPHOSCalibData * fCalibData;
ef868168 255 static AliPHOSAlignData * fAlignData;
7ca0684e 256
e957fea8 257 static AliPHOSLoader * fgPhosLoader ; // the loader for the NewIO
88cb7938 258
259 enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes};
66f895c8 260
261 protected:
262 static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton
95635748 263
264
4ae78bb1 265 ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
95635748 266
267 };
4ae78bb1 268
269#endif // AliPHOSGETTER_H