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