1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 #include "AliMUONDigit.h"
20 //-----------------------------------------------------------------------------
21 /// \class AliMUONDigit
22 /// A class representing a digit (with MC information if possible)
23 /// in the MUON spectrometer either in tracking or trigger chambers.
25 /// A digit holds the signal (proportional to a charge) on a pad
28 /// This class is used to represent either sdigits (purely simulated digit,
29 /// with no electronic noise whatsoever) or digits (simulated ones but
30 /// including electronic noise and de-calibration, to closely ressemble real ones).
31 //-----------------------------------------------------------------------------
34 ClassImp(AliMUONDigit)
37 //_____________________________________________________________________________
38 AliMUONDigit::AliMUONDigit()
57 /// Default constructor
60 //_____________________________________________________________________________
61 AliMUONDigit::AliMUONDigit(Int_t detElemId, Int_t manuId,
62 Int_t manuChannel, Int_t cathode)
64 AliMUONVDigit(detElemId,manuId,manuChannel,cathode),
65 fDetElemId(detElemId),
67 fManuChannel(manuChannel),
81 /// Normal constructor
85 //_____________________________________________________________________________
86 AliMUONDigit::AliMUONDigit(const AliMUONDigit& digit)
106 (static_cast<const AliMUONDigit&>(digit)).Copy(*this);
109 //_____________________________________________________________________________
110 AliMUONDigit::~AliMUONDigit()
118 //_____________________________________________________________________________
120 AliMUONDigit::AddTrack(Int_t trackNumber, Float_t trackCharge)
122 /// Add 1 track information to the track list we keep.
123 /// The implementation below is dumb, you've been warned !
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 )
129 if ( Track(i) == trackNumber )
131 fTcharges[i] += trackCharge;
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];
139 Float_t* newTcharges = new Float_t[fNtracks+1];
141 for ( Int_t i = 0; i < fNtracks; ++i )
143 newTracks[i] = fTracks[i];
144 newTcharges[i] = fTcharges[i];
147 newTracks[fNtracks] = trackNumber;
148 newTcharges[fNtracks] = trackCharge;
154 fTcharges = newTcharges;
159 //_____________________________________________________________________________
161 AliMUONDigit::Clear(Option_t*)
163 /// Reset this digit, in particular the internal arrays are deleted.
172 //______________________________________________________________________________
174 AliMUONDigit::Copy(TObject& obj) const
176 /// Copy this line to line.
179 AliMUONDigit& digit = static_cast<AliMUONDigit&>(obj);
181 digit.fDetElemId = fDetElemId;
182 digit.fManuId = fManuId;
183 digit.fManuChannel = fManuChannel;
184 digit.fSignal = fSignal;
188 digit.fCathode = fCathode;
190 digit.fFlags = fFlags;
192 digit.fNtracks = fNtracks;
194 delete[] digit.fTcharges;
195 delete[] digit.fTracks;
199 digit.fTcharges = new Float_t[fNtracks];
200 digit.fTracks = new Int_t[fNtracks];
203 for ( Int_t i=0; i<fNtracks; ++i )
205 digit.fTcharges[i] = fTcharges[i];
206 digit.fTracks[i] = fTracks[i];
211 digit.fStatusMap = fStatusMap;
215 //_____________________________________________________________________________
217 AliMUONDigit::IsNoiseOnly() const
219 /// Whether this (simulated only) digit is only due to noise.
221 return (fFlags & fgkNoiseOnlyMask );
224 //_____________________________________________________________________________
226 AliMUONDigit::IsSaturated() const
228 /// Whether this digit is saturated or not.
230 return (fFlags & fgkSaturatedMask );
233 //_____________________________________________________________________________
235 AliMUONDigit::IsCalibrated() const
237 /// Whether this digit is calibrated or not
239 return (fFlags & fgkCalibratedMask );
242 //_____________________________________________________________________________
244 AliMUONDigit::IsConverted() const
246 /// Whether this digit is converted or not
248 return (fFlags & fgkConverted);
251 //_____________________________________________________________________________
253 AliMUONDigit::IsChargeInFC() const
255 /// Whether this digit is converted or not
257 return (fFlags & fgkChargeInFC);
261 //_____________________________________________________________________________
263 AliMUONDigit::IsUsed() const
265 /// Whether this digit is used or not (in a cluster, for instance)
267 return (fFlags & fgkUsedMask );
270 //_____________________________________________________________________________
272 AliMUONDigit::IsEfficiencyApplied() const
274 /// Whether this digit had efficiency applied or not
276 return (fFlags & fgkEfficiencyMask );
279 //_____________________________________________________________________________
281 AliMUONDigit::Used(Bool_t value)
283 /// Set the Used status of this digit.
287 fFlags |= fgkUsedMask;
291 fFlags &= ~fgkUsedMask;
295 //_____________________________________________________________________________
297 AliMUONDigit::Calibrated(Bool_t value)
299 /// Set the Calibrated status of this digit.
303 fFlags |= fgkCalibratedMask;
307 fFlags &= ~fgkCalibratedMask;
311 //_____________________________________________________________________________
313 AliMUONDigit::EfficiencyApplied(Bool_t value)
315 /// Set the EfficiencyApplied status of this digit.
319 fFlags |= fgkEfficiencyMask;
323 fFlags &= ~fgkEfficiencyMask;
327 //_____________________________________________________________________________
329 AliMUONDigit::MergeWith(const AliMUONVDigit& src)
333 Bool_t check = ( src.DetElemId() == DetElemId() &&
334 src.PadX() == PadX() &&
335 src.PadY() == PadY() &&
336 src.Cathode() == Cathode() );
342 AddCharge(src.Charge());
343 for ( Int_t i = 0; i < src.Ntracks(); ++i )
345 AddTrack(src.Track(i),src.TrackCharge(i));
350 //_____________________________________________________________________________
352 AliMUONDigit::NoiseOnly(Bool_t value)
354 /// Set the NoiseOnly status of this digit.
358 fFlags |= fgkNoiseOnlyMask;
362 fFlags &= ~fgkNoiseOnlyMask;
366 //_____________________________________________________________________________
368 AliMUONDigit::operator=(const AliMUONDigit& digit)
370 /// Assignement operator.
372 if ( this != &digit )
379 //_____________________________________________________________________________
381 AliMUONDigit::PatchTracks(Int_t mask)
383 /// Add mask to each track number.
385 for ( Int_t i = 0; i < Ntracks(); ++i )
391 //_____________________________________________________________________________
393 AliMUONDigit::Saturated(Bool_t value)
395 /// Set the saturation status of this digit.
399 fFlags |= fgkSaturatedMask;
403 fFlags &= ~fgkSaturatedMask;
407 //_____________________________________________________________________________
409 AliMUONDigit::Converted(Bool_t value)
411 /// Set the convertion status of this digit.
415 fFlags |= fgkConverted;
419 fFlags &= ~fgkConverted;
423 //_____________________________________________________________________________
425 AliMUONDigit::ChargeInFC(Bool_t value)
427 /// Set the convertion status of this digit.
431 fFlags |= fgkChargeInFC;
435 fFlags &= ~fgkChargeInFC;
439 //_____________________________________________________________________________
441 AliMUONDigit::Track(Int_t i) const
443 /// Return the i-th track number (if i is >=0 and < Ntracks()) or -1.
445 if ( i >= 0 && i < fNtracks )
453 //_____________________________________________________________________________
455 AliMUONDigit::TrackCharge(Int_t i) const
457 /// Return the i-th track charge (if i is >=0 and < Ntracjs()) or -1.
459 if ( i >= 0 && i < fNtracks )
467 //_____________________________________________________________________________
469 AliMUONDigit::GetUniqueID() const
471 /// Return a single integer with id information
473 return BuildUniqueID(DetElemId(),ManuId(),ManuChannel(),Cathode());