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