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

Id:
EcalRecHit.h,v 1.25 2012/11/05 21:55:41 argiro Exp
Author
P. Meridiani INFN Roma1

Definition at line 13 of file EcalRecHit.h.

Member Typedef Documentation

Definition at line 15 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 42 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 18 of file EcalRecHit.h.

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

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.

9  : CaloRecHit(), flagBits_(0) {
10 }
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:117
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.

12  :
14  flagBits_(flagBits)
15 {
16 }
float time() const
Definition: CaloRecHit.h:21
float energy() const
Definition: CaloRecHit.h:19
uint32_t flags() const
Definition: CaloRecHit.h:23
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:117

Member Function Documentation

bool EcalRecHit::checkFlag ( int  flag) const
inline

check if the flag is true

Definition at line 103 of file EcalRecHit.h.

References flagBits_.

Referenced by checkFlags(), PFRecHitProducerECAL::createRecHits(), isRecovered(), recoFlag(), EEBadScFilter::scan5x5(), and EcalSeverityLevelAlgo::severityLevel().

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

apply a bitmask to our flags. Experts only

Definition at line 109 of file EcalRecHit.h.

References flagBits_.

Referenced by EcalSeverityLevelAlgo::severityLevel().

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

check if one of the flags in a set is true

Definition at line 133 of file EcalRecHit.cc.

References checkFlag().

133  {
134 
135 
136  for (std::vector<int>::const_iterator flagPtr = flagsvec.begin();
137  flagPtr!= flagsvec.end(); ++flagPtr) { // check if one of the flags is up
138  if (checkFlag(*flagPtr)) return true;
139  }
140  return false;
141 }
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:103
float EcalRecHit::chi2 ( void  ) const

Definition at line 26 of file EcalRecHit.cc.

References CaloRecHit::flags().

Referenced by BetaCalculatorECAL::addInfoToCandidate().

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

Definition at line 18 of file EcalRecHit.cc.

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

18  {
19 
20  return ( checkFlag(kLeadingEdgeRecovered) ||
23  );
24 }
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:103
bool EcalRecHit::isTimeErrorValid ( ) const

Definition at line 121 of file EcalRecHit.cc.

References isTimeValid(), and timeError().

Referenced by BetaCalculatorECAL::addInfoToCandidate().

122 {
123  if(!isTimeValid())
124  return false;
125  if(timeError() >= 10000)
126  return false;
127 
128  return true;
129 }
bool isTimeValid() const
Definition: EcalRecHit.cc:112
float timeError() const
Definition: EcalRecHit.cc:95
bool EcalRecHit::isTimeValid ( ) const

Definition at line 112 of file EcalRecHit.cc.

References timeError().

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

113 {
114  if(timeError() <= 0)
115  return false;
116  else
117  return true;
118 }
float timeError() const
Definition: EcalRecHit.cc:95
float EcalRecHit::outOfTimeChi2 ( ) const

Definition at line 34 of file EcalRecHit.cc.

References CaloRecHit::flags().

Referenced by BetaCalculatorECAL::addInfoToCandidate().

35 {
36  uint32_t rawChi2Prob = 0x7F & (flags()>>24);
37  return (float)rawChi2Prob / (float)((1<<7)-1) * 64.;
38 }
uint32_t flags() const
Definition: CaloRecHit.h:23
float EcalRecHit::outOfTimeEnergy ( ) const

Definition at line 40 of file EcalRecHit.cc.

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

Referenced by BetaCalculatorECAL::addInfoToCandidate().

41 {
42  uint32_t rawEnergy = (0x1FFF & flags()>>11);
43  uint16_t exponent = rawEnergy>>10;
44  uint16_t significand = ~(0xE<<9) & rawEnergy;
45  return (float) significand*pow(10,exponent-5);
46 }
uint32_t flags() const
Definition: CaloRecHit.h:23
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 145 of file EcalRecHit.cc.

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

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

145  {
146  for (int i=kUnknown; ; --i){
147  if (checkFlag(i)) return Flags(i);
148  if (i==0) break;
149  }
150  // no flag assigned, assume good
151  return kGood;
152 }
int i
Definition: DBlmapReader.cc:9
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:103
void EcalRecHit::setChi2 ( float  chi2)

Definition at line 52 of file EcalRecHit.cc.

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

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

53 {
54  // bound the max value of the chi2
55  if ( chi2 > 64 ) chi2 = 64;
56  // use 7 bits
57  uint32_t rawChi2 = lround( chi2 / 64. * ((1<<7)-1) );
58  // shift by 4 bits (recoFlag)
59  setFlags( (~(0x7F<<4) & flags()) | ((rawChi2 & 0x7F)<<4) );
60 }
float chi2() const
Definition: EcalRecHit.cc:26
uint32_t flags() const
Definition: CaloRecHit.h:23
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:24
void EcalRecHit::setFlag ( int  flag)
inline

set the flags (from Flags or ESFlags)

Definition at line 99 of file EcalRecHit.h.

References flagBits_.

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

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

Definition at line 77 of file EcalRecHit.cc.

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

78 {
79  // bound the max value of chi2
80  if ( chi2 > 64 ) chi2 = 64;
81  // use 7 bits
82  uint32_t rawChi2 = lround( chi2 / 64. * ((1<<7)-1) );
83  // shift by 24 bits (recoFlag + chi2 + outOfTimeEnergy)
84  setFlags( (~(0x7F<<24) & flags()) | ((rawChi2 & 0x7F)<<24) );
85 }
float chi2() const
Definition: EcalRecHit.cc:26
uint32_t flags() const
Definition: CaloRecHit.h:23
void setFlags(uint32_t flags)
Definition: CaloRecHit.h: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().

63 {
64  if ( energy > 0.001 ) {
65  uint16_t exponent = lround(floor(log10(energy)))+3;
66  uint16_t significand = lround(energy/pow(10,exponent-5));
67  // use 13 bits (3 exponent, 10 significand)
68  uint32_t rawEnergy = exponent<<10 | significand;
69  // shift by 11 bits (recoFlag + chi2)
70  setFlags( ( ~(0x1FFF<<11) & flags()) | ((rawEnergy & 0x1FFF)<<11) );
71  }
72 }
float energy() const
Definition: CaloRecHit.h:19
uint32_t flags() const
Definition: CaloRecHit.h:23
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:24
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void EcalRecHit::setTimeError ( uint8_t  timeErrBits)

Definition at line 88 of file EcalRecHit.cc.

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

89 {
90  // take the bits and put them in the right spot
91  setAux( (~0xFF & aux()) | timeErrBits );
92 }
uint32_t aux() const
Definition: CaloRecHit.h:28
void setAux(uint32_t value)
Definition: CaloRecHit.h:27
float EcalRecHit::timeError ( ) const

Definition at line 95 of file EcalRecHit.cc.

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

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

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

Definition at line 100 of file EcalRecHit.h.

References flagBits_.

100 {flagBits_ &= ~(0x1 << flag);}
long int flag
Definition: mlp_lapack.h:47
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:117

Member Data Documentation

uint32_t EcalRecHit::flagBits_
private

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

Definition at line 117 of file EcalRecHit.h.

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