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()
56 /// Default constructor
59 //_____________________________________________________________________________
60 AliMUONDigit::AliMUONDigit(Int_t detElemId, Int_t manuId,
61 Int_t manuChannel, Int_t cathode)
63 AliMUONVDigit(detElemId,manuId,manuChannel,cathode),
64 fDetElemId(detElemId),
66 fManuChannel(manuChannel),
79 /// Normal constructor
83 //_____________________________________________________________________________
84 AliMUONDigit::AliMUONDigit(const AliMUONDigit& digit)
103 (static_cast<const AliMUONDigit&>(digit)).Copy(*this);
106 //_____________________________________________________________________________
107 AliMUONDigit::~AliMUONDigit()
115 //_____________________________________________________________________________
117 AliMUONDigit::AddTrack(Int_t trackNumber, Float_t trackCharge)
119 /// Add 1 track information to the track list we keep.
120 /// The implementation below is dumb, you've been warned !
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 )
126 if ( Track(i) == trackNumber )
128 fTcharges[i] += trackCharge;
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];
136 Float_t* newTcharges = new Float_t[fNtracks+1];
138 for ( Int_t i = 0; i < fNtracks; ++i )
140 newTracks[i] = fTracks[i];
141 newTcharges[i] = fTcharges[i];
144 newTracks[fNtracks] = trackNumber;
145 newTcharges[fNtracks] = trackCharge;
151 fTcharges = newTcharges;
156 //_____________________________________________________________________________
158 AliMUONDigit::Clear(Option_t*)
160 /// Reset this digit, in particular the internal arrays are deleted.
169 //______________________________________________________________________________
171 AliMUONDigit::Copy(TObject& obj) const
173 /// Copy this line to line.
176 AliMUONDigit& digit = static_cast<AliMUONDigit&>(obj);
178 digit.fDetElemId = fDetElemId;
179 digit.fManuId = fManuId;
180 digit.fManuChannel = fManuChannel;
181 digit.fSignal = fSignal;
185 digit.fCathode = fCathode;
187 digit.fFlags = fFlags;
189 digit.fNtracks = fNtracks;
191 delete[] digit.fTcharges;
192 delete[] digit.fTracks;
196 digit.fTcharges = new Float_t[fNtracks];
197 digit.fTracks = new Int_t[fNtracks];
200 for ( Int_t i=0; i<fNtracks; ++i )
202 digit.fTcharges[i] = fTcharges[i];
203 digit.fTracks[i] = fTracks[i];
207 digit.fStatusMap = fStatusMap;
211 //_____________________________________________________________________________
213 AliMUONDigit::IsNoiseOnly() const
215 /// Whether this (simulated only) digit is only due to noise.
217 return (fFlags & fgkNoiseOnlyMask );
220 //_____________________________________________________________________________
222 AliMUONDigit::IsSaturated() const
224 /// Whether this digit is saturated or not.
226 return (fFlags & fgkSaturatedMask );
229 //_____________________________________________________________________________
231 AliMUONDigit::IsCalibrated() const
233 /// Whether this digit is calibrated or not
235 return (fFlags & fgkCalibratedMask );
239 //_____________________________________________________________________________
241 AliMUONDigit::IsUsed() const
243 /// Whether this digit is used or not (in a cluster, for instance)
245 return (fFlags & fgkUsedMask );
248 //_____________________________________________________________________________
250 AliMUONDigit::IsEfficiencyApplied() const
252 /// Whether this digit had efficiency applied or not
254 return (fFlags & fgkEfficiencyMask );
257 //_____________________________________________________________________________
259 AliMUONDigit::Used(Bool_t value)
261 /// Set the Used status of this digit.
265 fFlags |= fgkUsedMask;
269 fFlags ^= fgkUsedMask;
273 //_____________________________________________________________________________
275 AliMUONDigit::Calibrated(Bool_t value)
277 /// Set the Calibrated status of this digit.
281 fFlags |= fgkCalibratedMask;
285 fFlags ^= fgkCalibratedMask;
289 //_____________________________________________________________________________
291 AliMUONDigit::EfficiencyApplied(Bool_t value)
293 /// Set the EfficiencyApplied status of this digit.
297 fFlags |= fgkEfficiencyMask;
301 fFlags ^= fgkEfficiencyMask;
305 //_____________________________________________________________________________
307 AliMUONDigit::MergeWith(const AliMUONVDigit& src)
311 Bool_t check = ( src.DetElemId() == DetElemId() &&
312 src.PadX() == PadX() &&
313 src.PadY() == PadY() &&
314 src.Cathode() == Cathode() );
320 AddCharge(src.Charge());
321 for ( Int_t i = 0; i < src.Ntracks(); ++i )
323 AddTrack(src.Track(i),src.TrackCharge(i));
328 //_____________________________________________________________________________
330 AliMUONDigit::NoiseOnly(Bool_t value)
332 /// Set the NoiseOnly status of this digit.
336 fFlags |= fgkNoiseOnlyMask;
340 fFlags ^= fgkNoiseOnlyMask;
344 //_____________________________________________________________________________
346 AliMUONDigit::operator=(const AliMUONDigit& digit)
348 /// Assignement operator.
350 if ( this != &digit )
357 //_____________________________________________________________________________
359 AliMUONDigit::PatchTracks(Int_t mask)
361 /// Add mask to each track number.
363 for ( Int_t i = 0; i < Ntracks(); ++i )
369 //_____________________________________________________________________________
371 AliMUONDigit::Saturated(Bool_t value)
373 /// Set the saturation status of this digit.
377 fFlags |= fgkSaturatedMask;
381 fFlags ^= fgkSaturatedMask;
385 //_____________________________________________________________________________
387 AliMUONDigit::Track(Int_t i) const
389 /// Return the i-th track number (if i is >=0 and < Ntracks()) or -1.
391 if ( i >= 0 && i < fNtracks )
399 //_____________________________________________________________________________
401 AliMUONDigit::TrackCharge(Int_t i) const
403 /// Return the i-th track charge (if i is >=0 and < Ntracjs()) or -1.
405 if ( i >= 0 && i < fNtracks )
413 //_____________________________________________________________________________
415 AliMUONDigit::GetUniqueID() const
417 /// Return a single integer with id information
419 return BuildUniqueID(DetElemId(),ManuId(),ManuChannel(),Cathode());