CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

EcalRecHit Class Reference

#include <EcalRecHit.h>

Inheritance diagram for EcalRecHit:
CaloRecHit

List of all members.

Public Types

enum  ESFlags {
  kESGood, kESDead, kESHot, kESPassBX,
  kESTwoGoodRatios, kESBadRatioFor12, kESBadRatioFor23Upper, kESBadRatioFor23Lower,
  kESTS1Largest, kESTS3Largest, kESTS3Negative, kESSaturated,
  kESTS2Saturated, kESTS3Saturated, kESTS13Sigmas, kESTS15Sigmas
}
enum  Flags {
  kGood = 0, kPoorReco, kOutOfTime, kFaultyHardware,
  kNoisy, kPoorCalib, kSaturated, kLeadingEdgeRecovered,
  kNeighboursRecovered, kTowerRecovered, kDead, kKilled,
  kTPSaturated, kL1SpikeFlag, kWeird, kDiWeird,
  kUnknown
}
typedef DetId key_type

Public Member Functions

bool checkFlag (int flag) const
 check if the flag is true
bool checkFlagMask (uint32_t mask) const
 apply a bitmask to our flags. Experts only
float chi2 () const
 EcalRecHit (const DetId &id, float energy, float time, uint32_t flags=0, uint32_t flagBits=0)
 EcalRecHit ()
DetId id () const
 get the id
bool isRecovered () const
bool isTimeErrorValid () const
bool isTimeValid () const
float outOfTimeChi2 () const
float outOfTimeEnergy () const
Flags recoFlag () const
 DEPRECATED provided for temporary backward compatibility.
void setChi2 (float chi2)
void setFlag (int flag)
 set the flags (from Flags or ESFlags)
void setOutOfTimeChi2 (float chi2)
void setOutOfTimeEnergy (float energy)
void setTimeError (uint8_t timeErrBits)
float timeError () const
void unsetFlag (int flag)

Private Attributes

uint32_t flagBits_
 store rechit condition (see Flags enum) in a bit-wise way

Detailed Description

Id:
EcalRecHit.h,v 1.23 2011/02/15 20:11:48 argiro Exp
Author:
P. Meridiani INFN Roma1

Definition at line 12 of file EcalRecHit.h.


Member Typedef Documentation

Definition at line 14 of file EcalRecHit.h.


Member Enumeration Documentation

Enumerator:
kESGood 
kESDead 
kESHot 
kESPassBX 
kESTwoGoodRatios 
kESBadRatioFor12 
kESBadRatioFor23Upper 
kESBadRatioFor23Lower 
kESTS1Largest 
kESTS3Largest 
kESTS3Negative 
kESSaturated 
kESTS2Saturated 
kESTS3Saturated 
kESTS13Sigmas 
kESTS15Sigmas 

Definition at line 39 of file EcalRecHit.h.

Enumerator:
kGood 
kPoorReco 
kOutOfTime 
kFaultyHardware 
kNoisy 
kPoorCalib 
kSaturated 
kLeadingEdgeRecovered 
kNeighboursRecovered 
kTowerRecovered 
kDead 
kKilled 
kTPSaturated 
kL1SpikeFlag 
kWeird 
kDiWeird 
kUnknown 

Definition at line 17 of file EcalRecHit.h.

               { 
          kGood=0,                   // channel ok, the energy and time measurement are reliable
          kPoorReco,                 // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2)
          kOutOfTime,                // the energy is available from the UncalibRecHit (sync reco), but the event is out of time
          kFaultyHardware,           // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy)
          kNoisy,                    // the channel is very noisy
          kPoorCalib,                // the energy is available from the UncalibRecHit, but the calibration of the channel is poor
          kSaturated,                // saturated channel (recovery not tried)
          kLeadingEdgeRecovered,     // saturated channel: energy estimated from the leading edge before saturation
          kNeighboursRecovered,      // saturated/isolated dead: energy estimated from neighbours
          kTowerRecovered,           // channel in TT with no data link, info retrieved from Trigger Primitive
          kDead,                     // channel is dead and any recovery fails
          kKilled,                   // MC only flag: the channel is killed in the real detector
          kTPSaturated,              // the channel is in a region with saturated TP
          kL1SpikeFlag,              // the channel is in a region with TP with sFGVB = 0
          kWeird,                    // the signal is believed to originate from an anomalous deposit (spike) 
          kDiWeird,                  // the signal is anomalous, and neighbors another anomalous signal  
                                     //
          kUnknown                   // to ease the interface with functions returning flags. 
  };

