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