]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALGetter.h
Removed warnings
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGetter.h
1 #ifndef ALIEMCALGETTER_H
2 #define ALIEMCALGETTER_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 class TParticle ;
23 class TTree ; 
24
25 // --- Standard library ---
26
27 // --- AliRoot header files ---
28 #include "AliConfig.h" 
29
30 // #include "AliRun.h"
31 #include "AliEMCALHit.h"   
32 #include "AliEMCALRecParticle.h"
33 #include "AliEMCALDigitizer.h"
34 #include "AliEMCALSDigitizer.h" 
35 #include "AliEMCALLoader.h" 
36 class AliEMCAL ; 
37 class AliEMCALGeometry ; 
38 class AliEMCALClusterizer ; 
39 class AliEMCALRecPoint ; 
40 class AliEMCALTrackSegmentMaker ;
41 class AliEMCALTrackSegment ; 
42 class AliEMCALPID ; 
43 class AliEMCALBeamTestEvent ;
44
45
46 class AliEMCALGetter : public TObject {
47   
48  public:  
49   AliEMCALGetter(){    // ctor: this is a singleton, the ctor should never be called but cint needs it as public
50     Fatal("ctor", "AliEMCALGetter is a singleton default ctor not callable") ;
51   } 
52   AliEMCALGetter(const AliEMCALGetter & obj):TObject(obj) {
53     // cpy ctor requested by Coding Convention 
54     Fatal("cpy ctor", "not implemented") ;
55   } 
56   
57   AliEMCALGetter & operator = (const AliEMCALGetter & ) {
58     // assignement operator requested by coding convention, but not needed
59     Fatal("operator =", "not implemented") ;
60     return *this ; 
61   }
62   virtual ~AliEMCALGetter() ; 
63   
64   //=========== Instantiators ================
65   static AliEMCALGetter * Instance(const char* headerFile,
66                                   const char* version = AliConfig::fgkDefaultEventFolderName,
67                                   Option_t * openingOption = "READ" ) ; 
68   static AliEMCALGetter * Instance() ; 
69
70   static void Print() ; 
71   
72 //   //=========== General information about run ==============
73   Bool_t IsLoaded(TString tree) const { return fLoadingStatus.Contains(tree) ; } 
74   void   SetLoaded(TString tree) { fLoadingStatus += tree ; } 
75
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 ;
81   
82 //   //========== EMCALGeometry and EMCAL ============= 
83   AliEMCAL *         EMCAL() const  ;  
84   AliEMCALGeometry * EMCALGeometry() const ; 
85   
86 //   //========== Methods to read something from file ==========
87   void   Event(Int_t event, const char * opt = "HSDRP") ;    
88   void   Track(Int_t itrack) ;
89   
90 //   //-----------------now getter's data--------------------------------------
91 // //  AliEMCALCalibrationDB * CalibrationDB(){return  fcdb; }
92 // //  void ReadCalibrationDB(const char * name, const char * filename) ;
93
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, Int_t index=1) const ;  
100   
101 //   //=========== Hits =================
102 //   TTree *               TreeH(TString filename="") ; 
103   TClonesArray *  Hits(void) const  ; 
104   AliEMCALHit *    Hit(Int_t index) const { return dynamic_cast<AliEMCALHit*>(Hits()->At(index) );}
105   TTree *         TreeH() const ; 
106   
107   //=========== SDigits ==============
108   TClonesArray *      SDigits() const ;  
109   AliEMCALDigit *      SDigit(Int_t index) const { return static_cast<AliEMCALDigit *>(SDigits()->At(index)) ;} 
110   TTree *             TreeS() const ; 
111   AliEMCALSDigitizer * SDigitizer() ;  
112
113   TString             GetSDigitsFileName() const { return EmcalLoader()->GetSDigitsFileName() ; }  
114   Int_t               LoadSDigits(Option_t* opt="") const { return EmcalLoader()->LoadSDigits(opt) ; }
115   Int_t               LoadSDigitizer(Option_t* opt="") const { return  EmcalLoader()->LoadSDigitizer(opt) ; }
116   Int_t               WriteSDigits(Option_t* opt="") const { return EmcalLoader()->WriteSDigits(opt) ; }
117   Int_t               WriteSDigitizer(Option_t* opt="") const {
118     return  EmcalLoader()->WriteSDigitizer(opt) ; }
119   
120   //========== Digits ================
121   TClonesArray * Digits() const ;
122   AliEMCALDigit * Digit(Int_t index) const { return static_cast<AliEMCALDigit *>(Digits()->At(index)) ;} 
123   TTree *        TreeD() const ; 
124   AliEMCALDigitizer * Digitizer() ;
125   TString             GetDigitsFileName() const { return EmcalLoader()->GetDigitsFileName() ; }  
126   Int_t               LoadDigits(Option_t* opt="") const { return EmcalLoader()->LoadDigits(opt) ; }
127   Int_t               LoadDigitizer(Option_t* opt="") const {
128     return  EmcalLoader()->LoadDigitizer(opt) ; }
129   Int_t               WriteDigits(Option_t* opt="") const { return EmcalLoader()->WriteDigits(opt) ; }
130   Int_t               WriteDigitizer(Option_t* opt="") const {
131     return  EmcalLoader()->WriteDigitizer(opt) ; }
132   
133   //========== RecPoints =============
134   TObjArray *             ECARecPoints() const;
135   AliEMCALRecPoint * ECARecPoint(Int_t index) const{ return static_cast<AliEMCALRecPoint *>(ECARecPoints()->At(index)) ;}    
136   TTree *                 TreeR() const ;
137   AliEMCALClusterizer *   Clusterizer()  ;
138   TString                 GetRecPointsFileName() const { return EmcalLoader()->GetRecPointsFileName() ; } 
139   Int_t                   LoadRecPoints(Option_t* opt="") const { return EmcalLoader()->LoadRecPoints(opt) ; }
140   Int_t                   LoadClusterizer(Option_t* opt="") const {
141     return  EmcalLoader()->LoadClusterizer(opt) ; }
142   Int_t                   WriteRecPoints(Option_t* opt="") const { return EmcalLoader()->WriteRecPoints(opt) ; }
143   Int_t                   WriteClusterizer(Option_t* opt="") const {
144     return  EmcalLoader()->WriteClusterizer(opt) ; }
145
146   //========== TrackSegments   TClonesArray * TrackSegments(const char * name = 0) { 
147   TClonesArray *           TrackSegments() const ;
148   AliEMCALTrackSegment *  TrackSegments(Int_t index) const { return static_cast<AliEMCALTrackSegment *>(TrackSegments()->At(index)) ;} 
149   TTree *               TreeT() const ;
150   AliEMCALTrackSegmentMaker * TrackSegmentMaker() ;
151   TString               GetTracksFileName() const { return EmcalLoader()->GetTracksFileName() ; } 
152   Int_t                 LoadTracks(Option_t* opt="") const { return EmcalLoader()->LoadTracks(opt) ; }
153   Int_t                 LoadTrackSegementMaker(Option_t* opt="") const {
154     return  EmcalLoader()->LoadTrackSegmentMaker(opt) ; }
155   Int_t                 WriteTracks(Option_t* opt="") const { return EmcalLoader()->WriteTracks(opt) ; }
156   Int_t                 WriteTrackSegmentMaker(Option_t* opt="") const {
157     return  EmcalLoader()->WriteTracker(opt) ; }
158   //========== RecParticles ===========
159
160   TClonesArray *         RecParticles() const ;
161   AliEMCALRecParticle *  RecParticle(Int_t index) const { return static_cast<AliEMCALRecParticle *>(RecParticles()->At(index)) ;} 
162   TTree *               TreeP() const ;
163   AliEMCALPID * PID() ;
164   TString               GetRecParticlesFileName() const { return EmcalLoader()->GetRecParticlesFileName() ; } 
165   Int_t                 LoadRecParticles(Option_t* opt="") const { return EmcalLoader()->LoadRecParticles(opt) ; }
166   Int_t                 LoadPID(Option_t* opt="") const {
167     return  EmcalLoader()->LoadPID(opt) ; }
168   Int_t                 WriteRecParticles(Option_t* opt="") const { return EmcalLoader()->WriteRecParticles(opt) ; }
169   Int_t                 WritePID(Option_t* opt="") const {
170     return  EmcalLoader()->WritePID(opt) ; }
171
172
173   void SetDebug(Int_t level) {fgDebug = level;} // Set debug level 
174     void PostClusterizer(AliEMCALClusterizer * clu) 
175     const{EmcalLoader()->PostClusterizer(clu) ; }
176   void PostPID(AliEMCALPID * pid) 
177     const{EmcalLoader()->PostPID(pid) ; }
178   void PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tr) 
179     const{EmcalLoader()->PostTrackSegmentMaker(tr) ; }
180   void PostSDigitizer (AliEMCALSDigitizer * sdigitizer) 
181     const {EmcalLoader()->PostSDigitizer(sdigitizer);}    
182   void PostDigitizer (AliEMCALDigitizer * digitizer)    
183     const {EmcalLoader()->PostDigitizer(dynamic_cast<AliDigitizer *>(digitizer));}
184
185   TString Version() const  { return EmcalLoader()->GetTitle() ; } 
186   AliEMCALLoader * EmcalLoader() const { return  fgEmcalLoader ; }
187   void Reset() ;  
188
189 private:
190   
191   AliEMCALGetter(const char* headerFile,
192                 const char* version = AliConfig::fgkDefaultEventFolderName,
193                 Option_t * openingOption = "READ") ;
194
195   Int_t ReadTreeD(void) ;
196   Int_t ReadTreeH(void) ;
197   Int_t ReadTreeR(void) ;
198   Int_t ReadTreeT(void) ;
199   Int_t ReadTreeS(void) ;
200   Int_t ReadTreeP(void) ;
201
202
203   void ReadPrimaries(void) ;
204
205 private:
206
207 //   static TFile * fgFile;           //! 
208
209 //  AliEMCALBeamTestEvent * fBTE ;           //! Header if BeamTest Event
210
211   static Int_t          fgDebug ;             //! Debug level
212
213   TString           fLoadingStatus ;     //! tells which trees are loaded
214   Int_t             fNPrimaries ;        //! # of primaries  
215   TClonesArray *    fPrimaries ;         //! list of lists of primaries
216
217 //  AliEMCALCalibrationDB * fcdb ;       //!
218    
219   static AliEMCALLoader * fgEmcalLoader ; // pointer to EMCAL Loader
220   static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton 
221   
222   enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes};
223
224
225   ClassDef(AliEMCALGetter,3)  // Algorithm class that provides methods to retrieve objects from a list knowing the index 
226
227 };
228
229 #endif // AliEMCALGETTER_H