]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PHOS/AliPHOSGetter.h
Correcting for disappearance of kPI
[u/mrichter/AliRoot.git] / PHOS / AliPHOSGetter.h
... / ...
CommitLineData
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 ---
20#include "TObject.h"
21#include "TClonesArray.h"
22// #include "TFolder.h"
23// #include "TTree.h"
24// #include "TFile.h"
25// class TString ;
26 class TParticle ;
27// class TTask ;
28
29// --- Standard library ---
30
31// --- AliRoot header files ---
32#include "AliConfig.h"
33
34// #include "AliRun.h"
35class AliPHOS ;
36#include "AliPHOSHit.h"
37
38class AliPHOSGeometry ;
39#include "AliPHOSDigitizer.h"
40#include "AliPHOSSDigitizer.h"
41// //class AliPHOSCalibrationDB ;
42// class AliPHOSConTableDB ;
43class AliPHOSBeamTestEvent ;
44
45#include "AliPHOSLoader.h"
46
47class AliPHOSGetter : public TObject {
48
49 public:
50 AliPHOSGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public
51 Fatal("ctor", "AliPHOSGetter is a singleton default ctor not callable") ;
52 }
53 AliPHOSGetter(const AliPHOSGetter & obj) {
54 // cpy ctor requested by Coding Convention
55 Fatal("cpy ctor", "not implemented") ;
56 }
57
58 AliPHOSGetter & operator = (const AliPHOSGetter & ) {
59 // assignement operator requested by coding convention, but not needed
60 Fatal("operator =", "not implemented") ;
61 return *this ;
62 }
63 virtual ~AliPHOSGetter() ;
64
65 //=========== Instantiators ================
66 static AliPHOSGetter * Instance(const char* headerFile,
67 const char* version = AliConfig::fgkDefaultEventFolderName,
68 Option_t * openingOption = "READ" ) ;
69 static AliPHOSGetter * Instance() ;
70
71 static void Print() ;
72
73// //=========== General information about run ==============
74 Bool_t IsLoaded(const TString tree) const { return fLoadingStatus.Contains(tree) ; }
75 void SetLoaded(const TString tree) { fLoadingStatus += tree ; }
76
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 ;
82
83// //========== PHOSGeometry and PHOS =============
84 AliPHOS * PHOS() const ;
85 AliPHOSGeometry * PHOSGeometry() const ;
86
87// //========== Methods to read something from file ==========
88 void Event(const Int_t event, const char * opt = "HSDRP") ;
89 void Track(const Int_t itrack) ;
90
91// //-----------------now getter's data--------------------------------------
92// // AliPHOSCalibrationDB * CalibrationDB(){return fcdb; }
93// // void ReadCalibrationDB(const char * name, const char * filename) ;
94
95 //=========== Primaries ============
96// TTree * TreeK(TString filename="") ;
97 TClonesArray * Primaries(void) ;
98 TParticle * Primary(Int_t index) const ;
99 Int_t NPrimaries()const { return fNPrimaries; }
100 TParticle * Secondary(const TParticle * p, const Int_t index=1) const ;
101
102// //=========== Hits =================
103// TTree * TreeH(TString filename="") ;
104 TClonesArray * Hits(void) ;
105 AliPHOSHit * Hit(const Int_t index) { return dynamic_cast<AliPHOSHit*>(Hits()->At(index) );}
106 TTree * TreeH() const ;
107
108 //=========== SDigits ==============
109 TClonesArray * SDigits() ;
110 AliPHOSDigit * SDigit(const Int_t index) { return static_cast<AliPHOSDigit *>(SDigits()->At(index)) ;}
111 TTree * TreeS() const ;
112 AliPHOSSDigitizer * SDigitizer() ;
113
114 TString GetSDigitsFileName() { return PhosLoader()->GetSDigitsFileName() ; }
115 Int_t LoadSDigits(Option_t* opt="") { return PhosLoader()->LoadSDigits(opt) ; }
116 Int_t LoadSDigitizer(Option_t* opt=""){ return PhosLoader()->LoadSDigitizer(opt) ; }
117 Int_t WriteSDigits(Option_t* opt="") { return PhosLoader()->WriteSDigits(opt) ; }
118 Int_t WriteSDigitizer(Option_t* opt=""){
119 return PhosLoader()->WriteSDigitizer(opt) ; }
120
121 //========== Digits ================
122 TClonesArray * Digits() ;
123 AliPHOSDigit * Digit(const Int_t index) { return static_cast<AliPHOSDigit *>(Digits()->At(index)) ;}
124 TTree * TreeD() const ;
125 AliPHOSDigitizer * Digitizer() ;
126 TString GetDigitsFileName() { return PhosLoader()->GetDigitsFileName() ; }
127 Int_t LoadDigits(Option_t* opt="") { return PhosLoader()->LoadDigits(opt) ; }
128 Int_t LoadDigitizer(Option_t* opt=""){
129 return PhosLoader()->LoadDigitizer(opt) ; }
130 Int_t WriteDigits(Option_t* opt="") { return PhosLoader()->WriteDigits(opt) ; }
131 Int_t WriteDigitizer(Option_t* opt=""){
132 return PhosLoader()->WriteDigitizer(opt) ; }
133
134 //========== RecPoints =============
135 TObjArray * EmcRecPoints() ;
136 AliPHOSEmcRecPoint * EmcRecPoint(const Int_t index) { return static_cast<AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ;}
137 TObjArray * CpvRecPoints() ;
138 AliPHOSCpvRecPoint * CpvRecPoint(const Int_t index) { return static_cast<AliPHOSCpvRecPoint *>(CpvRecPoints()->At(index)) ;}
139 TTree * TreeR() const ;
140 AliPHOSClusterizer * Clusterizer() ;
141 TString GetRecPointsFileName() { return PhosLoader()->GetRecPointsFileName() ; }
142 Int_t LoadRecPoints(Option_t* opt="") { return PhosLoader()->LoadRecPoints(opt) ; }
143 Int_t LoadClusterizer(Option_t* opt=""){
144 return PhosLoader()->LoadClusterizer(opt) ; }
145 Int_t WriteRecPoints(Option_t* opt="") { return PhosLoader()->WriteRecPoints(opt) ; }
146 Int_t WriteClusterizer(Option_t* opt=""){
147 return PhosLoader()->WriteClusterizer(opt) ; }
148
149 //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) {
150 TClonesArray * TrackSegments() ;
151 AliPHOSTrackSegment * TrackSegments(const Int_t index) { return static_cast<AliPHOSTrackSegment *>(TrackSegments()->At(index)) ;}
152 TTree * TreeT() const ;
153 AliPHOSTrackSegmentMaker * TrackSegmentMaker() ;
154 TString GetTracksFileName() { return PhosLoader()->GetTracksFileName() ; }
155 Int_t LoadTracks(Option_t* opt="") { return PhosLoader()->LoadTracks(opt) ; }
156 Int_t LoadTrackSegementMaker(Option_t* opt=""){
157 return PhosLoader()->LoadTrackSegmentMaker(opt) ; }
158 Int_t WriteTracks(Option_t* opt="") { return PhosLoader()->WriteTracks(opt) ; }
159 Int_t WriteTrackSegmentMaker(Option_t* opt=""){
160 return PhosLoader()->WriteTracker(opt) ; }
161 //========== RecParticles ===========
162
163 TClonesArray * RecParticles() ;
164 AliPHOSRecParticle * RecPaticles(const Int_t index) { return static_cast<AliPHOSRecParticle *>(RecParticles()->At(index)) ;}
165 TTree * TreeP() const ;
166 AliPHOSPID * PID() ;
167 TString GetRecParticlesFileName() { return PhosLoader()->GetRecParticlesFileName() ; }
168 Int_t LoadRecParticles(Option_t* opt="") { return PhosLoader()->LoadRecParticles(opt) ; }
169 Int_t LoadPID(Option_t* opt=""){
170 return PhosLoader()->LoadPID(opt) ; }
171 Int_t WriteRecParticles(Option_t* opt="") { return PhosLoader()->WriteRecParticles(opt) ; }
172 Int_t WritePID(Option_t* opt=""){
173 return PhosLoader()->WritePID(opt) ; }
174
175
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));}
187
188 TString Version() const { return PhosLoader()->GetTitle() ; }
189 AliPHOSLoader * PhosLoader() const { return fgPhosLoader ; }
190
191private:
192
193 AliPHOSGetter(const char* headerFile,
194 const char* version = AliConfig::fgkDefaultEventFolderName,
195 Option_t * openingOption = "READ") ;
196
197 Int_t ReadTreeD(void) ;
198 Int_t ReadTreeH(void) ;
199 Int_t ReadTreeR(void) ;
200 Int_t ReadTreeT(void) ;
201 Int_t ReadTreeS(void) ;
202 Int_t ReadTreeP(void) ;
203
204
205 void ReadPrimaries(void) ;
206
207private:
208
209// static TFile * fgFile; //!
210
211 AliPHOSBeamTestEvent * fBTE ; //! Header if BeamTest Event
212
213 static Int_t fgDebug ; //! Debug level
214
215 TString fLoadingStatus ; //! tells which trees are loaded
216 Int_t fNPrimaries ; //! # of primaries
217 TClonesArray * fPrimaries ; //! list of lists of primaries
218
219// AliPHOSCalibrationDB * fcdb ; //!
220
221 static AliPHOSLoader * fgPhosLoader ;
222 static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton
223
224 enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes};
225
226
227 ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
228
229};
230
231#endif // AliPHOSGETTER_H