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 */
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.
14 // The objects are retrived from folders.
15 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
19 // --- ROOT system ---
24 // --- Standard library ---
26 // --- AliRoot header files ---
27 #include "AliConfig.h"
29 // #include "AliRun.h"
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"
37 #include "AliPHOSDigitizer.h"
38 #include "AliPHOSSDigitizer.h"
40 class AliPHOSGeometry ;
41 class AliPHOSClusterizer ;
42 class AliPHOSTrackSegmentMaker ;
44 class AliPHOSBeamTestEvent ;
46 class AliPHOSGetter : public TObject {
49 AliPHOSGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public
50 Fatal("ctor", "AliPHOSGetter is a singleton default ctor not callable") ;
52 AliPHOSGetter(const AliPHOSGetter & obj) : TObject(obj) {
53 // cpy ctor requested by Coding Convention
54 Fatal("cpy ctor", "not implemented") ;
57 AliPHOSGetter & operator = (const AliPHOSGetter & ) {
58 // assignement operator requested by coding convention, but not needed
59 Fatal("operator =", "not implemented") ;
62 virtual ~AliPHOSGetter() ;
64 //=========== Instantiators ================
65 static AliPHOSGetter * Instance(const char* headerFile,
66 const char* version = AliConfig::fgkDefaultEventFolderName,
67 Option_t * openingOption = "READ" ) ;
68 static AliPHOSGetter * Instance() ;
72 // //=========== General information about run ==============
73 Bool_t IsLoaded(const TString tree) const { return fLoadingStatus.Contains(tree) ; }
74 void SetLoaded(const TString tree) { fLoadingStatus += tree ; }
76 Int_t MaxEvent() const ;
77 Int_t EventNumber() const ;
78 Bool_t VersionExists(TString & opt) const ;
79 UShort_t EventPattern(void) const ;
80 Float_t BeamEnergy(void) const ;
82 // //========== PHOSGeometry and PHOS =============
83 AliPHOS * PHOS() const ;
84 AliPHOSGeometry * PHOSGeometry() const ;
86 // //========== Methods to read something from file ==========
87 void Event(const Int_t event, const char * opt = "HSDRP") ;
88 void Track(const Int_t itrack) ;
90 // //-----------------now getter's data--------------------------------------
91 // // AliPHOSCalibrationDB * CalibrationDB(){return fcdb; }
92 // // void ReadCalibrationDB(const char * name, const char * filename) ;
94 //=========== Primaries ============
95 // TTree * TreeK(TString filename="") ;
96 TClonesArray * Primaries(void) ;
97 TParticle * Primary(Int_t index) const ;
98 Int_t NPrimaries()const { return fNPrimaries; }
99 TParticle * Secondary(const TParticle * p, const Int_t index=1) const ;
101 // //=========== Hits =================
102 // TTree * TreeH(TString filename="") ;
103 TClonesArray * Hits(void) ;
104 AliPHOSHit * Hit(const Int_t index) { return dynamic_cast<AliPHOSHit*>(Hits()->At(index) );}
105 TTree * TreeH() const ;
107 //=========== SDigits ==============
108 TClonesArray * SDigits() ;
109 AliPHOSDigit * SDigit(const Int_t index) { return static_cast<AliPHOSDigit *>(SDigits()->At(index)) ;}
110 TTree * TreeS() const ;
111 AliPHOSSDigitizer * SDigitizer() ;
113 TString GetSDigitsFileName() const { return PhosLoader()->GetSDigitsFileName() ; }
114 Int_t LoadSDigits(Option_t* opt="") const { return PhosLoader()->LoadSDigits(opt) ; }
115 Int_t LoadSDigitizer(Option_t* opt="") const { return PhosLoader()->LoadSDigitizer(opt) ; }
116 Int_t WriteSDigits(Option_t* opt="") const { return PhosLoader()->WriteSDigits(opt) ; }
117 Int_t WriteSDigitizer(Option_t* opt="") const {
118 return PhosLoader()->WriteSDigitizer(opt) ; }
120 //========== Digits ================
121 TClonesArray * Digits() ;
122 AliPHOSDigit * Digit(const Int_t index) { return static_cast<AliPHOSDigit *>(Digits()->At(index)) ;}
123 TTree * TreeD() const ;
124 AliPHOSDigitizer * Digitizer() ;
125 TString GetDigitsFileName() const { return PhosLoader()->GetDigitsFileName() ; }
126 Int_t LoadDigits(Option_t* opt="") const { return PhosLoader()->LoadDigits(opt) ; }
127 Int_t LoadDigitizer(Option_t* opt="") const {
128 return PhosLoader()->LoadDigitizer(opt) ; }
129 Int_t WriteDigits(Option_t* opt="") const { return PhosLoader()->WriteDigits(opt) ; }
130 Int_t WriteDigitizer(Option_t* opt="") const {
131 return PhosLoader()->WriteDigitizer(opt) ; }
133 //========== RecPoints =============
134 TObjArray * EmcRecPoints() ;
135 AliPHOSEmcRecPoint * EmcRecPoint(const Int_t index) { return static_cast<AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ;}
136 TObjArray * CpvRecPoints() ;
137 AliPHOSCpvRecPoint * CpvRecPoint(const Int_t index) { return static_cast<AliPHOSCpvRecPoint *>(CpvRecPoints()->At(index)) ;}
138 TTree * TreeR() const ;
139 AliPHOSClusterizer * Clusterizer() ;
140 TString GetRecPointsFileName() const { return PhosLoader()->GetRecPointsFileName() ; }
141 Int_t LoadRecPoints(Option_t* opt="") const { return PhosLoader()->LoadRecPoints(opt) ; }
142 Int_t LoadClusterizer(Option_t* opt="") const {
143 return PhosLoader()->LoadClusterizer(opt) ; }
144 Int_t WriteRecPoints(Option_t* opt="") const { return PhosLoader()->WriteRecPoints(opt) ; }
145 Int_t WriteClusterizer(Option_t* opt="") const {
146 return PhosLoader()->WriteClusterizer(opt) ; }
148 //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) {
149 TClonesArray * TrackSegments() ;
150 AliPHOSTrackSegment * TrackSegments(const Int_t index) { return static_cast<AliPHOSTrackSegment *>(TrackSegments()->At(index)) ;}
151 TTree * TreeT() const ;
152 AliPHOSTrackSegmentMaker * TrackSegmentMaker() ;
153 TString GetTracksFileName() const { return PhosLoader()->GetTracksFileName() ; }
154 Int_t LoadTracks(Option_t* opt="") const { return PhosLoader()->LoadTracks(opt) ; }
155 Int_t LoadTrackSegementMaker(Option_t* opt="") const {
156 return PhosLoader()->LoadTrackSegmentMaker(opt) ; }
157 Int_t WriteTracks(Option_t* opt="") const { return PhosLoader()->WriteTracks(opt) ; }
158 Int_t WriteTrackSegmentMaker(Option_t* opt="") const {
159 return PhosLoader()->WriteTracker(opt) ; }
160 //========== RecParticles ===========
162 TClonesArray * RecParticles() ;
163 AliPHOSRecParticle * RecPaticles(const Int_t index) { return static_cast<AliPHOSRecParticle *>(RecParticles()->At(index)) ;}
164 TTree * TreeP() const ;
166 TString GetRecParticlesFileName() const { return PhosLoader()->GetRecParticlesFileName() ; }
167 Int_t LoadRecParticles(Option_t* opt="") const { return PhosLoader()->LoadRecParticles(opt) ; }
168 Int_t LoadPID(Option_t* opt="") const {
169 return PhosLoader()->LoadPID(opt) ; }
170 Int_t WriteRecParticles(Option_t* opt="") const { return PhosLoader()->WriteRecParticles(opt) ; }
171 Int_t WritePID(Option_t* opt="") const {
172 return PhosLoader()->WritePID(opt) ; }
175 void SetDebug(Int_t level) {fgDebug = level;} // Set debug level
176 void PostClusterizer(AliPHOSClusterizer * clu)
177 const{PhosLoader()->PostClusterizer(clu) ; }
178 void PostPID(AliPHOSPID * pid)
179 const{PhosLoader()->PostPID(pid) ; }
180 void PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tr)
181 const{PhosLoader()->PostTrackSegmentMaker(tr) ; }
182 void PostSDigitizer (AliPHOSSDigitizer * sdigitizer)
183 const {PhosLoader()->PostSDigitizer(sdigitizer);}
184 void PostDigitizer (AliPHOSDigitizer * digitizer)
185 const {PhosLoader()->PostDigitizer(dynamic_cast<AliDigitizer *>(digitizer));}
187 TString Version() const { return PhosLoader()->GetTitle() ; }
188 AliPHOSLoader * PhosLoader() const { return fgPhosLoader ; }
192 AliPHOSGetter(const char* headerFile,
193 const char* version = AliConfig::fgkDefaultEventFolderName,
194 Option_t * openingOption = "READ") ;
196 Int_t ReadTreeD(void) ;
197 Int_t ReadTreeH(void) ;
198 Int_t ReadTreeR(void) ;
199 Int_t ReadTreeT(void) ;
200 Int_t ReadTreeS(void) ;
201 Int_t ReadTreeP(void) ;
204 void ReadPrimaries(void) ;
208 // static TFile * fgFile; //!
210 AliPHOSBeamTestEvent * fBTE ; //! Header if BeamTest Event
212 static Int_t fgDebug ; //! Debug level
214 TString fLoadingStatus ; //! tells which trees are loaded
215 Int_t fNPrimaries ; //! # of primaries
216 TClonesArray * fPrimaries ; //! list of lists of primaries
218 // AliPHOSCalibrationDB * fcdb ; //!
220 static AliPHOSLoader * fgPhosLoader ; // the loader for the NewIO
221 static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton
223 enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes};
226 ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
230 #endif // AliPHOSGETTER_H