CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

EcalUncalibratedRecHit Class Reference

#include <EcalUncalibratedRecHit.h>

List of all members.

Public Types

enum  Flags {
  kGood = -1, kPoorReco, kSaturated, kOutOfTime,
  kLeadingEdgeRecovered, kHasSwitchToGain6, kHasSwitchToGain1
}
typedef DetId key_type

Public Member Functions

float amplitude () const
bool checkFlag (Flags flag) const
float chi2 () const
 EcalUncalibratedRecHit ()
 EcalUncalibratedRecHit (const DetId &detId, float ampl, float ped, float jit, float chi2, uint32_t flags=0, uint32_t aux=0)
uint32_t flags () const
DetId id () const
bool isJitterErrorValid () const
bool isJitterValid () const
bool isSaturated () const
float jitter () const
float jitterError () const
uint8_t jitterErrorBits () const
float outOfTimeChi2 () const
float outOfTimeEnergy () const
float pedestal () const
void setAmplitude (float amplitude)
void setAux (uint32_t aux)
void setChi2 (float chi2)
void setFlagBit (Flags flag)
void setFlags (uint32_t flags)
void setId (DetId id)
void setJitter (float jitter)
void setJitterError (float jitterErr)
void setOutOfTimeChi2 (float chi2)
void setOutOfTimeEnergy (float energy)
void setPedestal (float pedestal)
virtual ~EcalUncalibratedRecHit ()

Private Attributes

float amplitude_
uint32_t aux_
float chi2_
uint32_t flags_
DetId id_
float jitter_
float OOTamplitude_
float OOTchi2_
float pedestal_

Detailed Description

Definition at line 7 of file EcalUncalibratedRecHit.h.


Member Typedef Documentation

Definition at line 11 of file EcalUncalibratedRecHit.h.


Member Enumeration Documentation

Enumerator:
kGood 
kPoorReco 
kSaturated 
kOutOfTime 
kLeadingEdgeRecovered 
kHasSwitchToGain6 
kHasSwitchToGain1 

Definition at line 13 of file EcalUncalibratedRecHit.h.

             {
          kGood=-1,                 // channel is good (mutually exclusive with other states)  setFlagBit(kGood) reset flags_ to zero 
          kPoorReco,                // channel has been badly reconstructed (e.g. bad shape, bad chi2 etc.)
          kSaturated,               // saturated channel
          kOutOfTime,               // channel out of time
          kLeadingEdgeRecovered,    // saturated channel: energy estimated from the leading edge before saturation
          kHasSwitchToGain6,        // at least one data frame is in G6
          kHasSwitchToGain1         // at least one data frame is in G1
          
  };

Constructor & Destructor Documentation

EcalUncalibratedRecHit::EcalUncalibratedRecHit ( )

Definition at line 5 of file EcalUncalibratedRecHit.cc.

                                               :
     amplitude_(0.), pedestal_(0.), jitter_(0.), chi2_(10000.), OOTamplitude_(0.), OOTchi2_(10000.), flags_(0), aux_(0) { }
EcalUncalibratedRecHit::EcalUncalibratedRecHit ( const DetId detId,
float  ampl,
float  ped,
float  jit,
float  chi2,
uint32_t  flags = 0,
uint32_t  aux = 0 
)

Definition at line 8 of file EcalUncalibratedRecHit.cc.

                                                                               :
     amplitude_(ampl), pedestal_(ped), jitter_(jit), chi2_(chi2), OOTamplitude_(0.), OOTchi2_(10000.), flags_(flags), aux_(aux), id_(id) { }
EcalUncalibratedRecHit::~EcalUncalibratedRecHit ( ) [virtual]

Definition at line 12 of file EcalUncalibratedRecHit.cc.

                                                {
}

Member Function Documentation

float EcalUncalibratedRecHit::amplitude ( ) const [inline]
bool EcalUncalibratedRecHit::checkFlag ( EcalUncalibratedRecHit::Flags  flag) const

Definition at line 110 of file EcalUncalibratedRecHit.cc.

References flags_, and kGood.

Referenced by isSaturated(), and EcalRecHitSimpleAlgo::makeRecHit().

                                                                             {
       if(flag == kGood){ if ( ! flags_ ) return true;else return false;} // if all flags are unset, then hit is good
       return  flags_ & ( 0x1<<flag);
}
float EcalUncalibratedRecHit::chi2 ( void  ) const [inline]

