CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
EcalRecHit Class Reference

#include <EcalRecHit.h>

Inheritance diagram for EcalRecHit:
CaloRecHit

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,
  kHasSwitchToGain6, kHasSwitchToGain1, kUnknown
}
 
typedef DetId key_type
 

Public Member Functions

bool checkFlag (int flag) const
 check if the flag is true More...
 
bool checkFlagMask (uint32_t mask) const
 apply a bitmask to our flags. Experts only More...
 
bool checkFlags (const std::vector< int > &flagsvec) const
 check if one of the flags in a set is true More...
 
float chi2 () const
 
 EcalRecHit ()
 
 EcalRecHit (const DetId &id, float energy, float time, uint32_t flags=0, uint32_t flagBits=0)
 
DetId id () const
 get the id More...
 
bool isRecovered () const
 
bool isTimeErrorValid () const
 
bool isTimeValid () const
 
float outOfTimeChi2 () const
 
float outOfTimeEnergy () const
 
Flags recoFlag () const
 DEPRECATED provided for temporary backward compatibility. More...
 
void setChi2 (float chi2)
 
void setFlag (int flag)
 set the flags (from Flags or ESFlags) More...
 
void setOutOfTimeChi2 (float chi2)
 
void setOutOfTimeEnergy (float energy)
 
void setTimeError (uint8_t timeErrBits)
 
float timeError () const
 
void unsetFlag (int flag)
 
- Public Member Functions inherited from CaloRecHit
uint32_t aux () const
 
 CaloRecHit ()
 
 CaloRecHit (const DetId &id, float energy, float time, uint32_t flags=0, uint32_t aux=0)
 
const DetIddetid () const
 
float energy () const
 
uint32_t flagField (int base, int width=1) const
 
uint32_t flags () const
 
void setAux (uint32_t value)
 
void setEnergy (float energy)
 
void setFlagField (uint32_t value, int base, int width=1)
 
void setFlags (uint32_t flags)
 
float time () const
 

Private Attributes

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

Detailed Description

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 41 of file EcalRecHit.h.

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

Definition at line 17 of file EcalRecHit.h.

17  {
18  kGood=0, // channel ok, the energy and time measurement are reliable
19  kPoorReco, // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2)
20  kOutOfTime, // the energy is available from the UncalibRecHit (sync reco), but the event is out of time
21  kFaultyHardware, // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy)
22  kNoisy, // the channel is very noisy
23  kPoorCalib, // the energy is available from the UncalibRecHit, but the calibration of the channel is poor
24  kSaturated, // saturated channel (recovery not tried)
25  kLeadingEdgeRecovered, // saturated channel: energy estimated from the leading edge before saturation
26  kNeighboursRecovered, // saturated/isolated dead: energy estimated from neighbours
27  kTowerRecovered, // channel in TT with no data link, info retrieved from Trigger Primitive
28  kDead, // channel is dead and any recovery fails
29  kKilled, // MC only flag: the channel is killed in the real detector
30  kTPSaturated, // the channel is in a region with saturated TP
31  kL1SpikeFlag, // the channel is in a region with TP with sFGVB = 0
32  kWeird, // the signal is believed to originate from an anomalous deposit (spike)
33  kDiWeird, // the signal is anomalous, and neighbors another anomalous signal
34  kHasSwitchToGain6, // at least one data frame is in G6
35  kHasSwitchToGain1, // at least one data frame is in G1
36  //
37  kUnknown // to ease the interface with functions returning flags.
38  };

Constructor & Destructor Documentation

EcalRecHit::EcalRecHit ( )
inline

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 71 of file EcalRecHit.h.

71 : CaloRecHit(), flagBits_(0) {}
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:120
EcalRecHit::EcalRecHit ( const DetId id,
float  energy,
float  time,
uint32_t  flags = 0,
uint32_t  flagBits = 0 
)
inline

Definition at line 73 of file EcalRecHit.h.

73  :
75  flagBits_(flagBits){}
float time() const
Definition: CaloRecHit.h:19
float energy() const
Definition: CaloRecHit.h:17
uint32_t flags() const
Definition: CaloRecHit.h:21
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:120

Member Function Documentation

bool EcalRecHit::checkFlag ( int  flag) const
inline

check if the flag is true

Definition at line 106 of file EcalRecHit.h.

