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 */
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 ---
35 #include "AliPHOSHit.h"
36 #include "AliPHOSDigit.h"
37 #include "AliPHOSEmcRecPoint.h"
38 #include "AliPHOSCpvRecPoint.h"
39 #include "AliPHOSTrackSegment.h"
40 #include "AliPHOSRecParticle.h"
41 class AliPHOSGeometry ;
42 class AliPHOSDigitizer ;
43 class AliPHOSSDigitizer ;
44 class AliPHOSClusterizer ;
45 class AliPHOSTrackSegmentMaker ;
48 class AliPHOSGetter : public TObject {
52 AliPHOSGetter(){ // 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 AliPHOSGetter(const AliPHOSGetter & obj) {
57 // cpy ctor requested by Coding Convention
62 virtual ~AliPHOSGetter() ;
64 Bool_t PostPrimaries(void ) const ;
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(AliPHOSClusterizer * clu) const ;
74 Bool_t PostSDigitizer (AliPHOSSDigitizer * sdigitizer) const ;
75 Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
76 Bool_t PostDigitizer (AliPHOSDigitizer * digitizer) const ;
77 Bool_t PostDigitizer ( const char * name) const ;
78 Bool_t PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsm) const ;
79 Bool_t PostTrackSegmentMaker(const char * name ) const ;
80 Bool_t PostPID (AliPHOSPID * 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 = "HSDRQP") ;
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 AliPHOSGetter * GetInstance(const char* headerFile,
94 const char* branchTitle = "Default" ) ;
95 static AliPHOSGetter * GetInstance() ;
97 const AliPHOS * PHOS() ;
98 const AliPHOSGeometry * PHOSGeometry() ;
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")) ; }
109 const TClonesArray * Hits(void) { return static_cast<const TClonesArray*>(ReturnO("Hits")) ; }
110 const AliPHOSHit * Hit(Int_t index) { return static_cast<const AliPHOSHit*>(Hits()->At(index) );}
113 TClonesArray * SDigits(const char * name = 0, const char * file=0) {
114 return static_cast<TClonesArray*>(ReturnO("SDigits", name, file)) ;
116 const AliPHOSDigit * SDigit(Int_t index) { return static_cast<const AliPHOSDigit*>(SDigits()->At(index)) ;}
118 AliPHOSSDigitizer * SDigitizer(const char * name =0) const {
119 return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ;
123 TClonesArray * Digits(const char * name = 0)const {
124 return static_cast<TClonesArray*>(ReturnO("Digits", name)) ;
126 const AliPHOSDigit * Digit(Int_t index) { return static_cast<const AliPHOSDigit *>(Digits()->At(index)) ;}
127 AliPHOSDigitizer * Digitizer(const char * name =0) const {
128 return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ;
132 TObjArray * EmcRecPoints(const char * name = 0) {
133 return static_cast<TObjArray*>(ReturnO("EmcRecPoints", name)) ;
135 TObjArray * CpvRecPoints(const char * name = 0) {
136 return static_cast<TObjArray*>(ReturnO("CpvRecPoints", name)) ;
138 const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) {
139 return static_cast<const AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ;
141 const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) {
142 return static_cast<const AliPHOSCpvRecPoint *>(CpvRecPoints()->At(index)) ;
145 AliPHOSClusterizer * Clusterizer (const char * name =0) const {
146 return (AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ;
150 TClonesArray * TrackSegments(const char * name = 0) {
151 return static_cast<TClonesArray*>(ReturnO("TrackSegments", name)) ;
153 const AliPHOSTrackSegment * TrackSegment(Int_t index) {
154 return static_cast<const AliPHOSTrackSegment*>(TrackSegments()->At(index)) ;
156 AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const {
157 return (AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ;
161 TClonesArray * RecParticles(const char * name = 0) {
162 return static_cast<TClonesArray*>(ReturnO("RecParticles", name)) ;
164 const AliPHOSRecParticle * RecParticle(Int_t index) {
165 return static_cast<const AliPHOSRecParticle*>(RecParticles()->At(index)) ;
167 AliPHOSPID * PID(const char * name =0) const {
168 return (AliPHOSPID*)(ReturnT("PID", name)) ;
172 const TParticle * Primary(Int_t index) const ;
173 const Int_t NPrimaries()const { return fNPrimaries; }
174 const TParticle * Secondary(TParticle * p, Int_t index=1) const ;
176 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
178 AliPHOSGetter & operator = (const AliPHOSGetter & ) {
179 // assignement operator requested by coding convention, but not needed
184 TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("PHOS")) ; }
188 AliPHOSGetter(const char* headerFile, const char* branchTitle ="Default") ;
189 void CreateWhiteBoard() const ;
190 TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
191 const TTask * ReturnT(TString what,TString name=0) const ;
192 void DefineBranchTitles(char* branch, char* branchTitle) ;
196 void ReadTreeS(Int_t event) ;
198 void ReadPrimaries() ;
200 void * PrimariesRef(void) const ;
201 void * HitsRef(void) const ;
202 void * SDigitsRef(const char * name, const char * file = 0 ) const;
203 void * DigitsRef (const char * name) const ;
204 void * EmcRecPointsRef (const char * name) const ;
205 void * CpvRecPointsRef (const char * name) const ;
206 void * TrackSegmentsRef(const char * name) const ;
207 void * RecParticlesRef (const char * name) const ;
208 void * AlarmsRef (void) const ;
210 void * SDigitizerRef (const char * name) const ;
211 void * DigitizerRef (const char * name) const ;
212 void * ClusterizerRef(const char * name) const ;
213 void * TSMakerRef (const char * name) const ;
214 void * PIDRef (const char * name) const ;
218 TString fHeaderFile ; //! File in which gAlice lives
219 TString fBranchTitle ; //!
220 TString fTrackSegmentsTitle ;//!
221 TString fRecPointsTitle ; //!
222 TString fRecParticlesTitle ; //!
223 TString fDigitsTitle ; //!
224 TString fSDigitsTitle ; //!
226 Int_t fDebug ; // Debug level
228 Int_t fNPrimaries ; //! # of primaries
230 TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
232 TFolder * fModuleFolder ; //!Folder that contains the modules
233 TFolder * fPrimariesFolder ; //!Folder that contains the Primary Particles
234 TFolder * fHitsFolder ; //!Folder that contains the Hits
235 TFolder * fSDigitsFolder ; //!Folder that contains the SDigits
236 TFolder * fDigitsFolder ; //!Folder that contains the Digits
237 TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles)
238 TFolder * fQAFolder ; //!Folder that contains the QA objects
239 TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner)
241 static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton
243 ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
247 #endif // AliPHOSGETTER_H