#include "AliMUONDigit.h"
-#include "Riostream.h"
-#include "TString.h"
-
+//-----------------------------------------------------------------------------
/// \class AliMUONDigit
-/// A class representing a digit in the MUON spectrometer
-/// either in tracking or trigger chambers.
+/// A class representing a digit (with MC information if possible)
+/// in the MUON spectrometer either in tracking or trigger chambers.
///
/// A digit holds the signal (proportional to a charge) on a pad
/// (or strip).
///
/// This class is used to represent either sdigits (purely simulated digit,
-/// with no electronic noise whatsoever) or digits (either real digits or
-/// simulated ones but including electronic noise and de-calibration, to
-/// closely ressemble real ones).
+/// with no electronic noise whatsoever) or digits (simulated ones but
+/// including electronic noise and de-calibration, to closely ressemble real ones).
+//-----------------------------------------------------------------------------
/// \cond CLASSIMP
ClassImp(AliMUONDigit)
//_____________________________________________________________________________
AliMUONDigit::AliMUONDigit()
:
-TObject(),
-fDetElemId(-1),
-fManuId(-1),
-fManuChannel(-1),
+AliMUONVDigit(),
+fDetElemId(0),
+fManuId(0),
+fManuChannel(0),
fSignal(0.0),
fPadX(-1),
fPadY(-1),
-fCathode(-1),
+fCathode(0),
fADC(0),
fFlags(0),
fNtracks(0),
fTcharges(0x0),
fTracks(0x0),
-fPhysics(0.0),
fHit(0),
fStatusMap(0)
{
/// Default constructor
}
+//_____________________________________________________________________________
+AliMUONDigit::AliMUONDigit(Int_t detElemId, Int_t manuId,
+ Int_t manuChannel, Int_t cathode)
+:
+AliMUONVDigit(detElemId,manuId,manuChannel,cathode),
+fDetElemId(detElemId),
+fManuId(manuId),
+fManuChannel(manuChannel),
+fSignal(0.0),
+fPadX(-1),
+fPadY(-1),
+fCathode(cathode),
+fADC(0),
+fFlags(0),
+fNtracks(0),
+fTcharges(0x0),
+fTracks(0x0),
+fHit(0),
+fStatusMap(0)
+{
+ /// Normal constructor
+}
+
+
//_____________________________________________________________________________
AliMUONDigit::AliMUONDigit(const AliMUONDigit& digit)
-: TObject(digit),
-fDetElemId(-1),
-fManuId(-1),
-fManuChannel(-1),
+: AliMUONVDigit(),
+fDetElemId(0),
+fManuId(0),
+fManuChannel(0),
fSignal(0.0),
fPadX(-1),
fPadY(-1),
-fCathode(-1),
+fCathode(0),
fADC(0),
fFlags(0),
fNtracks(0),
fTcharges(0x0),
fTracks(0x0),
-fPhysics(0.0),
fHit(0),
fStatusMap(0)
{
fNtracks=0;
}
-//_____________________________________________________________________________
-Int_t AliMUONDigit::Compare(const TObject *obj) const
-{
- /// The order defined below is first by DE, then Signal, then
- /// manuId, and then manuChannel, i.e. it should be a total ordering...
-
- const AliMUONDigit* d = static_cast<const AliMUONDigit*>(obj);
-
- if ( DetElemId() > d->DetElemId() )
- {
- return 1;
- }
- else if ( DetElemId() < d->DetElemId() )
- {
- return -1;
- }
- else
- {
- if ( Signal() > d->Signal() )
- {
- return 1;
- }
- else if ( Signal() < d->Signal() )
- {
- return -1;
- }
- else
- {
- if ( ManuId() < d->ManuId() )
- {
- return 1;
- }
- else if ( ManuId() > d->ManuId() )
- {
- return -1;
- }
- else
- {
- return ( ManuChannel() < d->ManuChannel() ) ? 1 : -1;
- }
- }
- }
-}
-
//______________________________________________________________________________
void
AliMUONDigit::Copy(TObject& obj) const
digit.fTracks[i] = fTracks[i];
}
- digit.fPhysics = fPhysics;
digit.fHit = fHit;
digit.fStatusMap = fStatusMap;
}
+
//_____________________________________________________________________________
Bool_t
AliMUONDigit::IsNoiseOnly() const
return (fFlags & fgkSaturatedMask );
}
+//_____________________________________________________________________________
+Bool_t
+AliMUONDigit::IsCalibrated() const
+{
+ /// Whether this digit is calibrated or not
+
+ return (fFlags & fgkCalibratedMask );
+}
+
+
+//_____________________________________________________________________________
+Bool_t
+AliMUONDigit::IsUsed() const
+{
+ /// Whether this digit is used or not (in a cluster, for instance)
+
+ return (fFlags & fgkUsedMask );
+}
+
//_____________________________________________________________________________
Bool_t
AliMUONDigit::IsEfficiencyApplied() const
return (fFlags & fgkEfficiencyMask );
}
+//_____________________________________________________________________________
+void
+AliMUONDigit::Used(Bool_t value)
+{
+ /// Set the Used status of this digit.
+
+ if ( value )
+ {
+ fFlags |= fgkUsedMask;
+ }
+ else
+ {
+ fFlags ^= fgkUsedMask;
+ }
+}
+
+//_____________________________________________________________________________
+void
+AliMUONDigit::Calibrated(Bool_t value)
+{
+ /// Set the Calibrated status of this digit.
+
+ if ( value )
+ {
+ fFlags |= fgkCalibratedMask;
+ }
+ else
+ {
+ fFlags ^= fgkCalibratedMask;
+ }
+}
+
//_____________________________________________________________________________
void
AliMUONDigit::EfficiencyApplied(Bool_t value)
}
}
+//_____________________________________________________________________________
+Bool_t
+AliMUONDigit::MergeWith(const AliMUONVDigit& src)
+{
+ /// Merge with src.
+
+ Bool_t check = ( src.DetElemId() == DetElemId() &&
+ src.PadX() == PadX() &&
+ src.PadY() == PadY() &&
+ src.Cathode() == Cathode() );
+ if (!check)
+ {
+ return kFALSE;
+ }
+
+ AddCharge(src.Charge());
+ for ( Int_t i = 0; i < src.Ntracks(); ++i )
+ {
+ AddTrack(src.Track(i),src.TrackCharge(i));
+ }
+ return kTRUE;
+}
+
//_____________________________________________________________________________
void
AliMUONDigit::NoiseOnly(Bool_t value)
}
}
-//_____________________________________________________________________________
-void
-AliMUONDigit::Print(Option_t* opt) const
-{
- /// Dump to screen.
- /// If opt=="tracks", info on tracks are printed too.
-
- cout << Form("<AliMUONDigit>: DE %4d Cath %d (Ix,Iy)=(%3d,%3d) (Manu,Channel)=(%4d,%2d)"
- ", Signal=%7.2f Physics=%7.2f",
- DetElemId(),Cathode(),PadX(),PadY(),ManuId(),ManuChannel(),Signal(),
- Physics());
-
- if ( IsSaturated() )
- {
- cout << "(S)";
- }
- else
- {
- cout << " ";
- }
- cout << " ADC=" << setw(4) << ADC();
- cout << " Flags=0x" << setw(4) << hex << setfill('0') << fFlags << dec
- << setfill(' ');
- cout << " StatusMap=0x" << setw(4) << hex << setfill('0') << StatusMap() << dec
- << setfill(' ');
-
- TString options(opt);
- options.ToLower();
- if ( options.Contains("tracks") )
- {
- cout << " Hit " << setw(3) << Hit();
- Int_t ntracks = Ntracks();
- if (ntracks)
- {
- cout << " Tracks : " << setw(2) << ntracks;
- for ( Int_t i = 0; i < ntracks; ++i )
- {
- cout << " Track(" << i << ")=" << setw(3) << Track(i)
- << " Charge(" << i << ")=" << setw(5) << TrackCharge(i);
- }
- }
- else
- {
- cout << " no track info.";
- }
- }
- cout << endl;
-}
-
//_____________________________________________________________________________
void
AliMUONDigit::Saturated(Bool_t value)
}
}
-//_____________________________________________________________________________
-void
-AliMUONDigit::SetElectronics(Int_t manuId, Int_t manuChannel)
-{
- //
- //FIXME: should we check that the values are ok here ??
- //
- fManuId=manuId;
- fManuChannel=manuChannel;
-}
-
//_____________________________________________________________________________
Int_t
AliMUONDigit::Track(Int_t i) const
return -1;
}
+
+//_____________________________________________________________________________
+UInt_t
+AliMUONDigit::GetUniqueID() const
+{
+ /// Return a single integer with id information
+
+ return BuildUniqueID(DetElemId(),ManuId(),ManuChannel(),Cathode());
+}