1 /**************************************************************************
2 * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //____________________________________________________________________
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
26 #include "AliESDFMD.h" // ALIFMDESD_H
27 #include "AliLog.h" // ALILOG_H
28 #include "Riostream.h" // ROOT_Riostream
31 //____________________________________________________________________
34 ; // This is here to keep Emacs for indenting the next line
38 //____________________________________________________________________
40 // Private implementation of a AliFMDMap::ForOne to use in
41 // forwarding to AliESDFMD::ForOne
42 class ForMultiplicity : public AliFMDMap::ForOne
45 ForMultiplicity(const AliESDFMD& o, AliESDFMD::ForOne& a)
46 : fObject(o), fAlgo(a)
48 Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t,
51 Float_t e = fObject.Eta(d, r, 0, t);
52 return fAlgo.operator()(d, r, s, t, m, e);
54 Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Int_t)
58 Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, UShort_t)
62 Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Bool_t)
67 const AliESDFMD& fObject;
68 AliESDFMD::ForOne& fAlgo;
71 // Private implementation of AliESDFMD::ForOne to print an
73 class Printer : public AliESDFMD::ForOne
76 Printer() : fOldD(0), fOldR('-'), fOldS(1024) {}
77 Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t,
81 if (fOldD != 0) printf("\n");
84 printf("FMD%d", fOldD);
89 printf("\n %s ring", (r == 'I' ? "Inner" : "Outer"));
93 printf("\n Sector %d", fOldS);
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);
110 //____________________________________________________________________
111 AliESDFMD::AliESDFMD()
112 : fMultiplicity(0, 0, 0, 0),
113 fEta(AliFMDFloatMap::kMaxDetectors,
114 AliFMDFloatMap::kMaxRings,
116 AliFMDFloatMap::kMaxStrips),
118 fAngleCorrected(kFALSE)
123 //____________________________________________________________________
124 AliESDFMD::AliESDFMD(const AliESDFMD& other)
126 fMultiplicity(other.fMultiplicity),
128 fNoiseFactor(other.fNoiseFactor),
129 fAngleCorrected(other.fAngleCorrected)
134 //____________________________________________________________________
136 AliESDFMD::operator=(const AliESDFMD& other)
139 if(this == &other) return *this;
141 TObject::operator=(other);
142 fMultiplicity = other.fMultiplicity;
145 // These two lines were missing prior to version 4 of this class
146 fNoiseFactor = other.fNoiseFactor;
147 fAngleCorrected = other.fAngleCorrected;
152 //____________________________________________________________________
154 AliESDFMD::Copy(TObject &obj) const
156 // this overwrites the virtual TOBject::Copy()
157 // to allow run time copying without casting
160 if(this==&obj)return;
161 AliESDFMD *robj = dynamic_cast<AliESDFMD*>(&obj);
162 if(!robj)return; // not an AliESDFMD
166 //____________________________________________________________________
168 AliESDFMD::CheckNeedUShort(TFile* file)
170 fMultiplicity.CheckNeedUShort(file);
171 fEta.CheckNeedUShort(file);
174 //____________________________________________________________________
176 AliESDFMD::Clear(Option_t* )
178 fMultiplicity.Reset(kInvalidMult);
179 fEta.Reset(kInvalidEta);
183 //____________________________________________________________________
185 AliESDFMD::Multiplicity(UShort_t detector, Char_t ring, UShort_t sector,
186 UShort_t strip) const
188 // Return rough estimate of charged particle multiplicity in the
189 // strip FMD<detector><ring>[<sector>,<strip>].
191 // Note, that this should at most be interpreted as the sum
192 // multiplicity of secondaries and primaries.
193 return fMultiplicity(detector, ring, sector, strip);
196 //____________________________________________________________________
198 AliESDFMD::Eta(UShort_t detector, Char_t ring, UShort_t /* sector */,
199 UShort_t strip) const
201 // Return pseudo-rapidity of the strip
202 // FMD<detector><ring>[<sector>,<strip>]. (actually, the sector
203 // argument is ignored, as it is assumed that the primary vertex is
204 // a (x,y) = (0,0), and that the modules are aligned with a
205 // precision better than 2 degrees in the azimuthal angle).
207 return fEta(detector, ring, 0, strip);
210 //____________________________________________________________________
212 AliESDFMD::Phi(UShort_t detector, Char_t ring, UShort_t sector, UShort_t) const
214 // Return azimuthal angle (in degrees) of the strip
215 // FMD<detector><ring>[<sector>,<strip>].
217 Float_t baseAng = (detector == 1 ? 90 :
218 detector == 2 ? 0 : 180);
219 Float_t dAng = ((detector == 3 ? -1 : 1) * 360 /
220 (ring == 'I' || ring == 'i' ?
221 AliFMDMap::kNSectorInner :
222 AliFMDMap::kNSectorOuter));
223 Float_t ret = baseAng + dAng * (sector + .5);
224 if (ret > 360) ret -= 360;
225 if (ret < 0) ret += 360;
230 //____________________________________________________________________
232 AliESDFMD::Theta(UShort_t detector, Char_t ring, UShort_t, UShort_t strip) const
234 // Return polar angle from beam line (in degrees) of the strip
235 // FMD<detector><ring>[<sector>,<strip>].
237 // This value is calculated from eta and therefor takes into account
238 // the Z position of the interaction point.
239 Float_t eta = Eta(detector, ring, 0, strip);
240 Float_t theta = TMath::ATan(2 * TMath::Exp(-eta));
241 if (theta < 0) theta += TMath::Pi();
242 theta *= 180. / TMath::Pi();
246 //____________________________________________________________________
248 AliESDFMD::R(UShort_t, Char_t ring, UShort_t, UShort_t strip) const
250 // Return radial distance from beam line (in cm) of the strip
251 // FMD<detector><ring>[<sector>,<strip>].
254 // Numbers are from AliFMDRing
255 Float_t lR = (ring == 'I' || ring == 'i' ? 4.522 : 15.4);
256 Float_t hR = (ring == 'I' || ring == 'i' ? 17.2 : 28.0);
257 UShort_t nS = (ring == 'I' || ring == 'i' ?
258 AliFMDMap::kNStripInner :
259 AliFMDMap::kNStripOuter);
260 Float_t dR = (hR - lR) / nS;
261 Float_t ret = lR + dR * (strip + .5);
266 //____________________________________________________________________
268 AliESDFMD::SetMultiplicity(UShort_t detector, Char_t ring, UShort_t sector,
269 UShort_t strip, Float_t mult)
271 // Return rough estimate of charged particle multiplicity in the
272 // strip FMD<detector><ring>[<sector>,<strip>].
274 // Note, that this should at most be interpreted as the sum
275 // multiplicity of secondaries and primaries.
276 fMultiplicity(detector, ring, sector, strip) = mult;
279 //____________________________________________________________________
281 AliESDFMD::SetEta(UShort_t detector, Char_t ring, UShort_t /* sector */,
282 UShort_t strip, Float_t eta)
284 // Set pseudo-rapidity of the strip
285 // FMD<detector><ring>[<sector>,<strip>]. (actually, the sector
286 // argument is ignored, as it is assumed that the primary vertex is
287 // a (x,y) = (0,0), and that the modules are aligned with a
288 // precision better than 2 degrees in the azimuthal angle).
290 fEta(detector, ring, 0, strip) = eta;
293 //____________________________________________________________________
295 AliESDFMD::ForEach(AliESDFMD::ForOne& a) const
297 ForMultiplicity i(*this, a);
298 return fMultiplicity.ForEach(i);
300 //____________________________________________________________________
302 AliESDFMD::Print(Option_t* /* option*/) const
304 // Print all information to standard output.
305 std::cout << "AliESDFMD:" << std::endl;
310 for (UShort_t det = 1; det <= fMultiplicity.MaxDetectors(); det++) {
311 for (UShort_t ir = 0; ir < fMultiplicity.MaxRings(); ir++) {
312 Char_t ring = (ir == 0 ? 'I' : 'O');
313 std::cout << "FMD" << det << ring << ":" << std::endl;
314 for (UShort_t sec = 0; sec < fMultiplicity.MaxSectors(); sec++) {
315 std::cout << " Sector # " << sec << ":" << std::flush;
316 for (UShort_t str = 0; str < fMultiplicity.MaxStrips(); str++) {
317 if (str % 6 == 0) std::cout << "\n " << std::flush;
318 Float_t m = fMultiplicity(det, ring, sec, str);
319 Float_t e = fEta(det, ring, 0, str);
320 if (m == kInvalidMult && e == kInvalidEta) break;
321 if (m == kInvalidMult) std::cout << " ---- ";
322 else std::cout << Form("%6.3f", m);
324 if (e == kInvalidEta) std::cout << " ---- ";
325 else std::cout << Form("%-6.3f", e);
326 std::cout << " " << std::flush;
328 std::cout << std::endl;
336 //____________________________________________________________________