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