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"
30 // --- Standard library ---
32 // --- AliRoot header files ---
36 class AliPHOSGeometry ;
39 class AliPHOSDigitizer ;
40 class AliPHOSSDigitizer ;
41 class AliPHOSEmcRecPoint ;
42 class AliPHOSCpvRecPoint ;
43 class AliPHOSClusterizer ;
44 class AliPHOSTrackSegment ;
45 class AliPHOSTrackSegmentMaker ;
46 class AliPHOSRecParticle ;
49 class AliPHOSGetter : public TObject {
54 // ctor: this is a singleton, the ctor should never be called but cint needs it as public
55 cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ;
58 AliPHOSGetter(const AliPHOSGetter & obj) {
59 // cpy ctor requested by Coding Convention
64 virtual ~AliPHOSGetter(){
68 Bool_t PostGeometry( void ) const ;
69 Bool_t PostHits(void ) const ;
70 Bool_t PostSDigits( const char * name, const char * file = 0) const ;
71 Bool_t PostDigits( const char * name ) const ;
72 Bool_t PostRecPoints( const char * name ) const ;
73 Bool_t PostTrackSegments(const char * name) const ;
74 Bool_t PostRecParticles( const char * name) const ;
76 Bool_t PostClusterizer( const char * name) const ;
77 Bool_t PostClusterizer(AliPHOSClusterizer * clu) const ;
78 Bool_t PostSDigitizer (AliPHOSSDigitizer * sdigitizer) const ;
79 Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
80 Bool_t PostDigitizer (AliPHOSDigitizer * digitizer) const ;
81 Bool_t PostDigitizer ( const char * name) const ;
82 Bool_t PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsm) const ;
83 Bool_t PostTrackSegmentMaker(const char * name ) const ;
84 Bool_t PostPID (AliPHOSPID * pid) const ;
85 Bool_t PostPID ( const char * name ) const ;
86 Bool_t PostQA ( const char * headerFile ) const ;
89 void Event(const Int_t event, const char * opt = "HSDRQ") ;
90 void Track(Int_t itrack) ;
92 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
93 void ReadTreeS(TTree * treeS,Int_t input) ;
95 Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
96 Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
97 static AliPHOSGetter * GetInstance(const char* headerFile,
98 const char* branchTitle = "Default" ) ;
99 static AliPHOSGetter * GetInstance() ;
101 const AliPHOS * PHOS() const ;
102 const AliPHOSGeometry * PHOSGeometry() const ;
104 TFolder * Alarms(const char * name = 0) const { return (TFolder*)(ReturnO("Alarms", name)) ; }
107 TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
110 TClonesArray * Hits(void) const { return (TClonesArray*)(ReturnO("Hits")) ; }
113 TClonesArray * SDigits(const char * name = 0, const char * file=0) const
114 { return (TClonesArray*)(ReturnO("SDigits", name, file)) ; }
116 AliPHOSSDigitizer * SDigitizer(const char * name =0) const
117 { return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ; }
120 TClonesArray * Digits(const char * name = 0) const
121 { return (TClonesArray*)(ReturnO("Digits", name)) ; }
122 AliPHOSDigitizer * Digitizer(const char * name =0) const
123 { return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ; }
126 TObjArray * EmcRecPoints(const char * name = 0) const {
127 return (TObjArray*)(ReturnO("EmcRecPoints", name)) ; }
128 TObjArray * CpvRecPoints(const char * name = 0) const {
129 return (TObjArray*)(ReturnO("CpvRecPoints", name)) ; }
131 AliPHOSClusterizer * Clusterizer (const char * name =0) const
132 { return (AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ; }
135 TClonesArray * TrackSegments(const char * name = 0) const
136 { return (TClonesArray*)(ReturnO("TrackSegments", name)) ; }
137 AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const
138 { return (AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; }
141 TClonesArray * RecParticles(const char * name = 0) const
142 { return (TClonesArray*)(ReturnO("RecParticles", name)) ; }
143 AliPHOSPID * PID(const char * name =0) const
144 { return (AliPHOSPID*)(ReturnT("PID", name)) ; }
147 const TParticle * Primary(Int_t index) const ;
148 const Int_t NPrimaries()const { return fNPrimaries; }
150 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
152 AliPHOSGetter & operator = (const AliPHOSGetter & ) {
153 // assignement operator requested by coding convention, but not needed
160 AliPHOSGetter(const char* headerFile, const char* branchTitle ="Default") ;
161 void CreateWhiteBoard() const ;
162 const TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
163 const TTask * ReturnT(TString what,TString name=0) const ;
164 void DefineBranchTitles(char* branch, char* branchTitle) ;
168 void ReadTreeS(Int_t event) ;
170 void ReadPrimaries() ;
172 TClonesArray ** HitsRef(void) const ;
173 TClonesArray ** SDigitsRef(const char * name, const char * file = 0 ) const;
174 TClonesArray ** DigitsRef (const char * name) const ;
175 TObjArray ** EmcRecPointsRef (const char * name) const ;
176 TObjArray ** CpvRecPointsRef (const char * name) const ;
177 TClonesArray ** TrackSegmentsRef(const char * name) const ;
178 TClonesArray ** RecParticlesRef (const char * name) const ;
180 AliPHOSSDigitizer ** SDigitizerRef (const char * name) const ;
181 AliPHOSDigitizer ** DigitizerRef (const char * name) const ;
182 AliPHOSClusterizer ** ClusterizerRef(const char * name) const ;
183 AliPHOSTrackSegmentMaker ** TSMakerRef (const char * name) const ;
184 AliPHOSPID ** PIDRef (const char * name) const ;
188 TString fHeaderFile ; //! File in which gAlice lives
189 TString fBranchTitle ; //!
190 TString fTrackSegmentsTitle ;//!
191 TString fRecPointsTitle ; //!
192 TString fRecParticlesTitle ; //!
193 TString fDigitsTitle ; //!
194 TString fSDigitsTitle ; //!
196 Int_t fDebug ; // Debug level
198 Int_t fNPrimaries ; //! # of primaries
200 TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
202 static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton
204 ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
208 #endif // AliPHOSGETTER_H