]>
Commit | Line | Data |
---|---|---|
9da38871 | 1 | /************************************************************************** |
2 | * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //____________________________________________________________________ | |
19 | // | |
20 | // ESD information from the FMD | |
21 | // Contains information on: | |
22 | // Charged particle multiplicty per strip (rough estimate) | |
23 | // Psuedo-rapdity per strip | |
24 | // Latest changes by Christian Holm Christensen | |
25 | // | |
26 | #include "AliESDFMD.h" // ALIFMDESD_H | |
27 | #include "AliLog.h" // ALILOG_H | |
28 | #include "Riostream.h" // ROOT_Riostream | |
021f1396 | 29 | #include <TMath.h> |
9da38871 | 30 | |
31 | //____________________________________________________________________ | |
32 | ClassImp(AliESDFMD) | |
33 | #if 0 | |
34 | ; // This is here to keep Emacs for indenting the next line | |
35 | #endif | |
36 | ||
37 | ||
021f1396 | 38 | //____________________________________________________________________ |
39 | namespace { | |
40 | // Private implementation of a AliFMDMap::ForOne to use in | |
41 | // forwarding to AliESDFMD::ForOne | |
42 | class ForMultiplicity : public AliFMDMap::ForOne | |
43 | { | |
44 | public: | |
45 | ForMultiplicity(const AliESDFMD& o, AliESDFMD::ForOne& a) | |
46 | : fObject(o), fAlgo(a) | |
47 | {} | |
48 | Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t, | |
49 | Float_t m) | |
50 | { | |
51 | Float_t e = fObject.Eta(d, r, 0, t); | |
52 | return fAlgo.operator()(d, r, s, t, m, e); | |
53 | } | |
54 | Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Int_t) | |
55 | { | |
56 | return kTRUE; | |
57 | } | |
58 | Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, UShort_t) | |
59 | { | |
60 | return kTRUE; | |
61 | } | |
62 | Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Bool_t) | |
63 | { | |
64 | return kTRUE; | |
65 | } | |
66 | protected: | |
67 | const AliESDFMD& fObject; | |
68 | AliESDFMD::ForOne& fAlgo; | |
69 | }; | |
70 | ||
71 | // Private implementation of AliESDFMD::ForOne to print an | |
72 | // object | |
73 | class Printer : public AliESDFMD::ForOne | |
74 | { | |
75 | public: | |
76 | Printer() : fOldD(0), fOldR('-'), fOldS(1024) {} | |
77 | Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t, | |
78 | Float_t m, Float_t e) | |
79 | { | |
80 | if (d != fOldD) { | |
81 | if (fOldD != 0) printf("\n"); | |
82 | fOldD = d; | |
83 | fOldR = '-'; | |
84 | printf("FMD%d", fOldD); | |
85 | } | |
86 | if (r != fOldR) { | |
87 | fOldR = r; | |
88 | fOldS = 1024; | |
89 | printf("\n %s ring", (r == 'I' ? "Inner" : "Outer")); | |
90 | } | |
91 | if (s != fOldS) { | |
92 | fOldS = s; | |
93 | printf("\n Sector %d", fOldS); | |
94 | } | |
95 | if (t % 4 == 0) printf("\n %3d-%3d ", t, t+3); | |
96 | if (m == AliESDFMD::kInvalidMult) printf("------/"); | |
97 | else printf("%6.3f/", m); | |
98 | if (e == AliESDFMD::kInvalidEta) printf("------ "); | |
99 | else printf("%6.3f ", e); | |
100 | ||
101 | return kTRUE; | |
102 | } | |
103 | private: | |
104 | UShort_t fOldD; | |
105 | Char_t fOldR; | |
106 | UShort_t fOldS; | |
107 | }; | |
108 | } | |
109 | ||
9da38871 | 110 | //____________________________________________________________________ |
111 | AliESDFMD::AliESDFMD() | |
021f1396 | 112 | : fMultiplicity(0, 0, 0, 0), |
9da38871 | 113 | fEta(AliFMDFloatMap::kMaxDetectors, |
114 | AliFMDFloatMap::kMaxRings, | |
115 | 1, | |
c05d076f | 116 | AliFMDFloatMap::kMaxStrips), |
0cd61c1d | 117 | fNoiseFactor(0), |
c05d076f | 118 | fAngleCorrected(kFALSE) |
9da38871 | 119 | { |
120 | // Default CTOR | |
121 | } | |
122 | ||
123 | //____________________________________________________________________ | |
124 | AliESDFMD::AliESDFMD(const AliESDFMD& other) | |
125 | : TObject(other), | |
126 | fMultiplicity(other.fMultiplicity), | |
0cd61c1d | 127 | fEta(other.fEta), |
128 | fNoiseFactor(other.fNoiseFactor), | |
129 | fAngleCorrected(other.fAngleCorrected) | |
9da38871 | 130 | { |
131 | // Default CTOR | |
132 | } | |
133 | ||
134 | //____________________________________________________________________ | |
135 | AliESDFMD& | |
136 | AliESDFMD::operator=(const AliESDFMD& other) | |
137 | { | |
138 | // Default CTOR | |
316c6cd9 | 139 | if(this!=&other){ |
140 | TObject::operator=(other); | |
141 | fMultiplicity = other.fMultiplicity; | |
142 | fEta = other.fEta; | |
143 | } | |
9da38871 | 144 | return *this; |
145 | } | |
146 | ||
021f1396 | 147 | //____________________________________________________________________ |
148 | void | |
149 | AliESDFMD::Copy(TObject &obj) const | |
150 | { | |
732a24fe | 151 | // this overwrites the virtual TOBject::Copy() |
152 | // to allow run time copying without casting | |
153 | // in AliESDEvent | |
154 | ||
155 | if(this==&obj)return; | |
156 | AliESDFMD *robj = dynamic_cast<AliESDFMD*>(&obj); | |
157 | if(!robj)return; // not an AliESDFMD | |
158 | *robj = *this; | |
159 | } | |
160 | ||
c05d076f | 161 | //____________________________________________________________________ |
162 | void | |
163 | AliESDFMD::CheckNeedUShort(TFile* file) | |
164 | { | |
165 | fMultiplicity.CheckNeedUShort(file); | |
166 | fEta.CheckNeedUShort(file); | |
167 | } | |
168 | ||
9da38871 | 169 | //____________________________________________________________________ |
170 | void | |
171 | AliESDFMD::Clear(Option_t* ) | |
172 | { | |
173 | fMultiplicity.Reset(kInvalidMult); | |
174 | fEta.Reset(kInvalidEta); | |
175 | } | |
176 | ||
177 | ||
178 | //____________________________________________________________________ | |
179 | Float_t | |
180 | AliESDFMD::Multiplicity(UShort_t detector, Char_t ring, UShort_t sector, | |
181 | UShort_t strip) const | |
182 | { | |
183 | // Return rough estimate of charged particle multiplicity in the | |
184 | // strip FMD<detector><ring>[<sector>,<strip>]. | |
185 | // | |
186 | // Note, that this should at most be interpreted as the sum | |
187 | // multiplicity of secondaries and primaries. | |
188 | return fMultiplicity(detector, ring, sector, strip); | |
189 | } | |
190 | ||
191 | //____________________________________________________________________ | |
192 | Float_t | |
193 | AliESDFMD::Eta(UShort_t detector, Char_t ring, UShort_t /* sector */, | |
194 | UShort_t strip) const | |
195 | { | |
196 | // Return pseudo-rapidity of the strip | |
197 | // FMD<detector><ring>[<sector>,<strip>]. (actually, the sector | |
198 | // argument is ignored, as it is assumed that the primary vertex is | |
199 | // a (x,y) = (0,0), and that the modules are aligned with a | |
200 | // precision better than 2 degrees in the azimuthal angle). | |
201 | // | |
202 | return fEta(detector, ring, 0, strip); | |
203 | } | |
204 | ||
021f1396 | 205 | //____________________________________________________________________ |
206 | Float_t | |
207 | AliESDFMD::Phi(UShort_t detector, Char_t ring, UShort_t sector, UShort_t) const | |
208 | { | |
209 | // Return azimuthal angle (in degrees) of the strip | |
210 | // FMD<detector><ring>[<sector>,<strip>]. | |
211 | // | |
212 | Float_t baseAng = (detector == 1 ? 90 : | |
213 | detector == 2 ? 0 : 180); | |
214 | Float_t dAng = ((detector == 3 ? -1 : 1) * 360 / | |
215 | (ring == 'I' || ring == 'i' ? | |
216 | AliFMDMap::kNSectorInner : | |
217 | AliFMDMap::kNSectorOuter)); | |
218 | Float_t ret = baseAng + dAng * (sector + .5); | |
219 | if (ret > 360) ret -= 360; | |
220 | if (ret < 0) ret += 360; | |
221 | return ret; | |
222 | ||
223 | } | |
224 | ||
225 | //____________________________________________________________________ | |
226 | Float_t | |
227 | AliESDFMD::Theta(UShort_t detector, Char_t ring, UShort_t, UShort_t strip) const | |
228 | { | |
229 | // Return polar angle from beam line (in degrees) of the strip | |
230 | // FMD<detector><ring>[<sector>,<strip>]. | |
231 | // | |
232 | // This value is calculated from eta and therefor takes into account | |
233 | // the Z position of the interaction point. | |
234 | Float_t eta = Eta(detector, ring, 0, strip); | |
235 | Float_t theta = TMath::ATan(2 * TMath::Exp(-eta)); | |
236 | if (theta < 0) theta += TMath::Pi(); | |
237 | theta *= 180. / TMath::Pi(); | |
238 | return theta; | |
239 | } | |
240 | ||
241 | //____________________________________________________________________ | |
242 | Float_t | |
243 | AliESDFMD::R(UShort_t, Char_t ring, UShort_t, UShort_t strip) const | |
244 | { | |
245 | // Return radial distance from beam line (in cm) of the strip | |
246 | // FMD<detector><ring>[<sector>,<strip>]. | |
247 | // | |
248 | ||
249 | // Numbers are from AliFMDRing | |
250 | Float_t lR = (ring == 'I' || ring == 'i' ? 4.522 : 15.4); | |
251 | Float_t hR = (ring == 'I' || ring == 'i' ? 17.2 : 28.0); | |
252 | UShort_t nS = (ring == 'I' || ring == 'i' ? | |
253 | AliFMDMap::kNStripInner : | |
254 | AliFMDMap::kNStripOuter); | |
255 | Float_t dR = (hR - lR) / nS; | |
256 | Float_t ret = lR + dR * (strip + .5); | |
257 | return ret; | |
258 | ||
259 | } | |
260 | ||
9da38871 | 261 | //____________________________________________________________________ |
262 | void | |
263 | AliESDFMD::SetMultiplicity(UShort_t detector, Char_t ring, UShort_t sector, | |
264 | UShort_t strip, Float_t mult) | |
265 | { | |
266 | // Return rough estimate of charged particle multiplicity in the | |
267 | // strip FMD<detector><ring>[<sector>,<strip>]. | |
268 | // | |
269 | // Note, that this should at most be interpreted as the sum | |
270 | // multiplicity of secondaries and primaries. | |
271 | fMultiplicity(detector, ring, sector, strip) = mult; | |
272 | } | |
273 | ||
274 | //____________________________________________________________________ | |
275 | void | |
276 | AliESDFMD::SetEta(UShort_t detector, Char_t ring, UShort_t /* sector */, | |
277 | UShort_t strip, Float_t eta) | |
278 | { | |
279 | // Set pseudo-rapidity of the strip | |
280 | // FMD<detector><ring>[<sector>,<strip>]. (actually, the sector | |
281 | // argument is ignored, as it is assumed that the primary vertex is | |
282 | // a (x,y) = (0,0), and that the modules are aligned with a | |
283 | // precision better than 2 degrees in the azimuthal angle). | |
284 | // | |
285 | fEta(detector, ring, 0, strip) = eta; | |
286 | } | |
287 | ||
021f1396 | 288 | //____________________________________________________________________ |
289 | Bool_t | |
290 | AliESDFMD::ForEach(AliESDFMD::ForOne& a) const | |
291 | { | |
292 | ForMultiplicity i(*this, a); | |
293 | return fMultiplicity.ForEach(i); | |
294 | } | |
295 | ||
9da38871 | 296 | //____________________________________________________________________ |
297 | void | |
298 | AliESDFMD::Print(Option_t* /* option*/) const | |
299 | { | |
6169f936 | 300 | // Print all information to standard output. |
9da38871 | 301 | std::cout << "AliESDFMD:" << std::endl; |
021f1396 | 302 | Printer p; |
303 | ForEach(p); | |
304 | printf("\n"); | |
305 | #if 0 | |
9eeb02aa | 306 | for (UShort_t det = 1; det <= fMultiplicity.MaxDetectors(); det++) { |
307 | for (UShort_t ir = 0; ir < fMultiplicity.MaxRings(); ir++) { | |
9da38871 | 308 | Char_t ring = (ir == 0 ? 'I' : 'O'); |
309 | std::cout << "FMD" << det << ring << ":" << std::endl; | |
9eeb02aa | 310 | for (UShort_t sec = 0; sec < fMultiplicity.MaxSectors(); sec++) { |
9da38871 | 311 | std::cout << " Sector # " << sec << ":" << std::flush; |
9eeb02aa | 312 | for (UShort_t str = 0; str < fMultiplicity.MaxStrips(); str++) { |
9da38871 | 313 | if (str % 6 == 0) std::cout << "\n " << std::flush; |
314 | Float_t m = fMultiplicity(det, ring, sec, str); | |
315 | Float_t e = fEta(det, ring, 0, str); | |
316 | if (m == kInvalidMult && e == kInvalidEta) break; | |
317 | if (m == kInvalidMult) std::cout << " ---- "; | |
318 | else std::cout << Form("%6.3f", m); | |
319 | std::cout << "/"; | |
320 | if (e == kInvalidEta) std::cout << " ---- "; | |
321 | else std::cout << Form("%-6.3f", e); | |
322 | std::cout << " " << std::flush; | |
323 | } | |
324 | std::cout << std::endl; | |
325 | } | |
326 | } | |
327 | } | |
021f1396 | 328 | #endif |
9da38871 | 329 | } |
330 | ||
331 | ||
332 | //____________________________________________________________________ | |
333 | // | |
334 | // EOF | |
335 | // |