]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | ||
88cb7938 | 16 | /* $Id$ */ |
a9e2aefa | 17 | |
18 | #include "AliMUONDigit.h" | |
19 | ||
3d1463c8 | 20 | //----------------------------------------------------------------------------- |
5398f946 | 21 | /// \class AliMUONDigit |
5a91ea86 | 22 | /// A class representing a digit (with MC information if possible) |
23 | /// in the MUON spectrometer either in tracking or trigger chambers. | |
b1d79ad7 | 24 | /// |
25 | /// A digit holds the signal (proportional to a charge) on a pad | |
26 | /// (or strip). | |
27 | /// | |
28 | /// This class is used to represent either sdigits (purely simulated digit, | |
5a91ea86 | 29 | /// with no electronic noise whatsoever) or digits (simulated ones but |
30 | /// including electronic noise and de-calibration, to closely ressemble real ones). | |
3d1463c8 | 31 | //----------------------------------------------------------------------------- |
81b31073 | 32 | |
5398f946 | 33 | /// \cond CLASSIMP |
b1d79ad7 | 34 | ClassImp(AliMUONDigit) |
5398f946 | 35 | /// \endcond |
5350e3a6 | 36 | |
61adb9bd | 37 | //_____________________________________________________________________________ |
81b31073 | 38 | AliMUONDigit::AliMUONDigit() |
5350e3a6 | 39 | : |
5a91ea86 | 40 | AliMUONVDigit(), |
41 | fDetElemId(0), | |
42 | fManuId(0), | |
43 | fManuChannel(0), | |
8a92eee6 | 44 | fSignal(0.0), |
5350e3a6 | 45 | fPadX(-1), |
46 | fPadY(-1), | |
5a91ea86 | 47 | fCathode(0), |
81b31073 | 48 | fADC(0), |
5350e3a6 | 49 | fFlags(0), |
50 | fNtracks(0), | |
51 | fTcharges(0x0), | |
52 | fTracks(0x0), | |
aaf7adc0 | 53 | fHit(0), |
ea232c10 | 54 | fTime(0), |
aaf7adc0 | 55 | fStatusMap(0) |
61adb9bd | 56 | { |
5398f946 | 57 | /// Default constructor |
81b31073 | 58 | } |
61adb9bd | 59 | |
5a91ea86 | 60 | //_____________________________________________________________________________ |
61 | AliMUONDigit::AliMUONDigit(Int_t detElemId, Int_t manuId, | |
62 | Int_t manuChannel, Int_t cathode) | |
63 | : | |
64 | AliMUONVDigit(detElemId,manuId,manuChannel,cathode), | |
65 | fDetElemId(detElemId), | |
66 | fManuId(manuId), | |
67 | fManuChannel(manuChannel), | |
68 | fSignal(0.0), | |
69 | fPadX(-1), | |
70 | fPadY(-1), | |
71 | fCathode(cathode), | |
72 | fADC(0), | |
73 | fFlags(0), | |
74 | fNtracks(0), | |
75 | fTcharges(0x0), | |
76 | fTracks(0x0), | |
77 | fHit(0), | |
ea232c10 | 78 | fTime(0), |
5a91ea86 | 79 | fStatusMap(0) |
80 | { | |
81 | /// Normal constructor | |
82 | } | |
83 | ||
84 | ||
81b31073 | 85 | //_____________________________________________________________________________ |
86 | AliMUONDigit::AliMUONDigit(const AliMUONDigit& digit) | |
5a91ea86 | 87 | : AliMUONVDigit(), |
88 | fDetElemId(0), | |
89 | fManuId(0), | |
90 | fManuChannel(0), | |
8a92eee6 | 91 | fSignal(0.0), |
5350e3a6 | 92 | fPadX(-1), |
93 | fPadY(-1), | |
5a91ea86 | 94 | fCathode(0), |
5350e3a6 | 95 | fADC(0), |
96 | fFlags(0), | |
97 | fNtracks(0), | |
98 | fTcharges(0x0), | |
99 | fTracks(0x0), | |
aaf7adc0 | 100 | fHit(0), |
ea232c10 | 101 | fTime(0), |
aaf7adc0 | 102 | fStatusMap(0) |
81b31073 | 103 | { |
5398f946 | 104 | /// Copy constructor |
105 | ||
81b31073 | 106 | (static_cast<const AliMUONDigit&>(digit)).Copy(*this); |
61adb9bd | 107 | } |
108 | ||
5350e3a6 | 109 | //_____________________________________________________________________________ |
110 | AliMUONDigit::~AliMUONDigit() | |
111 | { | |
5398f946 | 112 | /// Destructor |
113 | ||
5350e3a6 | 114 | delete[] fTcharges; |
115 | delete[] fTracks; | |
116 | } | |
117 | ||
118 | //_____________________________________________________________________________ | |
119 | void | |
8a92eee6 | 120 | AliMUONDigit::AddTrack(Int_t trackNumber, Float_t trackCharge) |
5350e3a6 | 121 | { |
5398f946 | 122 | /// Add 1 track information to the track list we keep. |
123 | /// The implementation below is dumb, you've been warned ! | |
5350e3a6 | 124 | |
125 | // First check if track is already there, in which | |
126 | // case we simply increment its charge. | |
127 | for ( Int_t i = 0; i < Ntracks(); ++i ) | |
128 | { | |
129 | if ( Track(i) == trackNumber ) | |
130 | { | |
131 | fTcharges[i] += trackCharge; | |
132 | return; | |
133 | } | |
134 | } | |
135 | ||
136 | // Nope. It's a brand new track. Make a new array to get space | |
137 | // for it, copy the old array into new one, and add the track. | |
138 | Int_t* newTracks = new Int_t[fNtracks+1]; | |
8a92eee6 | 139 | Float_t* newTcharges = new Float_t[fNtracks+1]; |
5350e3a6 | 140 | |
141 | for ( Int_t i = 0; i < fNtracks; ++i ) | |
142 | { | |
143 | newTracks[i] = fTracks[i]; | |
144 | newTcharges[i] = fTcharges[i]; | |
145 | } | |
146 | ||
147 | newTracks[fNtracks] = trackNumber; | |
148 | newTcharges[fNtracks] = trackCharge; | |
149 | ||
150 | delete[] fTracks; | |
151 | delete[] fTcharges; | |
152 | ||
153 | fTracks = newTracks; | |
154 | fTcharges = newTcharges; | |
155 | ||
156 | ++fNtracks; | |
157 | } | |
158 | ||
159 | //_____________________________________________________________________________ | |
160 | void | |
161 | AliMUONDigit::Clear(Option_t*) | |
162 | { | |
5398f946 | 163 | /// Reset this digit, in particular the internal arrays are deleted. |
164 | ||
5350e3a6 | 165 | delete[] fTracks; |
166 | delete[] fTcharges; | |
167 | fTracks=0x0; | |
168 | fTcharges=0x0; | |
169 | fNtracks=0; | |
a9e2aefa | 170 | } |
171 | ||
5350e3a6 | 172 | //______________________________________________________________________________ |
173 | void | |
174 | AliMUONDigit::Copy(TObject& obj) const | |
175 | { | |
5398f946 | 176 | /// Copy this line to line. |
177 | ||
5350e3a6 | 178 | TObject::Copy(obj); |
179 | AliMUONDigit& digit = static_cast<AliMUONDigit&>(obj); | |
180 | ||
181 | digit.fDetElemId = fDetElemId; | |
182 | digit.fManuId = fManuId; | |
183 | digit.fManuChannel = fManuChannel; | |
184 | digit.fSignal = fSignal; | |
185 | ||
186 | digit.fPadX = fPadX; | |
187 | digit.fPadY = fPadY; | |
188 | digit.fCathode = fCathode; | |
189 | digit.fADC = fADC; | |
190 | digit.fFlags = fFlags; | |
191 | ||
192 | digit.fNtracks = fNtracks; | |
193 | ||
194 | delete[] digit.fTcharges; | |
195 | delete[] digit.fTracks; | |
196 | ||
197 | if ( fNtracks ) | |
198 | { | |
8a92eee6 | 199 | digit.fTcharges = new Float_t[fNtracks]; |
5350e3a6 | 200 | digit.fTracks = new Int_t[fNtracks]; |
201 | } | |
202 | ||
203 | for ( Int_t i=0; i<fNtracks; ++i ) | |
204 | { | |
205 | digit.fTcharges[i] = fTcharges[i]; | |
206 | digit.fTracks[i] = fTracks[i]; | |
207 | } | |
208 | ||
5350e3a6 | 209 | digit.fHit = fHit; |
ea232c10 | 210 | digit.fTime = fTime; |
aaf7adc0 | 211 | digit.fStatusMap = fStatusMap; |
5350e3a6 | 212 | } |
81b31073 | 213 | |
5a91ea86 | 214 | |
b1d79ad7 | 215 | //_____________________________________________________________________________ |
216 | Bool_t | |
217 | AliMUONDigit::IsNoiseOnly() const | |
218 | { | |
5398f946 | 219 | /// Whether this (simulated only) digit is only due to noise. |
220 | ||
b1d79ad7 | 221 | return (fFlags & fgkNoiseOnlyMask ); |
222 | } | |
223 | ||
5350e3a6 | 224 | //_____________________________________________________________________________ |
225 | Bool_t | |
226 | AliMUONDigit::IsSaturated() const | |
227 | { | |
5398f946 | 228 | /// Whether this digit is saturated or not. |
229 | ||
b1d79ad7 | 230 | return (fFlags & fgkSaturatedMask ); |
231 | } | |
232 | ||
5a91ea86 | 233 | //_____________________________________________________________________________ |
234 | Bool_t | |
235 | AliMUONDigit::IsCalibrated() const | |
236 | { | |
237 | /// Whether this digit is calibrated or not | |
238 | ||
239 | return (fFlags & fgkCalibratedMask ); | |
240 | } | |
241 | ||
242 | ||
243 | //_____________________________________________________________________________ | |
244 | Bool_t | |
245 | AliMUONDigit::IsUsed() const | |
246 | { | |
247 | /// Whether this digit is used or not (in a cluster, for instance) | |
248 | ||
249 | return (fFlags & fgkUsedMask ); | |
250 | } | |
251 | ||
b1d79ad7 | 252 | //_____________________________________________________________________________ |
1d4e6965 | 253 | Bool_t |
254 | AliMUONDigit::IsEfficiencyApplied() const | |
255 | { | |
256 | /// Whether this digit had efficiency applied or not | |
257 | ||
258 | return (fFlags & fgkEfficiencyMask ); | |
259 | } | |
260 | ||
5a91ea86 | 261 | //_____________________________________________________________________________ |
262 | void | |
263 | AliMUONDigit::Used(Bool_t value) | |
264 | { | |
265 | /// Set the Used status of this digit. | |
266 | ||
267 | if ( value ) | |
268 | { | |
269 | fFlags |= fgkUsedMask; | |
270 | } | |
271 | else | |
272 | { | |
b742a45b | 273 | fFlags &= ~fgkUsedMask; |
5a91ea86 | 274 | } |
275 | } | |
276 | ||
277 | //_____________________________________________________________________________ | |
278 | void | |
279 | AliMUONDigit::Calibrated(Bool_t value) | |
280 | { | |
281 | /// Set the Calibrated status of this digit. | |
282 | ||
283 | if ( value ) | |
284 | { | |
285 | fFlags |= fgkCalibratedMask; | |
286 | } | |
287 | else | |
288 | { | |
b742a45b | 289 | fFlags &= ~fgkCalibratedMask; |
5a91ea86 | 290 | } |
291 | } | |
292 | ||
1d4e6965 | 293 | //_____________________________________________________________________________ |
294 | void | |
295 | AliMUONDigit::EfficiencyApplied(Bool_t value) | |
296 | { | |
297 | /// Set the EfficiencyApplied status of this digit. | |
298 | ||
299 | if ( value ) | |
300 | { | |
301 | fFlags |= fgkEfficiencyMask; | |
302 | } | |
303 | else | |
304 | { | |
b742a45b | 305 | fFlags &= ~fgkEfficiencyMask; |
1d4e6965 | 306 | } |
307 | } | |
308 | ||
5a91ea86 | 309 | //_____________________________________________________________________________ |
310 | Bool_t | |
311 | AliMUONDigit::MergeWith(const AliMUONVDigit& src) | |
312 | { | |
313 | /// Merge with src. | |
314 | ||
315 | Bool_t check = ( src.DetElemId() == DetElemId() && | |
316 | src.PadX() == PadX() && | |
317 | src.PadY() == PadY() && | |
318 | src.Cathode() == Cathode() ); | |
319 | if (!check) | |
320 | { | |
321 | return kFALSE; | |
322 | } | |
323 | ||
324 | AddCharge(src.Charge()); | |
325 | for ( Int_t i = 0; i < src.Ntracks(); ++i ) | |
326 | { | |
327 | AddTrack(src.Track(i),src.TrackCharge(i)); | |
328 | } | |
329 | return kTRUE; | |
330 | } | |
331 | ||
1d4e6965 | 332 | //_____________________________________________________________________________ |
b1d79ad7 | 333 | void |
334 | AliMUONDigit::NoiseOnly(Bool_t value) | |
335 | { | |
5398f946 | 336 | /// Set the NoiseOnly status of this digit. |
337 | ||
b1d79ad7 | 338 | if ( value ) |
339 | { | |
340 | fFlags |= fgkNoiseOnlyMask; | |
341 | } | |
342 | else | |
343 | { | |
b742a45b | 344 | fFlags &= ~fgkNoiseOnlyMask; |
b1d79ad7 | 345 | } |
5350e3a6 | 346 | } |
81b31073 | 347 | |
5350e3a6 | 348 | //_____________________________________________________________________________ |
349 | AliMUONDigit& | |
350 | AliMUONDigit::operator=(const AliMUONDigit& digit) | |
351 | { | |
5398f946 | 352 | /// Assignement operator. |
353 | ||
0c8556b9 | 354 | if ( this != &digit ) |
355 | { | |
356 | digit.Copy(*this); | |
357 | } | |
5350e3a6 | 358 | return *this; |
359 | } | |
360 | ||
361 | //_____________________________________________________________________________ | |
362 | void | |
363 | AliMUONDigit::PatchTracks(Int_t mask) | |
364 | { | |
5398f946 | 365 | /// Add mask to each track number. |
366 | ||
5350e3a6 | 367 | for ( Int_t i = 0; i < Ntracks(); ++i ) |
368 | { | |
369 | fTracks[i] += mask; | |
370 | } | |
a9e2aefa | 371 | } |
61adb9bd | 372 | |
81b31073 | 373 | //_____________________________________________________________________________ |
374 | void | |
5350e3a6 | 375 | AliMUONDigit::Saturated(Bool_t value) |
81b31073 | 376 | { |
5398f946 | 377 | /// Set the saturation status of this digit. |
378 | ||
5350e3a6 | 379 | if ( value ) |
380 | { | |
b1d79ad7 | 381 | fFlags |= fgkSaturatedMask; |
5350e3a6 | 382 | } |
383 | else | |
384 | { | |
b742a45b | 385 | fFlags &= ~fgkSaturatedMask; |
5350e3a6 | 386 | } |
81b31073 | 387 | } |
a713db22 | 388 | |
81b31073 | 389 | //_____________________________________________________________________________ |
5350e3a6 | 390 | Int_t |
391 | AliMUONDigit::Track(Int_t i) const | |
81b31073 | 392 | { |
5398f946 | 393 | /// Return the i-th track number (if i is >=0 and < Ntracks()) or -1. |
394 | ||
5350e3a6 | 395 | if ( i >= 0 && i < fNtracks ) |
396 | { | |
397 | return fTracks[i]; | |
398 | } | |
399 | ||
400 | return -1; | |
81b31073 | 401 | } |
402 | ||
5350e3a6 | 403 | //_____________________________________________________________________________ |
8a92eee6 | 404 | Float_t |
5350e3a6 | 405 | AliMUONDigit::TrackCharge(Int_t i) const |
406 | { | |
5398f946 | 407 | /// Return the i-th track charge (if i is >=0 and < Ntracjs()) or -1. |
408 | ||
5350e3a6 | 409 | if ( i >= 0 && i < fNtracks ) |
410 | { | |
411 | return fTcharges[i]; | |
412 | } | |
81b31073 | 413 | |
5350e3a6 | 414 | return -1; |
415 | } | |
5a91ea86 | 416 | |
417 | //_____________________________________________________________________________ | |
418 | UInt_t | |
419 | AliMUONDigit::GetUniqueID() const | |
420 | { | |
421 | /// Return a single integer with id information | |
422 | ||
423 | return BuildUniqueID(DetElemId(),ManuId(),ManuChannel(),Cathode()); | |
424 | } |