Definition at line 32 of file EcalUncalibratedRecHit.h.

References chi2_.

Referenced by EcalRecHitSimpleAlgo::makeRecHit(), setChi2(), and setOutOfTimeChi2().

{ return chi2_; }
uint32_t EcalUncalibratedRecHit::flags ( ) const [inline]

Definition at line 36 of file EcalUncalibratedRecHit.h.

References flags_.

Referenced by EcalRecHitWorkerRecover::run(), and setFlags().

{ return flags_; }
DetId EcalUncalibratedRecHit::id ( void  ) const [inline]
bool EcalUncalibratedRecHit::isJitterErrorValid ( ) const

Definition at line 81 of file EcalUncalibratedRecHit.cc.

References isJitterValid(), and jitterError().

{
        if(!isJitterValid())
          return false;
        if(jitterError() >= 10000)
          return false;

        return true;
}
bool EcalUncalibratedRecHit::isJitterValid ( ) const

Definition at line 73 of file EcalUncalibratedRecHit.cc.

References jitterError().

Referenced by isJitterErrorValid().

{
        if(jitterError() <= 0)
          return false;
        else
          return true;
}
bool EcalUncalibratedRecHit::isSaturated ( ) const
float EcalUncalibratedRecHit::jitter ( ) const [inline]

Definition at line 31 of file EcalUncalibratedRecHit.h.

References jitter_.

Referenced by EcalURecHitHists::analyze(), EcalRecHitSimpleAlgo::makeRecHit(), and setJitter().

{ return jitter_; }
float EcalUncalibratedRecHit::jitterError ( ) const

Definition at line 20 of file EcalUncalibratedRecHit.cc.

References aux_, jitterErrorBits(), and funct::pow().

Referenced by isJitterErrorValid(), and isJitterValid().

{
        // stored in ps, but return BXs to match with jitter units
        uint32_t jitterErrorBits = 0xFF & aux_;
        // all bits off --> time reco bailed out (return negative value)
        if( (0xFF & jitterErrorBits) == 0x00)
                return -1;
        // all bits on  --> time error over 5 ns (return large value)
        if( (0xFF & jitterErrorBits) == 0xFF)
                return 10000;

        float LSB = 1.26008;
        uint8_t exponent = jitterErrorBits>>5;
        uint8_t significand = jitterErrorBits & ~(0x7<<5);
        return (float)(pow(2.,exponent)*significand*LSB)/(25.*1000);
}
uint8_t EcalUncalibratedRecHit::jitterErrorBits ( ) const

Definition at line 91 of file EcalUncalibratedRecHit.cc.

References aux_.

Referenced by jitterError(), EcalRecHitSimpleAlgo::makeRecHit(), and setJitterError().

{
        uint8_t jitterErrorBits = 0xFF & aux_;
        return jitterErrorBits;
}
float EcalUncalibratedRecHit::outOfTimeChi2 ( ) const [inline]

Definition at line 34 of file EcalUncalibratedRecHit.h.

References OOTchi2_.

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

{ return OOTchi2_; }
float EcalUncalibratedRecHit::outOfTimeEnergy ( ) const [inline]

Definition at line 33 of file EcalUncalibratedRecHit.h.

References OOTamplitude_.

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

{ return OOTamplitude_; }
float EcalUncalibratedRecHit::pedestal ( ) const [inline]

Definition at line 30 of file EcalUncalibratedRecHit.h.

References pedestal_.

Referenced by setPedestal().

{ return pedestal_; }
void EcalUncalibratedRecHit::setAmplitude ( float  amplitude) [inline]

Definition at line 41 of file EcalUncalibratedRecHit.h.

References amplitude(), and amplitude_.

Referenced by EcalUncalibRecHitWorkerRatio::run().

void EcalUncalibratedRecHit::setAux ( uint32_t  aux) [inline]

Definition at line 51 of file EcalUncalibratedRecHit.h.

References printConversionInfo::aux, and aux_.

{ aux_ = aux; }
void EcalUncalibratedRecHit::setChi2 ( float  chi2) [inline]

Definition at line 44 of file EcalUncalibratedRecHit.h.

References chi2(), and chi2_.

{ chi2_ = chi2; }
void EcalUncalibratedRecHit::setFlagBit ( EcalUncalibratedRecHit::Flags  flag)

Definition at line 98 of file EcalUncalibratedRecHit.cc.

