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 */
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.
14 // The objects are retrived from folders.
15 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
19 // --- ROOT system ---
20 #include "TClonesArray.h"
27 // --- Standard library ---
31 // --- AliRoot header files ---
34 #include "AliEMCALv1.h"
35 #include "AliEMCALHit.h"
36 #include "AliEMCALDigit.h"
37 #include "AliEMCALDigitizer.h"
38 #include "AliEMCALSDigitizer.h"
39 class AliEMCALGeometry ;
40 //class AliEMCALEmcRecPoint ;
41 //class AliEMCALCpvRecPoint ;
42 //class AliEMCALClusterizer ;
43 //class AliEMCALTrackSegment ;
44 //class AliEMCALTrackSegmentMaker ;
45 //class AliEMCALRecParticle ;
48 class AliEMCALGetter : public TObject {
53 // ctor: this is a singleton, the ctor should never be called but cint needs it as public
54 cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ;
57 AliEMCALGetter(const AliEMCALGetter & obj) {
58 // cpy ctor requested by Coding Convention
63 virtual ~AliEMCALGetter() ;
65 Bool_t PostHits(void ) const ;
66 Bool_t PostSDigits( const char * name, const char * file = 0) const ;
67 Bool_t PostDigits( const char * name ) const ;
68 //Bool_t PostRecPoints( const char * name ) const ;
69 //Bool_t PostTrackSegments(const char * name) const ;
70 //Bool_t PostRecParticles( const char * name) const ;
72 //Bool_t PostClusterizer( const char * name) const ;
73 //Bool_t PostClusterizer(AliEMCALClusterizer * clu) const ;
74 Bool_t PostSDigitizer (AliEMCALSDigitizer * sdigitizer) const ;
75 Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
76 Bool_t PostDigitizer (AliEMCALDigitizer * digitizer) const ;
77 Bool_t PostDigitizer ( const char * name) const ;
78 //Bool_t PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsm) const ;
79 //Bool_t PostTrackSegmentMaker(const char * name ) const ;
80 //Bool_t PostPID (AliEMCALPID * pid) const ;
81 //Bool_t PostPID (const char * name ) const ;
82 //Bool_t PostQA (void) const ;
85 void Event(const Int_t event, const char * opt = "HSD") ;
86 void Track(Int_t itrack) ;
88 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
89 void ReadTreeS(TTree * treeS,Int_t input) ;
91 Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
92 Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
93 static AliEMCALGetter * GetInstance(const char* headerFile,
94 const char* branchTitle = "Default", const Option_t * rw="" ) ;
95 static AliEMCALGetter * GetInstance() ;
97 const AliEMCALv1 * EMCAL() ;
98 const AliEMCALGeometry * EMCALGeometry() ;
100 //TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)) ; }
101 //TObjArray * Alarms(const char * name ) const { return (TObjArray*)(ReturnO("Alarms", name)) ; }
104 //TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
107 TClonesArray * Primaries(void) const { return (TClonesArray*)(ReturnO("Primaries")) ; }
111 const TClonesArray * Hits(void) { return static_cast<const TClonesArray*>(ReturnO("Hits")) ; }
112 const AliEMCALHit * Hit(Int_t index) { return static_cast<const AliEMCALHit*>(Hits()->At(index) );}
115 TClonesArray * SDigits(const char * name = 0, const char * file=0) {
116 return static_cast<TClonesArray*>(ReturnO("SDigits", name, file)) ;
118 const AliEMCALDigit * SDigit(Int_t index) { return static_cast<const AliEMCALDigit*>(SDigits()->At(index)) ;}
120 AliEMCALSDigitizer * SDigitizer(const char * name =0) const {
121 return ((AliEMCALSDigitizer*)(ReturnT("SDigitizer", name))) ;
125 TClonesArray * Digits(const char * name = 0)const {
126 return static_cast<TClonesArray*>(ReturnO("Digits", name)) ;
128 const AliEMCALDigit * Digit(Int_t index) { return static_cast<const AliEMCALDigit *>(Digits()->At(index)) ;}
129 AliEMCALDigitizer * Digitizer(const char * name =0) const {
130 return (AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ;
134 //TObjArray * EmcRecPoints(const char * name = 0) const {
135 // return (TObjArray*)(ReturnO("EmcRecPoints", name)) ; }
136 //TObjArray * CpvRecPoints(const char * name = 0) const {
137 // return (TObjArray*)(ReturnO("CpvRecPoints", name)) ; }
139 //AliEMCALClusterizer * Clusterizer (const char * name =0) const
140 // { return (AliEMCALClusterizer*)(ReturnT("Clusterizer", name)) ; }
143 //TClonesArray * TrackSegments(const char * name = 0) const
144 // { return (TClonesArray*)(ReturnO("TrackSegments", name)) ; }
145 //AliEMCALTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const
146 // { return (AliEMCALTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; }
149 //TClonesArray * RecParticles(const char * name = 0) const
150 // { return (TClonesArray*)(ReturnO("RecParticles", name)) ; }
151 //AliEMCALPID * PID(const char * name =0) const
152 // { return (AliEMCALPID*)(ReturnT("PID", name)) ; }
155 const TParticle * Primary(Int_t index) const ;
156 const Int_t NPrimaries()const { return fNPrimaries; }
158 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
160 AliEMCALGetter & operator = (const AliEMCALGetter & ) {
161 // assignement operator requested by coding convention, but not needed
166 TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; }
170 AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default", const Option_t * rw ="") ;
171 void CreateWhiteBoard() const ;
172 TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
173 const TTask * ReturnT(TString what,TString name=0) const ;
174 void DefineBranchTitles(char* branch, char* branchTitle) ;
178 void ReadTreeS(Int_t event) ;
179 //void ReadTreeQA() ;
180 void ReadPrimaries() ;
182 TObject ** HitsRef(void) const ;
183 TObject ** SDigitsRef(const char * name, const char * file = 0 ) const;
184 TObject ** DigitsRef (const char * name) const ;
185 //TObject ** EmcRecPointsRef (const char * name) const ;
186 //TObject ** CpvRecPointsRef (const char * name) const ;
187 //TObject ** TrackSegmentsRef(const char * name) const ;
188 //TObject ** RecParticlesRef (const char * name) const ;
189 //TObject ** AlarmsRef (void) const ;
191 TObject ** SDigitizerRef (const char * name) const ;
192 TObject ** DigitizerRef (const char * name) const ;
193 //TObject ** ClusterizerRef(const char * name) const ;
194 //TObject ** TSMakerRef (const char * name) const ;
195 //TObject ** PIDRef (const char * name) const ;
199 TString fHeaderFile ; //! File in which gAlice lives
200 TString fBranchTitle ; //!
201 //TString fTrackSegmentsTitle ;//!
202 //TString fRecPointsTitle ; //!
203 //TString fRecParticlesTitle ; //!
204 TString fDigitsTitle ; //!
205 TString fSDigitsTitle ; //!
207 Int_t fDebug ; // Debug level
209 Int_t fNPrimaries ; //! # of primaries
211 TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
213 TFolder * fModuleFolder ; //!Folder that contains the modules
214 TFolder * fHitsFolder ; //!Folder that contains the Hits
215 TFolder * fSDigitsFolder ; //!Folder that contains the SDigits
216 TFolder * fDigitsFolder ; //!Folder that contains the Digits
217 //TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles)
218 //TFolder * fQAFolder ; //!Folder that contains the QA objects
219 TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner)
221 static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton
223 ClassDef(AliEMCALGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
227 #endif // AliEMCALGETTER_H