/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /* $Id$ */ #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 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). /// \cond CLASSIMP ClassImp(AliMUONDigit) /// \endcond //_____________________________________________________________________________ AliMUONDigit::AliMUONDigit() : TObject(), fDetElemId(-1), fManuId(-1), fManuChannel(-1), fSignal(0), fPadX(-1), fPadY(-1), fCathode(-1), fADC(0), fFlags(0), fNtracks(0), fTcharges(0x0), fTracks(0x0), fPhysics(0), fHit(0) { /// Default constructor } //_____________________________________________________________________________ AliMUONDigit::AliMUONDigit(const AliMUONDigit& digit) : TObject(digit), fDetElemId(-1), fManuId(-1), fManuChannel(-1), fSignal(0), fPadX(-1), fPadY(-1), fCathode(-1), fADC(0), fFlags(0), fNtracks(0), fTcharges(0x0), fTracks(0x0), fPhysics(0), fHit(0) { /// Copy constructor (static_cast(digit)).Copy(*this); } //_____________________________________________________________________________ AliMUONDigit::AliMUONDigit(Int_t *digits) : TObject(), fDetElemId(-1), fManuId(-1), fManuChannel(-1), fSignal(0), fPadX(-1), fPadY(-1), fCathode(-1), fADC(0), fFlags(0), fNtracks(0), fTcharges(0x0), fTracks(0x0), fPhysics(0), fHit(0) { /// Creates a MUON digit object to be updated /// \deprecated fPadX = digits[0]; fPadY = digits[1]; fCathode = digits[2]; fSignal = digits[3]; fPhysics = digits[4]; fHit = digits[5]; fDetElemId = digits[6]; fManuId = -1; fManuChannel = -1; fADC=0; fFlags = 0; } //_____________________________________________________________________________ AliMUONDigit::AliMUONDigit(Int_t *tracks, Int_t *charges, Int_t *digits) : TObject(), fDetElemId(-1), fManuId(-1), fManuChannel(-1), fSignal(0), fPadX(-1), fPadY(-1), fCathode(-1), fADC(0), fFlags(0), fNtracks(0), fTcharges(0x0), fTracks(0x0), fPhysics(0), fHit(0) { /// Creates a MUON digit object /// \deprecated fPadX = digits[0]; fPadY = digits[1]; fCathode = digits[2]; fSignal = digits[3]; fPhysics = digits[4]; fHit = digits[5]; fDetElemId = digits[6]; fManuId = -1; fManuChannel = -1; fADC=0; // For backward compatibility, which assumed 10 tracks. fNtracks = 10; fTcharges = new Int_t[fNtracks]; fTracks = new Int_t[fNtracks]; for ( Int_t i=0; i(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 { /// Copy this line to line. TObject::Copy(obj); AliMUONDigit& digit = static_cast(obj); digit.fDetElemId = fDetElemId; digit.fManuId = fManuId; digit.fManuChannel = fManuChannel; digit.fSignal = fSignal; digit.fPadX = fPadX; digit.fPadY = fPadY; digit.fCathode = fCathode; digit.fADC = fADC; digit.fFlags = fFlags; digit.fNtracks = fNtracks; delete[] digit.fTcharges; delete[] digit.fTracks; if ( fNtracks ) { digit.fTcharges = new Int_t[fNtracks]; digit.fTracks = new Int_t[fNtracks]; } for ( Int_t i=0; i: DetEle " << setw(5) << DetElemId() << " Cath " << setw(2) << Cathode() << " (Ix,Iy)=(" << setw(3) << PadX() << "," << setw(3) << PadY() << ") " << " (Manu,Channel)=(" << setw(4) << ManuId() << "," << setw(3) << ManuChannel() << ")" << " Signal=" << setw(6) << Signal() << " Physics=" << setw(4) << Physics(); if ( IsSaturated() ) { cout << "(S)"; } else { cout << " "; } cout << " ADC=" << setw(4) << ADC(); cout << " Flags=0x" << setw(4) << hex << setfill('0') << fFlags << 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) { /// Set the saturation status of this digit. if ( value ) { fFlags |= fgkSaturatedMask; } else { fFlags ^= fgkSaturatedMask; } } //_____________________________________________________________________________ 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 the i-th track number (if i is >=0 and < Ntracks()) or -1. if ( i >= 0 && i < fNtracks ) { return fTracks[i]; } return -1; } //_____________________________________________________________________________ Int_t AliMUONDigit::TrackCharge(Int_t i) const { /// Return the i-th track charge (if i is >=0 and < Ntracjs()) or -1. if ( i >= 0 && i < fNtracks ) { return fTcharges[i]; } return -1; }