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 );
243 //_____________________________________________________________________________
245 AliMUONDigit::IsUsed() const
247 /// Whether this digit is used or not (in a cluster, for instance)
249 return (fFlags & fgkUsedMask );
252 //_____________________________________________________________________________
254 AliMUONDigit::IsEfficiencyApplied() const
256 /// Whether this digit had efficiency applied or not
258 return (fFlags & fgkEfficiencyMask );
261 //_____________________________________________________________________________
263 AliMUONDigit::Used(Bool_t value)
265 /// Set the Used status of this digit.
269 fFlags |= fgkUsedMask;
273 fFlags &= ~fgkUsedMask;
277 //_____________________________________________________________________________
279 AliMUONDigit::Calibrated(Bool_t value)
281 /// Set the Calibrated status of this digit.
285 fFlags |= fgkCalibratedMask;
289 fFlags &= ~fgkCalibratedMask;
293 //_____________________________________________________________________________
295 AliMUONDigit::EfficiencyApplied(Bool_t value)
297 /// Set the EfficiencyApplied status of this digit.
301 fFlags |= fgkEfficiencyMask;
305 fFlags &= ~fgkEfficiencyMask;
309 //_____________________________________________________________________________
311 AliMUONDigit::MergeWith(const AliMUONVDigit& src)
315 Bool_t check = ( src.DetElemId() == DetElemId() &&
316 src.PadX() == PadX() &&
317 src.PadY() == PadY() &&
318 src.Cathode() == Cathode() );
324 AddCharge(src.Charge());
325 for ( Int_t i = 0; i < src.Ntracks(); ++i )
327 AddTrack(src.Track(i),src.TrackCharge(i));
332 //_____________________________________________________________________________
334 AliMUONDigit::NoiseOnly(Bool_t value)
336 /// Set the NoiseOnly status of this digit.
340 fFlags |= fgkNoiseOnlyMask;
344 fFlags &= ~fgkNoiseOnlyMask;
348 //_____________________________________________________________________________
350 AliMUONDigit::operator=(const AliMUONDigit& digit)
352 /// Assignement operator.
354 if ( this != &digit )
361 //_____________________________________________________________________________
363 AliMUONDigit::PatchTracks(Int_t mask)
365 /// Add mask to each track number.
367 for ( Int_t i = 0; i < Ntracks(); ++i )
373 //_____________________________________________________________________________
375 AliMUONDigit::Saturated(Bool_t value)
377 /// Set the saturation status of this digit.
381 fFlags |= fgkSaturatedMask;
385 fFlags &= ~fgkSaturatedMask;
389 //_____________________________________________________________________________
391 AliMUONDigit::Track(Int_t i) const
393 /// Return the i-th track number (if i is >=0 and < Ntracks()) or -1.
395 if ( i >= 0 && i < fNtracks )
403 //_____________________________________________________________________________
405 AliMUONDigit::TrackCharge(Int_t i) const
407 /// Return the i-th track charge (if i is >=0 and < Ntracjs()) or -1.
409 if ( i >= 0 && i < fNtracks )
417 //_____________________________________________________________________________
419 AliMUONDigit::GetUniqueID() const
421 /// Return a single integer with id information
423 return BuildUniqueID(DetElemId(),ManuId(),ManuChannel(),Cathode());