Constructor & Destructor Documentation

EcalRecHit::EcalRecHit ( )

bit structure of CaloRecHit::flags_ used in EcalRecHit:

| 32 | 31...25 | 24...12 | 11...5 | 4...1 | | | | | | | | | | +--> reco flags ( 4 bits) | | | +--> chi2 for in time events ( 7 bits) | | +--> energy for out-of-time events (13 bits) | +--> chi2 for out-of-time events ( 7 bits) +--> spare ( 1 bit )

Definition at line 9 of file EcalRecHit.cc.

                       : CaloRecHit(), flagBits_(0) {
}
EcalRecHit::EcalRecHit ( const DetId id,
float  energy,
float  time,
uint32_t  flags = 0,
uint32_t  flagBits = 0 
)

Definition at line 12 of file EcalRecHit.cc.

                                                                                                   :
  CaloRecHit(id,energy,time,flags),
  flagBits_(flagBits)
{
}

Member Function Documentation

bool EcalRecHit::checkFlag ( int  flag) const [inline]

check if the flag is true

Definition at line 100 of file EcalRecHit.h.

References flagBits_.

Referenced by PFRecHitProducerPS::createRecHits(), isRecovered(), recoFlag(), and EcalSeverityLevelAlgo::severityLevel().

{return flagBits_ & ( 0x1<<flag);}
bool EcalRecHit::checkFlagMask ( uint32_t  mask) const [inline]

apply a bitmask to our flags. Experts only

Definition at line 103 of file EcalRecHit.h.

References flagBits_.

Referenced by EcalSeverityLevelAlgo::severityLevel().

{ return flagBits_&mask; }
float EcalRecHit::chi2 ( void  ) const

Definition at line 26 of file EcalRecHit.cc.

References CaloRecHit::flags().

Referenced by BetaCalculatorTK::addInfoToCandidate().

{
        uint32_t rawChi2 = 0x7F & (flags()>>4);
        return (float)rawChi2 / (float)((1<<7)-1) * 64.;
}
DetId EcalRecHit::id ( void  ) const [inline]
bool EcalRecHit::isRecovered ( ) const
bool EcalRecHit::isTimeErrorValid ( ) const

Definition at line 121 of file EcalRecHit.cc.

References isTimeValid(), and timeError().

Referenced by BetaCalculatorTK::addInfoToCandidate().

{
        if(!isTimeValid())
          return false;
        if(timeError() >= 10000)
          return false;

        return true;
}
bool EcalRecHit::isTimeValid ( ) const

Definition at line 112 of file EcalRecHit.cc.

References timeError().

Referenced by BetaCalculatorTK::addInfoToCandidate(), and isTimeErrorValid().

{
        if(timeError() <= 0)
          return false;
        else
          return true;
}
float EcalRecHit::outOfTimeChi2 ( ) const

Definition at line 34 of file EcalRecHit.cc.

References CaloRecHit::flags().

Referenced by BetaCalculatorTK::addInfoToCandidate().

{
        uint32_t rawChi2Prob = 0x7F & (flags()>>24);
        return (float)rawChi2Prob / (float)((1<<7)-1) * 64.;
}
float EcalRecHit::outOfTimeEnergy ( ) const

Definition at line 40 of file EcalRecHit.cc.

References CaloRecHit::flags(), and funct::pow().

Referenced by BetaCalculatorTK::addInfoToCandidate().

{
        uint32_t rawEnergy = (0x1FFF & flags()>>11);
        uint16_t exponent = rawEnergy>>10;
        uint16_t significand = ~(0xE<<9) & rawEnergy;
        return (float) significand*pow(10,exponent-5);
}
EcalRecHit::Flags EcalRecHit::recoFlag ( ) const

DEPRECATED provided for temporary backward compatibility.

Definition at line 133 of file EcalRecHit.cc.

References checkFlag(), i, kGood, and kUnknown.

