]>
Commit | Line | Data |
---|---|---|
4ae78bb1 | 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 */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
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. | |
13 | // | |
14 | // The objects are retrived from folders. | |
15 | //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) | |
16 | // | |
17 | ||
18 | ||
19 | // --- ROOT system --- | |
20 | #include "TClonesArray.h" | |
7a9d98f9 | 21 | #include "TFolder.h" |
22 | #include "TTree.h" | |
4ae78bb1 | 23 | class TString ; |
24 | class TParticle ; | |
25 | class TTask ; | |
26 | ||
27 | // --- Standard library --- | |
f404725b | 28 | #include <stdlib.h> |
931e9fdb | 29 | #include <iostream.h> |
4ae78bb1 | 30 | |
31 | // --- AliRoot header files --- | |
32 | ||
7a9d98f9 | 33 | #include "AliRun.h" |
34 | #include "AliPHOS.h" | |
cb34a1fa | 35 | #include "AliPHOSHit.h" |
36 | #include "AliPHOSDigit.h" | |
37 | #include "AliPHOSEmcRecPoint.h" | |
38 | #include "AliPHOSCpvRecPoint.h" | |
39 | #include "AliPHOSTrackSegment.h" | |
40 | #include "AliPHOSRecParticle.h" | |
4ae78bb1 | 41 | class AliPHOSGeometry ; |
4ae78bb1 | 42 | class AliPHOSDigitizer ; |
43 | class AliPHOSSDigitizer ; | |
4ae78bb1 | 44 | class AliPHOSClusterizer ; |
4ae78bb1 | 45 | class AliPHOSTrackSegmentMaker ; |
4ae78bb1 | 46 | class AliPHOSPID ; |
47 | ||
48 | class AliPHOSGetter : public TObject { | |
49 | ||
50 | public: | |
51 | ||
cb34a1fa | 52 | AliPHOSGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public |
4ae78bb1 | 53 | cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ; |
54 | abort() ; | |
55 | } | |
56 | AliPHOSGetter(const AliPHOSGetter & obj) { | |
57 | // cpy ctor requested by Coding Convention | |
58 | // but not yet needed | |
59 | abort() ; | |
60 | } | |
61 | ||
d071065d | 62 | virtual ~AliPHOSGetter() ; |
4ae78bb1 | 63 | |
dca3a7c4 | 64 | const Bool_t HasFailed() const { return fFailed ; } |
cb34a1fa | 65 | Bool_t PostPrimaries(void ) const ; |
b0bba0af | 66 | Bool_t PostHits(void ) const ; |
67 | Bool_t PostSDigits( const char * name, const char * file = 0) const ; | |
68 | Bool_t PostDigits( const char * name ) const ; | |
69 | Bool_t PostRecPoints( const char * name ) const ; | |
70 | Bool_t PostTrackSegments(const char * name) const ; | |
71 | Bool_t PostRecParticles( const char * name) const ; | |
72 | ||
73 | Bool_t PostClusterizer( const char * name) const ; | |
74 | Bool_t PostClusterizer(AliPHOSClusterizer * clu) const ; | |
75 | Bool_t PostSDigitizer (AliPHOSSDigitizer * sdigitizer) const ; | |
76 | Bool_t PostSDigitizer ( const char * name, const char * file ) const ; | |
77 | Bool_t PostDigitizer (AliPHOSDigitizer * digitizer) const ; | |
78 | Bool_t PostDigitizer ( const char * name) const ; | |
79 | Bool_t PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsm) const ; | |
80 | Bool_t PostTrackSegmentMaker(const char * name ) const ; | |
81 | Bool_t PostPID (AliPHOSPID * pid) const ; | |
7a9d98f9 | 82 | Bool_t PostPID (const char * name ) const ; |
83 | Bool_t PostQA (void) const ; | |
b0bba0af | 84 | |
85 | ||
cb34a1fa | 86 | void Event(const Int_t event, const char * opt = "HSDRQP") ; |
b0bba0af | 87 | void Track(Int_t itrack) ; |
88 | ||
89 | //Method to be used when digitizing under AliRunDigitizer, who opens all files etc. | |
90 | void ReadTreeS(TTree * treeS,Int_t input) ; | |
91 | ||
92 | Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; } | |
93 | Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; } | |
4ae78bb1 | 94 | static AliPHOSGetter * GetInstance(const char* headerFile, |
b0bba0af | 95 | const char* branchTitle = "Default" ) ; |
96 | static AliPHOSGetter * GetInstance() ; | |
97 | ||
7a9d98f9 | 98 | const AliPHOS * PHOS() ; |
99 | const AliPHOSGeometry * PHOSGeometry() ; | |
b0bba0af | 100 | // Alarms |
7a9d98f9 | 101 | TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)) ; } |
102 | TObjArray * Alarms(const char * name ) const { return (TObjArray*)(ReturnO("Alarms", name)) ; } | |
4ae78bb1 | 103 | |
eb9763ac | 104 | // QA Tasks |
105 | TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; } | |
106 | ||
cb34a1fa | 107 | // Primaries |
108 | TClonesArray * Primaries(void) const { return (TClonesArray*)(ReturnO("Primaries")) ; } | |
4ae78bb1 | 109 | // Hits |
cb34a1fa | 110 | const TClonesArray * Hits(void) { return static_cast<const TClonesArray*>(ReturnO("Hits")) ; } |
111 | const AliPHOSHit * Hit(Int_t index) { return static_cast<const AliPHOSHit*>(Hits()->At(index) );} | |
112 | ||
4ae78bb1 | 113 | // SDigits |
cb34a1fa | 114 | TClonesArray * SDigits(const char * name = 0, const char * file=0) { |
115 | return static_cast<TClonesArray*>(ReturnO("SDigits", name, file)) ; | |
116 | } | |
117 | const AliPHOSDigit * SDigit(Int_t index) { return static_cast<const AliPHOSDigit*>(SDigits()->At(index)) ;} | |
118 | ||
119 | AliPHOSSDigitizer * SDigitizer(const char * name =0) const { | |
120 | return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ; | |
121 | } | |
122 | ||
4ae78bb1 | 123 | // Digits |
cb34a1fa | 124 | TClonesArray * Digits(const char * name = 0)const { |
125 | return static_cast<TClonesArray*>(ReturnO("Digits", name)) ; | |
126 | } | |
127 | const AliPHOSDigit * Digit(Int_t index) { return static_cast<const AliPHOSDigit *>(Digits()->At(index)) ;} | |
128 | AliPHOSDigitizer * Digitizer(const char * name =0) const { | |
129 | return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ; | |
130 | } | |
131 | ||
4ae78bb1 | 132 | // RecPoints |
65c0665e | 133 | TObjArray * EmcRecPoints(const char * name = 0) { |
cb34a1fa | 134 | return static_cast<TObjArray*>(ReturnO("EmcRecPoints", name)) ; |
135 | } | |
136 | TObjArray * CpvRecPoints(const char * name = 0) { | |
137 | return static_cast<TObjArray*>(ReturnO("CpvRecPoints", name)) ; | |
138 | } | |
139 | const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) { | |
140 | return static_cast<const AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ; | |
141 | } | |
142 | const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) { | |
143 | return static_cast<const AliPHOSCpvRecPoint *>(CpvRecPoints()->At(index)) ; | |
144 | } | |
145 | ||
146 | AliPHOSClusterizer * Clusterizer (const char * name =0) const { | |
147 | return (AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ; | |
148 | } | |
149 | ||
4ae78bb1 | 150 | // TrackSegments |
cb34a1fa | 151 | TClonesArray * TrackSegments(const char * name = 0) { |
152 | return static_cast<TClonesArray*>(ReturnO("TrackSegments", name)) ; | |
153 | } | |
154 | const AliPHOSTrackSegment * TrackSegment(Int_t index) { | |
155 | return static_cast<const AliPHOSTrackSegment*>(TrackSegments()->At(index)) ; | |
156 | } | |
157 | AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const { | |
158 | return (AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; | |
159 | } | |
160 | ||
4ae78bb1 | 161 | // RecParticles |
cb34a1fa | 162 | TClonesArray * RecParticles(const char * name = 0) { |
163 | return static_cast<TClonesArray*>(ReturnO("RecParticles", name)) ; | |
164 | } | |
165 | const AliPHOSRecParticle * RecParticle(Int_t index) { | |
166 | return static_cast<const AliPHOSRecParticle*>(RecParticles()->At(index)) ; | |
167 | } | |
168 | AliPHOSPID * PID(const char * name =0) const { | |
169 | return (AliPHOSPID*)(ReturnT("PID", name)) ; | |
170 | } | |
171 | ||
4ae78bb1 | 172 | // Primaries |
173 | const TParticle * Primary(Int_t index) const ; | |
174 | const Int_t NPrimaries()const { return fNPrimaries; } | |
cb34a1fa | 175 | const TParticle * Secondary(TParticle * p, Int_t index=1) const ; |
176 | ||
b0bba0af | 177 | void SetDebug(Int_t level) {fDebug = level;} // Set debug level |
cb34a1fa | 178 | |
4ae78bb1 | 179 | AliPHOSGetter & operator = (const AliPHOSGetter & ) { |
b0bba0af | 180 | // assignement operator requested by coding convention, but not needed |
4ae78bb1 | 181 | abort() ; |
182 | return *this ; | |
183 | } | |
184 | ||
7a9d98f9 | 185 | TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("PHOS")) ; } |
cb34a1fa | 186 | |
187 | private: | |
188 | ||
b0bba0af | 189 | AliPHOSGetter(const char* headerFile, const char* branchTitle ="Default") ; |
4ae78bb1 | 190 | void CreateWhiteBoard() const ; |
cb34a1fa | 191 | TObject * ReturnO(TString what, TString name=0, TString file=0) const ; |
4ae78bb1 | 192 | const TTask * ReturnT(TString what,TString name=0) const ; |
193 | void DefineBranchTitles(char* branch, char* branchTitle) ; | |
ab3ecbea | 194 | Int_t ReadTreeD() ; |
195 | Int_t ReadTreeH() ; | |
196 | Int_t ReadTreeR() ; | |
197 | Int_t ReadTreeS(Int_t event) ; | |
b0bba0af | 198 | void ReadTreeQA() ; |
4ae78bb1 | 199 | void ReadPrimaries() ; |
200 | ||
65c0665e | 201 | TObject** PrimariesRef(void) const ; |
202 | TObject** HitsRef(void) const ; | |
203 | TObject** SDigitsRef(const char * name, const char * file = 0 ) const; | |
204 | TObject** DigitsRef (const char * name) const ; | |
205 | TObject** EmcRecPointsRef (const char * name) const ; | |
206 | TObject** CpvRecPointsRef (const char * name) const ; | |
207 | TObject** TrackSegmentsRef(const char * name) const ; | |
208 | TObject** RecParticlesRef (const char * name) const ; | |
209 | TObject** AlarmsRef (void) const ; | |
210 | ||
211 | TObject** SDigitizerRef (const char * name) const ; | |
212 | TObject** DigitizerRef (const char * name) const ; | |
213 | TObject** ClusterizerRef(const char * name) const ; | |
214 | TObject** TSMakerRef (const char * name) const ; | |
215 | TObject** PIDRef (const char * name) const ; | |
b0bba0af | 216 | |
4ae78bb1 | 217 | private: |
218 | ||
b0bba0af | 219 | TString fHeaderFile ; //! File in which gAlice lives |
220 | TString fBranchTitle ; //! | |
221 | TString fTrackSegmentsTitle ;//! | |
222 | TString fRecPointsTitle ; //! | |
223 | TString fRecParticlesTitle ; //! | |
224 | TString fDigitsTitle ; //! | |
225 | TString fSDigitsTitle ; //! | |
4ae78bb1 | 226 | |
dca3a7c4 | 227 | Bool_t fFailed ; //! set if file not opend or galice not found |
b0bba0af | 228 | Int_t fDebug ; // Debug level |
518b8b75 | 229 | |
b0bba0af | 230 | Int_t fNPrimaries ; //! # of primaries |
4ae78bb1 | 231 | |
b0bba0af | 232 | TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing |
4ae78bb1 | 233 | |
7a9d98f9 | 234 | TFolder * fModuleFolder ; //!Folder that contains the modules |
cb34a1fa | 235 | TFolder * fPrimariesFolder ; //!Folder that contains the Primary Particles |
7a9d98f9 | 236 | TFolder * fHitsFolder ; //!Folder that contains the Hits |
237 | TFolder * fSDigitsFolder ; //!Folder that contains the SDigits | |
238 | TFolder * fDigitsFolder ; //!Folder that contains the Digits | |
239 | TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles) | |
240 | TFolder * fQAFolder ; //!Folder that contains the QA objects | |
241 | TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner) | |
242 | ||
b0bba0af | 243 | static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton |
4ae78bb1 | 244 | |
245 | ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index | |
246 | ||
247 | }; | |
248 | ||
249 | #endif // AliPHOSGETTER_H |