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