Referenced by BetaCalculatorTK::addInfoToCandidate(), HLTEcalResonanceFilter::checkStatusOfEcalRecHit(), EgammaHLTNxNClusterProducer::checkStatusOfEcalRecHit(), and CosmicClusterAlgo::makeCluster().

                                           {
  for (int i=kUnknown; ; --i){
    if (checkFlag(i)) return Flags(i);
    if (i==0) break;
  }
  // no flag assigned, assume good
  return kGood;
}
void EcalRecHit::setChi2 ( float  chi2)

Definition at line 52 of file EcalRecHit.cc.

References CaloRecHit::flags(), and CaloRecHit::setFlags().

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

{
        // bound the max value of the chi2
        if ( chi2 > 64 ) chi2 = 64;
        // use 7 bits
        uint32_t rawChi2 = lround( chi2 / 64. * ((1<<7)-1) );
        // shift by 4 bits (recoFlag)
        setFlags( (~(0x7F<<4) & flags()) | ((rawChi2 & 0x7F)<<4) );
}
void EcalRecHit::setFlag ( int  flag) [inline]

set the flags (from Flags or ESFlags)

Definition at line 96 of file EcalRecHit.h.

References flagBits_.

Referenced by ESRecHitAnalyticAlgo::reconstruct(), ESRecHitFitAlgo::reconstruct(), and EcalRecHitWorkerRecover::run().

{flagBits_|= (0x1 << flag);}
void EcalRecHit::setOutOfTimeChi2 ( float  chi2)

Definition at line 77 of file EcalRecHit.cc.

References CaloRecHit::flags(), and CaloRecHit::setFlags().

{
        // bound the max value of chi2
        if ( chi2 > 64 ) chi2 = 64;
        // use 7 bits
        uint32_t rawChi2 = lround( chi2 / 64. * ((1<<7)-1) );
        // shift by 24 bits (recoFlag + chi2 + outOfTimeEnergy)
        setFlags( (~(0x7F<<24) & flags()) | ((rawChi2 & 0x7F)<<24) );
}
void EcalRecHit::setOutOfTimeEnergy ( float  energy)

Definition at line 62 of file EcalRecHit.cc.

References CaloRecHit::flags(), funct::pow(), and CaloRecHit::setFlags().

Referenced by ESRecHitSimAlgo::reconstruct().

{
        if ( energy > 0.001 ) {
                uint16_t exponent = lround(floor(log10(energy)))+3;
                uint16_t significand = lround(energy/pow(10,exponent-5));
                // use 13 bits (3 exponent, 10 significand)
                uint32_t rawEnergy = exponent<<10 | significand;
                // shift by 11 bits (recoFlag + chi2)
                setFlags( ( ~(0x1FFF<<11) & flags()) | ((rawEnergy & 0x1FFF)<<11) );
        }
}
void EcalRecHit::setTimeError ( uint8_t  timeErrBits)

Definition at line 88 of file EcalRecHit.cc.

References CaloRecHit::aux(), and CaloRecHit::setAux().

{
        // take the bits and put them in the right spot
        setAux( (~0xFF & aux()) | timeErrBits );
}
float EcalRecHit::timeError ( ) const

Definition at line 95 of file EcalRecHit.cc.

References CaloRecHit::aux(), and funct::pow().

Referenced by BetaCalculatorTK::addInfoToCandidate(), isTimeErrorValid(), and isTimeValid().

{
        uint32_t timeErrorBits = 0xFF & aux();
        // all bits off --> time reco bailed out (return negative value)
        if( (0xFF & timeErrorBits) == 0x00 )
                return -1;
        // all bits on  --> time error over 5 ns (return large value)
        if( (0xFF & timeErrorBits) == 0xFF )
                return 10000;

        float LSB = 1.26008;
        uint8_t exponent = timeErrorBits>>5;
        uint8_t significand = timeErrorBits & ~(0x7<<5);
        return pow(2.,exponent)*significand*LSB/1000.;
}
void EcalRecHit::unsetFlag ( int  flag) [inline]

Definition at line 97 of file EcalRecHit.h.

References flagBits_.

{flagBits_ &= ~(0x1 << flag);}

Member Data Documentation

uint32_t EcalRecHit::flagBits_ [private]

store rechit condition (see Flags enum) in a bit-wise way

Definition at line 111 of file EcalRecHit.h.

Referenced by checkFlag(), checkFlagMask(), setFlag(), and unsetFlag().