References flagBits_.

Referenced by CaloRecHitMixer< T >::buildRecHit(), checkFlags(), PFRecHitProducerECAL::createRecHits(), isRecovered(), recoFlag(), EEBadScFilter::scan5x5(), and EcalSeverityLevelAlgo::severityLevel().

106 {return flagBits_ & ( 0x1<<flag);}
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:120
bool EcalRecHit::checkFlagMask ( uint32_t  mask) const
inline

apply a bitmask to our flags. Experts only

Definition at line 112 of file EcalRecHit.h.

References flagBits_.

Referenced by EcalSeverityLevelAlgo::severityLevel().

112 { return flagBits_&mask; }
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:120
bool EcalRecHit::checkFlags ( const std::vector< int > &  flagsvec) const

check if one of the flags in a set is true

Definition at line 125 of file EcalRecHit.cc.

References checkFlag().

125  {
126  for (std::vector<int>::const_iterator flagPtr = flagsvec.begin();
127  flagPtr!= flagsvec.end(); ++flagPtr) { // check if one of the flags is up
128  if (checkFlag(*flagPtr)) return true;
129  }
130  return false;
131 }
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:106
float EcalRecHit::chi2 ( void  ) const

Definition at line 18 of file EcalRecHit.cc.

References CaloRecHit::flags().

Referenced by BetaCalculatorECAL::addInfoToCandidate().

19 {
20  uint32_t rawChi2 = 0x7F & (flags()>>4);
21  return (float)rawChi2 / (float)((1<<7)-1) * 64.;
22 }
uint32_t flags() const
Definition: CaloRecHit.h:21
DetId EcalRecHit::id ( void  ) const
inline
bool EcalRecHit::isRecovered ( ) const

Definition at line 10 of file EcalRecHit.cc.

References checkFlag(), kLeadingEdgeRecovered, kNeighboursRecovered, and kTowerRecovered.

10  {
11 
12  return ( checkFlag(kLeadingEdgeRecovered) ||
15  );
16 }
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:106
bool EcalRecHit::isTimeErrorValid ( ) const

Definition at line 113 of file EcalRecHit.cc.

References isTimeValid(), and timeError().

Referenced by BetaCalculatorECAL::addInfoToCandidate().

114 {
115  if(!isTimeValid())
116  return false;
117  if(timeError() >= 10000)
118  return false;
119 
120  return true;
121 }
bool isTimeValid() const
Definition: EcalRecHit.cc:104
float timeError() const
Definition: EcalRecHit.cc:87
bool EcalRecHit::isTimeValid ( ) const

Definition at line 104 of file EcalRecHit.cc.

References timeError().

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

105 {
106  if(timeError() <= 0)
107  return false;
108  else
109  return true;
110 }
float timeError() const
Definition: EcalRecHit.cc:87
float EcalRecHit::outOfTimeChi2 ( ) const

Definition at line 26 of file EcalRecHit.cc.

References CaloRecHit::flags().

Referenced by BetaCalculatorECAL::addInfoToCandidate().

27 {
28  uint32_t rawChi2Prob = 0x7F & (flags()>>24);
29  return (float)rawChi2Prob / (float)((1<<7)-1) * 64.;
30 }
uint32_t flags() const
Definition: CaloRecHit.h:21
float EcalRecHit::outOfTimeEnergy ( ) const

Definition at line 32 of file EcalRecHit.cc.

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

Referenced by BetaCalculatorECAL::addInfoToCandidate().

33 {
34  uint32_t rawEnergy = (0x1FFF & flags()>>11);
35  uint16_t exponent = rawEnergy>>10;
36  uint16_t significand = ~(0xE<<9) & rawEnergy;
37  return (float) significand*pow(10,exponent-5);
38 }
uint32_t flags() const
Definition: CaloRecHit.h:21
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
EcalRecHit::Flags EcalRecHit::recoFlag ( ) const

DEPRECATED provided for temporary backward compatibility.

Definition at line 135 of file EcalRecHit.cc.

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

Referenced by BetaCalculatorECAL::addInfoToCandidate(), EgammaHLTNxNClusterProducer::checkStatusOfEcalRecHit(), and HLTEcalResonanceFilter::checkStatusOfEcalRecHit().

