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