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);
252 //_____________________________________________________________________________
254 AliMUONDigit::IsUsed() const
256 /// Whether this digit is used or not (in a cluster, for instance)
258 return (fFlags & fgkUsedMask );
261 //_____________________________________________________________________________
263 AliMUONDigit::IsEfficiencyApplied() const
265 /// Whether this digit had efficiency applied or not
267 return (fFlags & fgkEfficiencyMask );
270 //_____________________________________________________________________________
272 AliMUONDigit::Used(Bool_t value)
274 /// Set the Used status of this digit.
278 fFlags |= fgkUsedMask;
282 fFlags &= ~fgkUsedMask;
286 //_____________________________________________________________________________
288 AliMUONDigit::Calibrated(Bool_t value)
290 /// Set the Calibrated status of this digit.
294 fFlags |= fgkCalibratedMask;
298 fFlags &= ~fgkCalibratedMask;
302 //_____________________________________________________________________________
304 AliMUONDigit::EfficiencyApplied(Bool_t value)
306 /// Set the EfficiencyApplied status of this digit.
310 fFlags |= fgkEfficiencyMask;
314 fFlags &= ~fgkEfficiencyMask;
318 //_____________________________________________________________________________
320 AliMUONDigit::MergeWith(const AliMUONVDigit& src)
324 Bool_t check = ( src.DetElemId() == DetElemId() &&
325 src.PadX() == PadX() &&
326 src.PadY() == PadY() &&
327 src.Cathode() == Cathode() );
333 AddCharge(src.Charge());
334 for ( Int_t i = 0; i < src.Ntracks(); ++i )
336 AddTrack(src.Track(i),src.TrackCharge(i));
341 //_____________________________________________________________________________
343 AliMUONDigit::NoiseOnly(Bool_t value)
345 /// Set the NoiseOnly status of this digit.
349 fFlags |= fgkNoiseOnlyMask;
353 fFlags &= ~fgkNoiseOnlyMask;
357 //_____________________________________________________________________________
359 AliMUONDigit::operator=(const AliMUONDigit& digit)
361 /// Assignement operator.
363 if ( this != &digit )
370 //_____________________________________________________________________________
372 AliMUONDigit::PatchTracks(Int_t mask)
374 /// Add mask to each track number.
376 for ( Int_t i = 0; i < Ntracks(); ++i )
382 //_____________________________________________________________________________
384 AliMUONDigit::Saturated(Bool_t value)
386 /// Set the saturation status of this digit.
390 fFlags |= fgkSaturatedMask;
394 fFlags &= ~fgkSaturatedMask;
398 //_____________________________________________________________________________
400 AliMUONDigit::Converted(Bool_t value)
402 /// Set the convertion status of this digit.
406 fFlags |= fgkConverted;
410 fFlags &= ~fgkConverted;
414 //_____________________________________________________________________________
416 AliMUONDigit::Track(Int_t i) const
418 /// Return the i-th track number (if i is >=0 and < Ntracks()) or -1.
420 if ( i >= 0 && i < fNtracks )
428 //_____________________________________________________________________________
430 AliMUONDigit::TrackCharge(Int_t i) const
432 /// Return the i-th track charge (if i is >=0 and < Ntracjs()) or -1.
434 if ( i >= 0 && i < fNtracks )
442 //_____________________________________________________________________________
444 AliMUONDigit::GetUniqueID() const
446 /// Return a single integer with id information
448 return BuildUniqueID(DetElemId(),ManuId(),ManuChannel(),Cathode());