135  {
136  for (int i=kUnknown; ; --i){
137  if (checkFlag(i)) return Flags(i);
138  if (i==0) break;
139  }
140  // no flag assigned, assume good
141  return kGood;
142 }
int i
Definition: DBlmapReader.cc:9
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:106
void EcalRecHit::setChi2 ( float  chi2)

Definition at line 44 of file EcalRecHit.cc.

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

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

45 {
46  // bound the max value of the chi2
47  if ( chi2 > 64 ) chi2 = 64;
48  // use 7 bits
49  uint32_t rawChi2 = lround( chi2 / 64. * ((1<<7)-1) );
50  // shift by 4 bits (recoFlag)
51  setFlags( (~(0x7F<<4) & flags()) | ((rawChi2 & 0x7F)<<4) );
52 }
float chi2() const
Definition: EcalRecHit.cc:18
uint32_t flags() const
Definition: CaloRecHit.h:21
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:22
void EcalRecHit::setFlag ( int  flag)
inline

set the flags (from Flags or ESFlags)

Definition at line 102 of file EcalRecHit.h.

References flagBits_.

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

102 {flagBits_|= (0x1 << flag);}
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:120
void EcalRecHit::setOutOfTimeChi2 ( float  chi2)

Definition at line 69 of file EcalRecHit.cc.

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

70 {
71  // bound the max value of chi2
72  if ( chi2 > 64 ) chi2 = 64;
73  // use 7 bits
74  uint32_t rawChi2 = lround( chi2 / 64. * ((1<<7)-1) );
75  // shift by 24 bits (recoFlag + chi2 + outOfTimeEnergy)
76  setFlags( (~(0x7F<<24) & flags()) | ((rawChi2 & 0x7F)<<24) );
77 }
float chi2() const
Definition: EcalRecHit.cc:18
uint32_t flags() const
Definition: CaloRecHit.h:21
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:22
void EcalRecHit::setOutOfTimeEnergy ( float  energy)

Definition at line 54 of file EcalRecHit.cc.

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

Referenced by ESRecHitSimAlgo::oldreconstruct(), and ESRecHitSimAlgo::reconstruct().

55 {
56  if ( energy > 0.001 ) {
57  uint16_t exponent = lround(floor(log10(energy)))+3;
58  uint16_t significand = lround(energy/pow(10,exponent-5));
59  // use 13 bits (3 exponent, 10 significand)
60  uint32_t rawEnergy = exponent<<10 | significand;
61  // shift by 11 bits (recoFlag + chi2)
62  setFlags( ( ~(0x1FFF<<11) & flags()) | ((rawEnergy & 0x1FFF)<<11) );
63  }
64 }
float energy() const
Definition: CaloRecHit.h:17
uint32_t flags() const
Definition: CaloRecHit.h:21
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:22
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void EcalRecHit::setTimeError ( uint8_t  timeErrBits)

Definition at line 80 of file EcalRecHit.cc.

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

81 {
82  // take the bits and put them in the right spot
83  setAux( (~0xFF & aux()) | timeErrBits );
84 }
uint32_t aux() const
Definition: CaloRecHit.h:26
void setAux(uint32_t value)
Definition: CaloRecHit.h:25
float EcalRecHit::timeError ( ) const

Definition at line 87 of file EcalRecHit.cc.

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

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

88 {
89  uint32_t timeErrorBits = 0xFF & aux();
90  // all bits off --> time reco bailed out (return negative value)
91  if( (0xFF & timeErrorBits) == 0x00 )
92  return -1;
93  // all bits on --> time error over 5 ns (return large value)
94  if( (0xFF & timeErrorBits) == 0xFF )
95  return 10000;
96 
97  float LSB = 1.26008;
98  uint8_t exponent = timeErrorBits>>5;
99  uint8_t significand = timeErrorBits & ~(0x7<<5);
100  return pow(2.,exponent)*significand*LSB/1000.;
101 }
uint32_t aux() const
Definition: CaloRecHit.h:26
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void EcalRecHit::unsetFlag ( int  flag)
inline

Definition at line 103 of file EcalRecHit.h.

References flagBits_.

103 {flagBits_ &= ~(0x1 << flag);}
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:120

Member Data Documentation

uint32_t EcalRecHit::flagBits_
private

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

Definition at line 120 of file EcalRecHit.h.

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