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, kPoorReco, kSaturated, kOutOfTime,
  kLeadingEdgeRecovered, kFake
}
typedef DetId key_type

Public Member Functions

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

Private Attributes

double amplitude_
uint32_t aux_
double chi2_
uint32_t flags_
DetId id_
double jitter_
double 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 
kFake 

Definition at line 13 of file EcalUncalibratedRecHit.h.

             {
          kGood,                 // channel is good
          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
          kFake                  // the signal in the channel is a fake (e.g. a so-called spike)
  };

Constructor & Destructor Documentation

EcalUncalibratedRecHit::EcalUncalibratedRecHit ( )

Definition at line 5 of file EcalUncalibratedRecHit.cc.

                                               :
     amplitude_(0.), pedestal_(0.), jitter_(0.), chi2_(10000.), flags_(0), aux_(0) { }
EcalUncalibratedRecHit::EcalUncalibratedRecHit ( const DetId detId,
double  ampl,
double  ped,
double  jit,
double  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), flags_(flags), aux_(aux), id_(id) { }
EcalUncalibratedRecHit::~EcalUncalibratedRecHit ( ) [virtual]

Definition at line 12 of file EcalUncalibratedRecHit.cc.

                                                {
}

Member Function Documentation

double EcalUncalibratedRecHit::amplitude ( ) const [inline]
double EcalUncalibratedRecHit::chi2 ( void  ) const [inline]

Definition at line 30 of file EcalUncalibratedRecHit.h.

References chi2_.

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

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

Definition at line 118 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 110 of file EcalUncalibratedRecHit.cc.

References jitterError().

Referenced by isJitterErrorValid().

{
        if(jitterError() <= 0)
          return false;
        else
          return true;
}
bool EcalUncalibratedRecHit::isSaturated ( ) const

Definition at line 15 of file EcalUncalibratedRecHit.cc.

References kSaturated, and recoFlag().

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

                                               {
  return ( recoFlag() == kSaturated );
}
double EcalUncalibratedRecHit::jitter ( ) const [inline]

Definition at line 29 of file EcalUncalibratedRecHit.h.

References jitter_.

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

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

Definition at line 57 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 128 of file EcalUncalibratedRecHit.cc.

References aux_.

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

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

Definition at line 51 of file EcalUncalibratedRecHit.cc.

References flags_.

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

{
        uint32_t rawChi2 = 0x7F & (flags_>>17);
        return (float)rawChi2 / (float)((1<<7)-1) * 64.;
}
float EcalUncalibratedRecHit::outOfTimeEnergy ( ) const

Definition at line 19 of file EcalUncalibratedRecHit.cc.

References flags_, and funct::pow().

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

{
        uint32_t rawEnergy = (0x1FFF & flags_>>4);
        uint16_t exponent = rawEnergy>>10;
        uint16_t significand = ~(0xE<<9) & rawEnergy;
        return (float) significand*pow(10,exponent-5);
}
double EcalUncalibratedRecHit::pedestal ( ) const [inline]

Definition at line 28 of file EcalUncalibratedRecHit.h.

References pedestal_.

Referenced by setPedestal().

{ return pedestal_; }
uint32_t EcalUncalibratedRecHit::recoFlag ( ) const [inline]

Definition at line 31 of file EcalUncalibratedRecHit.h.

References flags_.

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

{ return 0xF & flags_; }
void EcalUncalibratedRecHit::setAmplitude ( double  amplitude) [inline]

Definition at line 38 of file EcalUncalibratedRecHit.h.

References amplitude(), and amplitude_.

Referenced by EcalUncalibRecHitWorkerRatio::run().

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

Definition at line 50 of file EcalUncalibratedRecHit.h.

References printConversionInfo::aux, and aux_.

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

Definition at line 42 of file EcalUncalibratedRecHit.h.

References chi2(), and chi2_.

{ chi2_ = chi2; }
void EcalUncalibratedRecHit::setFlags ( uint32_t  flags) [inline]

Definition at line 43 of file EcalUncalibratedRecHit.h.

References flags, and flags_.

Referenced by setOutOfTimeChi2(), and setOutOfTimeEnergy().

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

Definition at line 49 of file EcalUncalibratedRecHit.h.

References id(), and id_.

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

Definition at line 40 of file EcalUncalibratedRecHit.h.

References jitter(), and jitter_.

Referenced by EcalUncalibRecHitWorkerRatio::run().

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

Definition at line 74 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)

Definition at line 42 of file EcalUncalibratedRecHit.cc.

References flags_, and setFlags().

{
        // use 7 bits
        if ( chi2 > 64. ) chi2 = 64.;
        uint32_t rawChi2 = lround( chi2 / 64. * ((1<<7)-1) );
        // shift by 17 bits (recoFlag + outOfTimeEnergy)
        setFlags( (~(0x7F<<17) & flags_) | ((rawChi2 & 0x7F)<<17) );
}
void EcalUncalibratedRecHit::setOutOfTimeEnergy ( float  energy)

Definition at line 32 of file EcalUncalibratedRecHit.cc.

References flags_, funct::pow(), and setFlags().

{
        if ( energy > 0.001 ) {
                uint16_t exponent = lround(floor(log10(energy)))+3;
                uint16_t significand = lround(energy/pow(10,exponent-5));
                uint32_t rawEnergy = exponent<<10 | significand;
                setFlags( ( ~(0x1FFF<<4) & flags_) | ((rawEnergy & 0x1FFF)<<4) );
        }
}
void EcalUncalibratedRecHit::setPedestal ( double  pedestal) [inline]

Definition at line 39 of file EcalUncalibratedRecHit.h.

References pedestal(), and pedestal_.

void EcalUncalibratedRecHit::setRecoFlag ( uint32_t  flags)

Definition at line 27 of file EcalUncalibratedRecHit.cc.

References flags_.

Referenced by EcalUncalibRecHitWorkerGlobal::run().

{
        flags_ = (~0xF & flags_) | (flag & 0xF);
}

Member Data Documentation

Definition at line 57 of file EcalUncalibratedRecHit.h.

Referenced by amplitude(), and setAmplitude().

uint32_t EcalUncalibratedRecHit::aux_ [private]

Definition at line 62 of file EcalUncalibratedRecHit.h.

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

Definition at line 60 of file EcalUncalibratedRecHit.h.

Referenced by chi2(), and setChi2().

uint32_t EcalUncalibratedRecHit::flags_ [private]

Definition at line 63 of file EcalUncalibratedRecHit.h.

Referenced by id(), and setId().

Definition at line 59 of file EcalUncalibratedRecHit.h.

Referenced by jitter(), and setJitter().

Definition at line 58 of file EcalUncalibratedRecHit.h.

Referenced by pedestal(), and setPedestal().