Coding rule violations corrected.
[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"
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 ;
4ae78bb1 28
29// --- Standard library ---
30
31// --- AliRoot header files ---
88cb7938 32#include "AliConfig.h"
33
34// #include "AliRun.h"
35class AliPHOS ;
36#include "AliPHOSHit.h"
4ae78bb1 37
4ae78bb1 38class AliPHOSGeometry ;
88cb7938 39#include "AliPHOSDigitizer.h"
40#include "AliPHOSSDigitizer.h"
41// //class AliPHOSCalibrationDB ;
42// class AliPHOSConTableDB ;
7bb289a7 43class AliPHOSBeamTestEvent ;
4ae78bb1 44
88cb7938 45#include "AliPHOSLoader.h"
46
4ae78bb1 47class AliPHOSGetter : public TObject {
48
88cb7938 49 public:
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,
67 const char* version = AliConfig::fgkDefaultEventFolderName,
68 Option_t * openingOption = "READ" ) ;
69 static AliPHOSGetter * Instance() ;
70
71 static void Print() ;
548f0134 72
88cb7938 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 ;
b0bba0af 82
88cb7938 83// //========== PHOSGeometry and PHOS =============
84 AliPHOS * PHOS() const ;
85 AliPHOSGeometry * PHOSGeometry() const ;
548f0134 86
88cb7938 87// //========== Methods to read something from file ==========
fbf811ec 88 void Event(const Int_t event, const char * opt = "HSDRP") ;
89 void Track(const Int_t itrack) ;
548f0134 90
88cb7938 91// //-----------------now getter's data--------------------------------------
92// // AliPHOSCalibrationDB * CalibrationDB(){return fcdb; }
93// // void ReadCalibrationDB(const char * name, const char * filename) ;
7bb289a7 94
fbf811ec 95 //=========== Primaries ============
88cb7938 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 ;
cb34a1fa 107
fbf811ec 108 //=========== SDigits ==============
88cb7938 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) ; }
548f0134 120
fbf811ec 121 //========== Digits ================
88cb7938 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) ; }
cb34a1fa 133
fbf811ec 134 //========== RecPoints =============
88cb7938 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) ; }
fbf811ec 161 //========== RecParticles ===========
fbf811ec 162
88cb7938 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
cb34a1fa 191private:
192
88cb7938 193 AliPHOSGetter(const char* headerFile,
194 const char* version = AliConfig::fgkDefaultEventFolderName,
195 Option_t * openingOption = "READ") ;
196
197 Int_t ReadTreeD(void) ;
fbf811ec 198 Int_t ReadTreeH(void) ;
88cb7938 199 Int_t ReadTreeR(void) ;
200 Int_t ReadTreeT(void) ;
201 Int_t ReadTreeS(void) ;
202 Int_t ReadTreeP(void) ;
203
204
fbf811ec 205 void ReadPrimaries(void) ;
88cb7938 206
207private:
208
209// static TFile * fgFile; //!
210
7bb289a7 211 AliPHOSBeamTestEvent * fBTE ; //! Header if BeamTest Event
88cb7938 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
c2cd5471 218
7bb289a7 219// AliPHOSCalibrationDB * fcdb ; //!
9bd3caba 220
88cb7938 221 static AliPHOSLoader * fgPhosLoader ;
b0bba0af 222 static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton
88cb7938 223
224 enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes};
225
4ae78bb1 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