]>
Commit | Line | Data |
---|---|---|
ffa6d63b | 1 | #ifndef ALIEMCALGETTER_H |
2 | #define ALIEMCALGETTER_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. | |
d75bea67 | 13 | // |
ffa6d63b | 14 | // The objects are retrived from folders. |
d75bea67 | 15 | //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) |
16 | // | |
ffa6d63b | 17 | |
18 | ||
19 | // --- ROOT system --- | |
20 | #include "TClonesArray.h" | |
21 | #include "TFolder.h" | |
22 | #include "TTree.h" | |
23 | class TString ; | |
24 | class TParticle ; | |
25 | class TTask ; | |
26 | ||
27 | // --- Standard library --- | |
28 | #include <stdlib.h> | |
29 | #include <iostream.h> | |
30 | ||
31 | // --- AliRoot header files --- | |
32 | ||
33 | #include "AliRun.h" | |
34 | #include "AliEMCALv1.h" | |
472319e5 | 35 | #include "AliEMCALHit.h" |
36 | #include "AliEMCALDigit.h" | |
37 | #include "AliEMCALDigitizer.h" | |
38 | #include "AliEMCALSDigitizer.h" | |
f07cab21 | 39 | #include "AliEMCALTowerRecPoint.h" |
ffa6d63b | 40 | class AliEMCALGeometry ; |
ea4de7a2 | 41 | class AliEMCALClusterizerv1 ; |
d75bea67 | 42 | //class AliEMCALTrackSegment ; |
43 | //class AliEMCALTrackSegmentMaker ; | |
44 | //class AliEMCALRecParticle ; | |
45 | //class AliEMCALPID ; | |
ffa6d63b | 46 | |
47 | class AliEMCALGetter : public TObject { | |
48 | ||
49 | public: | |
50 | ||
51 | AliEMCALGetter(){ | |
52 | // 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 ; | |
54 | abort() ; | |
55 | } | |
56 | AliEMCALGetter(const AliEMCALGetter & obj) { | |
57 | // cpy ctor requested by Coding Convention | |
58 | // but not yet needed | |
59 | abort() ; | |
60 | } | |
61 | ||
62 | virtual ~AliEMCALGetter() ; | |
63 | ||
28b243ad | 64 | const Bool_t HasFailed(void) const {return fFailed ;} |
ffa6d63b | 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 ; | |
f07cab21 | 68 | Bool_t PostRecPoints( const char * name ) const ; |
d75bea67 | 69 | //Bool_t PostTrackSegments(const char * name) const ; |
70 | //Bool_t PostRecParticles( const char * name) const ; | |
ffa6d63b | 71 | |
f07cab21 | 72 | Bool_t PostClusterizer( const char * name) const ; |
ea4de7a2 | 73 | Bool_t PostClusterizer(AliEMCALClusterizerv1 * clu) const ; |
f07cab21 | 74 | Bool_t PostSDigitizer (AliEMCALSDigitizer * sdigitizer) const ; |
ffa6d63b | 75 | Bool_t PostSDigitizer ( const char * name, const char * file ) const ; |
76 | Bool_t PostDigitizer (AliEMCALDigitizer * digitizer) const ; | |
77 | Bool_t PostDigitizer ( const char * name) const ; | |
d75bea67 | 78 | //Bool_t PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsm) const ; |
79 | //Bool_t PostTrackSegmentMaker(const char * name ) const ; | |
80 | //Bool_t PostPID (AliEMCALPID * pid) const ; | |
81 | //Bool_t PostPID (const char * name ) const ; | |
82 | //Bool_t PostQA (void) const ; | |
ffa6d63b | 83 | |
84 | ||
f07cab21 | 85 | void Event(const Int_t event, const char * opt = "HSDR") ; |
ffa6d63b | 86 | void Track(Int_t itrack) ; |
87 | ||
88 | //Method to be used when digitizing under AliRunDigitizer, who opens all files etc. | |
89 | void ReadTreeS(TTree * treeS,Int_t input) ; | |
90 | ||
91 | Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; } | |
92 | Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; } | |
93 | static AliEMCALGetter * GetInstance(const char* headerFile, | |
472319e5 | 94 | const char* branchTitle = "Default", const Option_t * rw="" ) ; |
ffa6d63b | 95 | static AliEMCALGetter * GetInstance() ; |
96 | ||
d75bea67 | 97 | const AliEMCALv1 * EMCAL() ; |
f07cab21 | 98 | AliEMCALGeometry * EMCALGeometry() ; |
d75bea67 | 99 | // Alarms |
100 | //TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)) ; } | |
101 | //TObjArray * Alarms(const char * name ) const { return (TObjArray*)(ReturnO("Alarms", name)) ; } | |
102 | ||
103 | // QA Tasks | |
104 | //TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; } | |
ffa6d63b | 105 | |
472319e5 | 106 | // Primaries |
107 | TClonesArray * Primaries(void) const { return (TClonesArray*)(ReturnO("Primaries")) ; } | |
108 | ||
109 | ||
ffa6d63b | 110 | // Hits |
472319e5 | 111 | const TClonesArray * Hits(void) { return static_cast<const TClonesArray*>(ReturnO("Hits")) ; } |
112 | const AliEMCALHit * Hit(Int_t index) { return static_cast<const AliEMCALHit*>(Hits()->At(index) );} | |
113 | ||
ffa6d63b | 114 | // SDigits |
472319e5 | 115 | TClonesArray * SDigits(const char * name = 0, const char * file=0) { |
116 | return static_cast<TClonesArray*>(ReturnO("SDigits", name, file)) ; | |
117 | } | |
118 | const AliEMCALDigit * SDigit(Int_t index) { return static_cast<const AliEMCALDigit*>(SDigits()->At(index)) ;} | |
119 | ||
120 | AliEMCALSDigitizer * SDigitizer(const char * name =0) const { | |
121 | return ((AliEMCALSDigitizer*)(ReturnT("SDigitizer", name))) ; | |
122 | } | |
123 | ||
ffa6d63b | 124 | // Digits |
472319e5 | 125 | TClonesArray * Digits(const char * name = 0)const { |
126 | return static_cast<TClonesArray*>(ReturnO("Digits", name)) ; | |
127 | } | |
128 | const AliEMCALDigit * Digit(Int_t index) { return static_cast<const AliEMCALDigit *>(Digits()->At(index)) ;} | |
129 | AliEMCALDigitizer * Digitizer(const char * name =0) const { | |
130 | return (AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ; | |
131 | } | |
ffa6d63b | 132 | |
f07cab21 | 133 | // RecPoints |
134 | TObjArray * TowerRecPoints(const char * name = 0) const { | |
135 | return (TObjArray*)(ReturnO("TowerRecPoints", name)) ; } | |
136 | TObjArray * PreShowerRecPoints(const char * name = 0) const { | |
137 | return (TObjArray*)(ReturnO("PreShoRecPoints", name)) ; } | |
138 | const AliEMCALTowerRecPoint * TowerRecPoint(Int_t index) { | |
139 | return static_cast<const AliEMCALTowerRecPoint *>(TowerRecPoints()->At(index)) ;} | |
140 | const AliEMCALTowerRecPoint * PreShowerRecPoint(Int_t index) { | |
141 | return static_cast<const AliEMCALTowerRecPoint *>(PreShowerRecPoints()->At(index)) ;} | |
d75bea67 | 142 | |
ea4de7a2 | 143 | AliEMCALClusterizerv1 * Clusterizer (const char * name =0) const { |
144 | return (AliEMCALClusterizerv1*)(ReturnT("Clusterizer", name)) ; } | |
d75bea67 | 145 | |
146 | // TrackSegments | |
147 | //TClonesArray * TrackSegments(const char * name = 0) const | |
148 | // { return (TClonesArray*)(ReturnO("TrackSegments", name)) ; } | |
149 | //AliEMCALTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const | |
150 | // { return (AliEMCALTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; } | |
151 | ||
152 | // RecParticles | |
153 | //TClonesArray * RecParticles(const char * name = 0) const | |
154 | // { return (TClonesArray*)(ReturnO("RecParticles", name)) ; } | |
155 | //AliEMCALPID * PID(const char * name =0) const | |
156 | // { return (AliEMCALPID*)(ReturnT("PID", name)) ; } | |
157 | ||
ffa6d63b | 158 | // Primaries |
159 | const TParticle * Primary(Int_t index) const ; | |
160 | const Int_t NPrimaries()const { return fNPrimaries; } | |
161 | ||
d75bea67 | 162 | void SetDebug(Int_t level) {fDebug = level;} // Set debug level |
ffa6d63b | 163 | |
164 | AliEMCALGetter & operator = (const AliEMCALGetter & ) { | |
165 | // assignement operator requested by coding convention, but not needed | |
166 | abort() ; | |
167 | return *this ; | |
168 | } | |
169 | ||
170 | TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; } | |
171 | ||
172 | private: | |
173 | ||
472319e5 | 174 | AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default", const Option_t * rw ="") ; |
ffa6d63b | 175 | void CreateWhiteBoard() const ; |
472319e5 | 176 | TObject * ReturnO(TString what, TString name=0, TString file=0) const ; |
ffa6d63b | 177 | const TTask * ReturnT(TString what,TString name=0) const ; |
178 | void DefineBranchTitles(char* branch, char* branchTitle) ; | |
179 | void ReadTreeD() ; | |
180 | void ReadTreeH() ; | |
f07cab21 | 181 | void ReadTreeR() ; |
ffa6d63b | 182 | void ReadTreeS(Int_t event) ; |
d75bea67 | 183 | //void ReadTreeQA() ; |
ffa6d63b | 184 | void ReadPrimaries() ; |
185 | ||
472319e5 | 186 | TObject ** HitsRef(void) const ; |
187 | TObject ** SDigitsRef(const char * name, const char * file = 0 ) const; | |
188 | TObject ** DigitsRef (const char * name) const ; | |
f07cab21 | 189 | TObject ** TowerRecPointsRef (const char * name) const ; |
190 | TObject ** PreShoRecPointsRef (const char * name) const ; | |
472319e5 | 191 | //TObject ** TrackSegmentsRef(const char * name) const ; |
192 | //TObject ** RecParticlesRef (const char * name) const ; | |
193 | //TObject ** AlarmsRef (void) const ; | |
194 | ||
195 | TObject ** SDigitizerRef (const char * name) const ; | |
196 | TObject ** DigitizerRef (const char * name) const ; | |
f07cab21 | 197 | TObject ** ClusterizerRef(const char * name) const ; |
472319e5 | 198 | //TObject ** TSMakerRef (const char * name) const ; |
199 | //TObject ** PIDRef (const char * name) const ; | |
ffa6d63b | 200 | |
201 | private: | |
202 | ||
203 | TString fHeaderFile ; //! File in which gAlice lives | |
204 | TString fBranchTitle ; //! | |
d75bea67 | 205 | //TString fTrackSegmentsTitle ;//! |
f07cab21 | 206 | TString fRecPointsTitle ; //! |
d75bea67 | 207 | //TString fRecParticlesTitle ; //! |
ffa6d63b | 208 | TString fDigitsTitle ; //! |
209 | TString fSDigitsTitle ; //! | |
210 | ||
28b243ad | 211 | Bool_t fFailed ; //! true if file is not opened and/or galice not found |
ffa6d63b | 212 | Int_t fDebug ; // Debug level |
213 | ||
214 | Int_t fNPrimaries ; //! # of primaries | |
215 | ||
216 | TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing | |
217 | ||
d75bea67 | 218 | TFolder * fModuleFolder ; //!Folder that contains the modules |
ffa6d63b | 219 | TFolder * fHitsFolder ; //!Folder that contains the Hits |
220 | TFolder * fSDigitsFolder ; //!Folder that contains the SDigits | |
221 | TFolder * fDigitsFolder ; //!Folder that contains the Digits | |
f07cab21 | 222 | TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles) |
d75bea67 | 223 | //TFolder * fQAFolder ; //!Folder that contains the QA objects |
ffa6d63b | 224 | TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner) |
d75bea67 | 225 | |
ffa6d63b | 226 | static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton |
227 | ||
228 | ClassDef(AliEMCALGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index | |
229 | ||
230 | }; | |
231 | ||
232 | #endif // AliEMCALGETTER_H |