References flags_, and kGood.

Referenced by EcalUncalibRecHitWorkerGlobal::run().

                                                                       {

       if  (flag == kGood) {
          //then set all bits to zero;
          flags_  = 0;
          return;
      }
     // else set the flagbit
     flags_|= 0x1 <<  flag;  
}
void EcalUncalibratedRecHit::setFlags ( uint32_t  flags) [inline]

Definition at line 49 of file EcalUncalibratedRecHit.h.

References flags(), and flags_.

{ flags_ = flags; }
void EcalUncalibratedRecHit::setId ( DetId  id) [inline]

Definition at line 50 of file EcalUncalibratedRecHit.h.

References id(), and id_.

{ id_ = id; }
void EcalUncalibratedRecHit::setJitter ( float  jitter) [inline]

Definition at line 43 of file EcalUncalibratedRecHit.h.

References jitter(), and jitter_.

Referenced by EcalUncalibRecHitWorkerRatio::run().

{ jitter_ = jitter; }
void EcalUncalibratedRecHit::setJitterError ( float  jitterErr)

Definition at line 37 of file EcalUncalibratedRecHit.cc.

References aux_, jitterErrorBits(), and funct::pow().

Referenced by EcalUncalibRecHitWorkerRatio::run().

{
        // use 8 bits (3 exp, 5 mant) and store in ps
        // has range of 5 ps - 5000 ps
        // expect input in BX units
        // all bits off --> time reco bailed out
        if(jitterErr < 0)
        {
                aux_ = (~0xFF & aux_);
                return;
        }
        // all bits on  --> time error over 5 ns
        if(25*jitterErr >= 5)
        {
                aux_ = (0xFF | aux_);
                return;
        }

        float LSB = 1.26008;
        float quantityInLSB = (1000*25*jitterErr)/LSB;
        int log2OfQuantity = (int) (log2( quantityInLSB ));
        int exponentTmp = log2OfQuantity - 4;
        uint8_t exponent=0;
        if (exponentTmp>0) exponent = exponentTmp;
        uint8_t significand = (int) ( lround( quantityInLSB / pow(2.,exponent) )   );
        uint32_t jitterErrorBits = exponent<<5 | significand;
  
        if( (0xFF & jitterErrorBits) == 0xFF)
          jitterErrorBits = 0xFE;
        if( (0xFF & jitterErrorBits) == 0x00)
          jitterErrorBits = 0x01;

        aux_ = (~0xFF & aux_) | (jitterErrorBits & 0xFF);

}
void EcalUncalibratedRecHit::setOutOfTimeChi2 ( float  chi2) [inline]

Definition at line 46 of file EcalUncalibratedRecHit.h.

References chi2(), and OOTchi2_.

{ OOTchi2_ = chi2; }
void EcalUncalibratedRecHit::setOutOfTimeEnergy ( float  energy) [inline]
void EcalUncalibratedRecHit::setPedestal ( float  pedestal) [inline]

Definition at line 42 of file EcalUncalibratedRecHit.h.

References pedestal(), and pedestal_.


Member Data Documentation

Definition at line 60 of file EcalUncalibratedRecHit.h.

Referenced by amplitude(), and setAmplitude().

uint32_t EcalUncalibratedRecHit::aux_ [private]

Definition at line 67 of file EcalUncalibratedRecHit.h.

Referenced by jitterError(), jitterErrorBits(), setAux(), and setJitterError().

Definition at line 63 of file EcalUncalibratedRecHit.h.

Referenced by chi2(), and setChi2().

uint32_t EcalUncalibratedRecHit::flags_ [private]

Definition at line 66 of file EcalUncalibratedRecHit.h.

Referenced by checkFlag(), flags(), setFlagBit(), and setFlags().

Definition at line 68 of file EcalUncalibratedRecHit.h.

Referenced by id(), and setId().

Definition at line 62 of file EcalUncalibratedRecHit.h.

Referenced by jitter(), and setJitter().

Definition at line 64 of file EcalUncalibratedRecHit.h.

Referenced by outOfTimeEnergy(), and setOutOfTimeEnergy().

Definition at line 65 of file EcalUncalibratedRecHit.h.

Referenced by outOfTimeChi2(), and setOutOfTimeChi2().

Definition at line 61 of file EcalUncalibratedRecHit.h.

Referenced by pedestal(), and setPedestal().