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