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() ;
66 Bool_t PostGeometry( void ) const ;
67 Bool_t PostHits(void ) const ;
68 Bool_t PostSDigits( const char * name, const char * file = 0) const ;
69 Bool_t PostDigits( const char * name ) const ;
70 Bool_t PostRecPoints( const char * name ) const ;
71 Bool_t PostTrackSegments(const char * name) const ;
72 Bool_t PostRecParticles( const char * name) const ;
74 Bool_t PostClusterizer( const char * name) const ;
75 Bool_t PostClusterizer(AliPHOSClusterizer * clu) const ;
76 Bool_t PostSDigitizer (AliPHOSSDigitizer * sdigitizer) const ;
77 Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
78 Bool_t PostDigitizer (AliPHOSDigitizer * digitizer) const ;
79 Bool_t PostDigitizer ( const char * name) const ;
80 Bool_t PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsm) const ;
81 Bool_t PostTrackSegmentMaker(const char * name ) const ;
82 Bool_t PostPID (AliPHOSPID * pid) const ;
83 Bool_t PostPID ( const char * name ) const ;
84 Bool_t PostQA ( const char * headerFile ) const ;
87 void Event(const Int_t event, const char * opt = "HSDRQ") ;
88 void Track(Int_t itrack) ;
90 //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
91 void ReadTreeS(TTree * treeS,Int_t input) ;
93 Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
94 Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
95 static AliPHOSGetter * GetInstance(const char* headerFile,
96 const char* branchTitle = "Default" ) ;
97 static AliPHOSGetter * GetInstance() ;
99 const AliPHOS * PHOS() const ;
100 const AliPHOSGeometry * PHOSGeometry() const ;
102 TFolder * Alarms(const char * name = 0) const { return (TFolder*)(ReturnO("Alarms", name)) ; }
105 TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
108 TClonesArray * Hits(void) const { return (TClonesArray*)(ReturnO("Hits")) ; }
111 TClonesArray * SDigits(const char * name = 0, const char * file=0) const
112 { return (TClonesArray*)(ReturnO("SDigits", name, file)) ; }
114 AliPHOSSDigitizer * SDigitizer(const char * name =0) const
115 { return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ; }
118 TClonesArray * Digits(const char * name = 0) const
119 { return (TClonesArray*)(ReturnO("Digits", name)) ; }
120 AliPHOSDigitizer * Digitizer(const char * name =0) const
121 { return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ; }
124 TObjArray * EmcRecPoints(const char * name = 0) const {
125 return (TObjArray*)(ReturnO("EmcRecPoints", name)) ; }
126 TObjArray * CpvRecPoints(const char * name = 0) const {
127 return (TObjArray*)(ReturnO("CpvRecPoints", name)) ; }
129 AliPHOSClusterizer * Clusterizer (const char * name =0) const
130 { return (AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ; }
133 TClonesArray * TrackSegments(const char * name = 0) const
134 { return (TClonesArray*)(ReturnO("TrackSegments", name)) ; }
135 AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const
136 { return (AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; }
139 TClonesArray * RecParticles(const char * name = 0) const
140 { return (TClonesArray*)(ReturnO("RecParticles", name)) ; }
141 AliPHOSPID * PID(const char * name =0) const
142 { return (AliPHOSPID*)(ReturnT("PID", name)) ; }
145 const TParticle * Primary(Int_t index) const ;
146 const Int_t NPrimaries()const { return fNPrimaries; }
148 void SetDebug(Int_t level) {fDebug = level;} // Set debug level
150 AliPHOSGetter & operator = (const AliPHOSGetter & ) {
151 // assignement operator requested by coding convention, but not needed
158 AliPHOSGetter(const char* headerFile, const char* branchTitle ="Default") ;
159 void CreateWhiteBoard() const ;
160 const TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
161 const TTask * ReturnT(TString what,TString name=0) const ;
162 void DefineBranchTitles(char* branch, char* branchTitle) ;
166 void ReadTreeS(Int_t event) ;
168 void ReadPrimaries() ;
170 TClonesArray ** HitsRef(void) const ;
171 TClonesArray ** SDigitsRef(const char * name, const char * file = 0 ) const;
172 TClonesArray ** DigitsRef (const char * name) const ;
173 TObjArray ** EmcRecPointsRef (const char * name) const ;
174 TObjArray ** CpvRecPointsRef (const char * name) const ;
175 TClonesArray ** TrackSegmentsRef(const char * name) const ;
176 TClonesArray ** RecParticlesRef (const char * name) const ;
178 AliPHOSSDigitizer ** SDigitizerRef (const char * name) const ;
179 AliPHOSDigitizer ** DigitizerRef (const char * name) const ;
180 AliPHOSClusterizer ** ClusterizerRef(const char * name) const ;
181 AliPHOSTrackSegmentMaker ** TSMakerRef (const char * name) const ;
182 AliPHOSPID ** PIDRef (const char * name) const ;
186 TString fHeaderFile ; //! File in which gAlice lives
187 TString fBranchTitle ; //!
188 TString fTrackSegmentsTitle ;//!
189 TString fRecPointsTitle ; //!
190 TString fRecParticlesTitle ; //!
191 TString fDigitsTitle ; //!
192 TString fSDigitsTitle ; //!
194 Int_t fDebug ; // Debug level
196 Int_t fNPrimaries ; //! # of primaries
198 TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
200 static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton
202 ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
206 #endif // AliPHOSGETTER_H