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