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 #include "AliEMCALTowerRecPoint.h"
40 class AliEMCALGeometry ;
41 class AliEMCALClusterizer ;
42 //class AliEMCALTrackSegment ;
43 //class AliEMCALTrackSegmentMaker ;
44 //class AliEMCALRecParticle ;
47 class AliEMCALGetter : public TObject {
52 // ctor: this is a singleton, the ctor should never be called but cint needs it as public
53 cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ;
56 AliEMCALGetter(const AliEMCALGetter & obj) {
57 // cpy ctor requested by Coding Convention
62 virtual ~AliEMCALGetter() ;
64 Bool_t PostHits(void ) const ;
65 Bool_t PostSDigits( const char * name, const char * file = 0) const ;
66 Bool_t PostDigits( const char * name ) const ;
67 Bool_t PostRecPoints( const char * name ) const ;
68 //Bool_t PostTrackSegments(const char * name) const ;
69 //Bool_t PostRecParticles( const char * name) const ;
71 Bool_t PostClusterizer( const char * name) const ;
72 Bool_t PostClusterizer(AliEMCALClusterizer * clu) const ;
73 Bool_t PostSDigitizer (AliEMCALSDigitizer * sdigitizer) const ;
74 Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
75 Bool_t PostDigitizer (AliEMCALDigitizer * digitizer) const ;
76 Bool_t PostDigitizer ( const char * name) const ;
77 //Bool_t PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsm) const ;
78 //Bool_t PostTrackSegmentMaker(const char * name ) const ;
79 //Bool_t PostPID (AliEMCALPID * pid) const ;
80 //Bool_t PostPID (const char * name ) const ;
81 //Bool_t PostQA (void) const ;
84 void Event(const Int_t event, const char * opt = "HSDR") ;
85 void Track(Int_t itrack) ;
87 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
88 void ReadTreeS(TTree * treeS,Int_t input) ;
90 Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
91 Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
92 static AliEMCALGetter * GetInstance(const char* headerFile,
93 const char* branchTitle = "Default", const Option_t * rw="" ) ;
94 static AliEMCALGetter * GetInstance() ;
96 const AliEMCALv1 * EMCAL() ;
97 AliEMCALGeometry * EMCALGeometry() ;
99 //TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)) ; }
100 //TObjArray * Alarms(const char * name ) const { return (TObjArray*)(ReturnO("Alarms", name)) ; }
103 //TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
106 TClonesArray * Primaries(void) const { return (TClonesArray*)(ReturnO("Primaries")) ; }
110 const TClonesArray * Hits(void) { return static_cast<const TClonesArray*>(ReturnO("Hits")) ; }
111 const AliEMCALHit * Hit(Int_t index) { return static_cast<const AliEMCALHit*>(Hits()->At(index) );}
114 TClonesArray * SDigits(const char * name = 0, const char * file=0) {
115 return static_cast<TClonesArray*>(ReturnO("SDigits", name, file)) ;
117 const AliEMCALDigit * SDigit(Int_t index) { return static_cast<const AliEMCALDigit*>(SDigits()->At(index)) ;}
119 AliEMCALSDigitizer * SDigitizer(const char * name =0) const {
120 return ((AliEMCALSDigitizer*)(ReturnT("SDigitizer", name))) ;
124 TClonesArray * Digits(const char * name = 0)const {
125 return static_cast<TClonesArray*>(ReturnO("Digits", name)) ;
127 const AliEMCALDigit * Digit(Int_t index) { return static_cast<const AliEMCALDigit *>(Digits()->At(index)) ;}
128 AliEMCALDigitizer * Digitizer(const char * name =0) const {
129 return (AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ;
133 TObjArray * TowerRecPoints(const char * name = 0) const {
134 return (TObjArray*)(ReturnO("TowerRecPoints", name)) ; }
135 TObjArray * PreShowerRecPoints(const char * name = 0) const {
136 return (TObjArray*)(ReturnO("PreShoRecPoints", name)) ; }
137 const AliEMCALTowerRecPoint * TowerRecPoint(Int_t index) {
138 return static_cast<const AliEMCALTowerRecPoint *>(TowerRecPoints()->At(index)) ;}
139 const AliEMCALTowerRecPoint * PreShowerRecPoint(Int_t index) {
140 return static_cast<const AliEMCALTowerRecPoint *>(PreShowerRecPoints()->At(index)) ;}
142 AliEMCALClusterizer * Clusterizer (const char * name =0) const {
143 return (AliEMCALClusterizer*)(ReturnT("Clusterizer", name)) ; }
146 //TClonesArray * TrackSegments(const char * name = 0) const
147 // { return (TClonesArray*)(ReturnO("TrackSegments", name)) ; }
148 //AliEMCALTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const
149 // { return (AliEMCALTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; }
152 //TClonesArray * RecParticles(const char * name = 0) const
153 // { return (TClonesArray*)(ReturnO("RecParticles", name)) ; }
154 //AliEMCALPID * PID(const char * name =0) const
155 // { return (AliEMCALPID*)(ReturnT("PID", name)) ; }
158 const TParticle * Primary(Int_t index) const ;
159 const Int_t NPrimaries()const { return fNPrimaries; }
161 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
163 AliEMCALGetter & operator = (const AliEMCALGetter & ) {
164 // assignement operator requested by coding convention, but not needed
169 TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; }
173 AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default", const Option_t * rw ="") ;
174 void CreateWhiteBoard() const ;
175 TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
176 const TTask * ReturnT(TString what,TString name=0) const ;
177 void DefineBranchTitles(char* branch, char* branchTitle) ;
181 void ReadTreeS(Int_t event) ;
182 //void ReadTreeQA() ;
183 void ReadPrimaries() ;
185 TObject ** HitsRef(void) const ;
186 TObject ** SDigitsRef(const char * name, const char * file = 0 ) const;
187 TObject ** DigitsRef (const char * name) const ;
188 TObject ** TowerRecPointsRef (const char * name) const ;
189 TObject ** PreShoRecPointsRef (const char * name) const ;
190 //TObject ** TrackSegmentsRef(const char * name) const ;
191 //TObject ** RecParticlesRef (const char * name) const ;
192 //TObject ** AlarmsRef (void) const ;
194 TObject ** SDigitizerRef (const char * name) const ;
195 TObject ** DigitizerRef (const char * name) const ;
196 TObject ** ClusterizerRef(const char * name) const ;
197 //TObject ** TSMakerRef (const char * name) const ;
198 //TObject ** PIDRef (const char * name) const ;
202 TString fHeaderFile ; //! File in which gAlice lives
203 TString fBranchTitle ; //!
204 //TString fTrackSegmentsTitle ;//!
205 TString fRecPointsTitle ; //!
206 //TString fRecParticlesTitle ; //!
207 TString fDigitsTitle ; //!
208 TString fSDigitsTitle ; //!
210 Int_t fDebug ; // Debug level
212 Int_t fNPrimaries ; //! # of primaries
214 TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
216 TFolder * fModuleFolder ; //!Folder that contains the modules
217 TFolder * fHitsFolder ; //!Folder that contains the Hits
218 TFolder * fSDigitsFolder ; //!Folder that contains the SDigits
219 TFolder * fDigitsFolder ; //!Folder that contains the Digits
220 TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles)
221 //TFolder * fQAFolder ; //!Folder that contains the QA objects
222 TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner)
224 static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton
226 ClassDef(AliEMCALGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
230 #endif // AliEMCALGETTER_H