CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
EcalRecHit Class Reference

#include <EcalRecHit.h>

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
 
const DetIddetid () const
 
 EcalRecHit ()
 
 EcalRecHit (const DetId &id, float energy, float time, uint32_t extra=0, uint32_t flagBits=0)
 
float energy () const
 
float energyError () const
 
uint32_t flagsBits () const
 
DetId id () const
 get the id More...
 
bool isRecovered () const
 
bool isTimeErrorValid () const
 
bool isTimeValid () const
 
Flags recoFlag () const
 DEPRECATED provided for temporary backward compatibility. More...
 
void setChi2 (float chi2)
 
void setEnergy (float energy)
 
void setEnergyError (float energy)
 
void setFlag (int flag)
 set the flags (from Flags or ESFlags) More...
 
void setTime (float time)
 
void setTimeError (uint8_t timeErrBits)
 
float time () const
 
float timeError () const
 
void unsetFlag (int flag)
 

Static Public Member Functions

static uint32_t getMasked (uint32_t value, uint32_t offset, uint32_t width)
 
static int getPower10 (float e)
 
static uint32_t setMasked (uint32_t value, uint32_t x, uint32_t offset, uint32_t width)
 

Private Attributes

float energy_
 
uint32_t extra_
 
uint32_t flagBits_
 store rechit condition (see Flags enum) in a bit-wise way More...
 
DetId id_
 
float time_
 

Detailed Description

Author
P. Meridiani INFN Roma1

Definition at line 15 of file EcalRecHit.h.

Member Typedef Documentation

◆ key_type

Definition at line 17 of file EcalRecHit.h.

Member Enumeration Documentation

◆ ESFlags

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

Definition at line 44 of file EcalRecHit.h.

◆ Flags

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

Definition at line 20 of file EcalRecHit.h.

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

Constructor & Destructor Documentation

◆ EcalRecHit() [1/2]

EcalRecHit::EcalRecHit ( )
inline

Definition at line 63 of file EcalRecHit.h.

63 : energy_(0), time_(0), flagBits_(0) {}

◆ EcalRecHit() [2/2]

EcalRecHit::EcalRecHit ( const DetId id,
float  energy,
float  time,
uint32_t  extra = 0,
uint32_t  flagBits = 0 
)
inlineexplicit

Definition at line 65 of file EcalRecHit.h.

66  : id_(id), energy_(energy), time_(time), flagBits_(flagBits), extra_(extra) {}

Member Function Documentation

◆ checkFlag()

bool EcalRecHit::checkFlag ( int  flag) const
inline

◆ checkFlagMask()

bool EcalRecHit::checkFlagMask ( uint32_t  mask) const
inline

apply a bitmask to our flags. Experts only

Definition at line 204 of file EcalRecHit.h.

204 { return flagBits_ & mask; }

References flagBits_.

Referenced by EcalSeverityLevelAlgo::severityLevel().

◆ checkFlags()

bool EcalRecHit::checkFlags ( const std::vector< int > &  flagsvec) const
inline

check if one of the flags in a set is true

Definition at line 190 of file EcalRecHit.h.

190  {
191  for (std::vector<int>::const_iterator flagPtr = flagsvec.begin(); flagPtr != flagsvec.end();
192  ++flagPtr) { // check if one of the flags is up
193 
194  if (checkFlag(*flagPtr))
195  return true;
196  }
197 
198  return false;
199  }

References checkFlag().

Referenced by EgammaIsoDetIdCollectionProducer< T1 >::produce().

◆ chi2()

float EcalRecHit::chi2 ( void  ) const
inline

Definition at line 120 of file EcalRecHit.h.

120  {
121  uint32_t rawChi2 = getMasked(extra_, 0, 7);
122  return (float)rawChi2 / (float)((1 << 7) - 1) * 64.;
123  }

References extra_, dqmMemoryStats::float, and getMasked().

Referenced by setChi2().

◆ detid()

const DetId& EcalRecHit::detid ( ) const
inline

◆ energy()

float EcalRecHit::energy ( ) const
inline

◆ energyError()

float EcalRecHit::energyError ( ) const
inline

Definition at line 135 of file EcalRecHit.h.

135  {
136  uint32_t rawEnergy = getMasked(extra_, 8, 13);
137  uint16_t exponent = rawEnergy >> 10;
138  uint16_t significand = ~(0xE << 9) & rawEnergy;
139  return (float)significand * pow(10, exponent - 5);
140  }

References HLT_FULL_cff::exponent, extra_, getMasked(), and funct::pow().

◆ flagsBits()

uint32_t EcalRecHit::flagsBits ( ) const
inline

Definition at line 201 of file EcalRecHit.h.

201 { return flagBits_; }

References flagBits_.

◆ getMasked()

static uint32_t EcalRecHit::getMasked ( uint32_t  value,
uint32_t  offset,
uint32_t  width 
)
inlinestatic

Definition at line 95 of file EcalRecHit.h.

95  {
96  return (value >> offset) & ((1 << width) - 1);
97  }

References hltrates_dqm_sourceclient-live_cfg::offset, and ApeEstimator_cff::width.

Referenced by chi2(), energyError(), and timeError().

◆ getPower10()

static int EcalRecHit::getPower10 ( float  e)
inlinestatic

Definition at line 106 of file EcalRecHit.h.

106  {
107  static constexpr float p10[] = {1.e-2f, 1.e-1f, 1.f, 1.e1f, 1.e2f, 1.e3f, 1.e4f, 1.e5f, 1.e6f};
108  int b = e < p10[4] ? 0 : 5;
109  for (; b < 9; ++b)
110  if (e < p10[b])
111  break;
112  return b;
113  }

References b, MillePedeFileConverter_cfg::e, and f.

Referenced by setEnergyError().

◆ id()

DetId EcalRecHit::id ( ) const
inline

◆ isRecovered()

bool EcalRecHit::isRecovered ( ) const
inline

◆ isTimeErrorValid()

bool EcalRecHit::isTimeErrorValid ( ) const
inline

Definition at line 85 of file EcalRecHit.h.

85  {
86  if (!isTimeValid())
87  return false;
88 
89  if (timeError() >= 10000)
90  return false;
91 
92  return true;
93  }

References isTimeValid(), and timeError().

◆ isTimeValid()

bool EcalRecHit::isTimeValid ( ) const
inline

Definition at line 83 of file EcalRecHit.h.

83 { return (this->timeError() > 0); }

References timeError().

Referenced by isTimeErrorValid().

◆ recoFlag()

Flags EcalRecHit::recoFlag ( ) const
inline

DEPRECATED provided for temporary backward compatibility.

Definition at line 207 of file EcalRecHit.h.

207  {
208  for (int i = kUnknown;; --i) {
209  if (checkFlag(i))
210  return Flags(i);
211  if (i == 0)
212  break;
213  }
214 
215  // no flag assigned, assume good
216  return kGood;
217  }

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

Referenced by EgammaHLTNxNClusterProducer::checkStatusOfEcalRecHit(), HLTEcalResonanceFilter::checkStatusOfEcalRecHit(), and HLTRegionalEcalResonanceFilter::checkStatusOfEcalRecHit().

◆ setChi2()

void EcalRecHit::setChi2 ( float  chi2)
inline

Definition at line 125 of file EcalRecHit.h.

125  {
126  // bound the max value of the chi2
127  if (chi2 > 64)
128  chi2 = 64;
129 
130  // use 7 bits
131  uint32_t rawChi2 = lround(chi2 / 64. * ((1 << 7) - 1));
132  extra_ = setMasked(extra_, rawChi2, 0, 7);
133  }

References chi2(), extra_, and setMasked().

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

◆ setEnergy()

void EcalRecHit::setEnergy ( float  energy)
inline

Definition at line 69 of file EcalRecHit.h.

69 { energy_ = energy; }

References energy(), and energy_.

◆ setEnergyError()

void EcalRecHit::setEnergyError ( float  energy)
inline

Definition at line 144 of file EcalRecHit.h.

144  {
145  uint32_t rawEnergy = 0;
146  if (energy > 0.001) {
147  uint16_t exponent = getPower10(energy);
148  static constexpr float ip10[] = {1.e5f, 1.e4f, 1.e3f, 1.e2f, 1.e1f, 1.e0f, 1.e-1f, 1.e-2f, 1.e-3f, 1.e-4};
149  uint16_t significand = lround(energy * ip10[exponent]);
150  // use 13 bits (3 exponent, 10 significand)
151  rawEnergy = exponent << 10 | significand;
152  /* here for doc and regression test
153  uint16_t exponent_old = lround(floor(log10(energy))) + 3;
154  uint16_t significand_old = lround(energy/pow(10, exponent - 5));
155  std::cout << energy << ' ' << exponent << ' ' << significand
156  << ' ' << exponent_old << ' ' << significand_old << std::endl;
157  assert(exponent==exponent_old);
158  assert(significand==significand_old);
159  */
160  }
161 
162  extra_ = setMasked(extra_, rawEnergy, 8, 13);
163  }

References energy(), HLT_FULL_cff::exponent, extra_, f, getPower10(), and setMasked().

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

◆ setFlag()

void EcalRecHit::setFlag ( int  flag)
inline

set the flags (from Flags or ESFlags)

Definition at line 183 of file EcalRecHit.h.

183 { flagBits_ |= (0x1 << flag); }

References RemoveAddSevLevel::flag, and flagBits_.

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

◆ setMasked()

static uint32_t EcalRecHit::setMasked ( uint32_t  value,
uint32_t  x,
uint32_t  offset,
uint32_t  width 
)
inlinestatic

Definition at line 99 of file EcalRecHit.h.

99  {
100  const uint32_t mask = ((1 << width) - 1) << offset;
101  value &= ~mask;
102  value |= (x & ((1U << width) - 1)) << offset;
103  return value;
104  }

References hltrates_dqm_sourceclient-live_cfg::offset, mitigatedMETSequence_cff::U, relativeConstraints::value, ApeEstimator_cff::width, and x.

Referenced by setChi2(), setEnergyError(), and setTimeError().

◆ setTime()

void EcalRecHit::setTime ( float  time)
inline

Definition at line 71 of file EcalRecHit.h.

71 { time_ = time; }

References time(), and time_.

Referenced by EcalDetailedTimeRecHitProducer::produce().

◆ setTimeError()

void EcalRecHit::setTimeError ( uint8_t  timeErrBits)
inline

Definition at line 180 of file EcalRecHit.h.

180 { extra_ = setMasked(extra_, timeErrBits & 0xFF, 24, 8); }

References extra_, and setMasked().

◆ time()

float EcalRecHit::time ( ) const
inline

◆ timeError()

float EcalRecHit::timeError ( ) const
inline

Definition at line 165 of file EcalRecHit.h.

165  {
166  uint32_t timeErrorBits = getMasked(extra_, 24, 8);
167  // all bits off --> time reco bailed out (return negative value)
168  if ((0xFF & timeErrorBits) == 0x00)
169  return -1;
170  // all bits on --> time error over 5 ns (return large value)
171  if ((0xFF & timeErrorBits) == 0xFF)
172  return 10000;
173 
174  float LSB = 1.26008;
175  uint8_t exponent = timeErrorBits >> 5;
176  uint8_t significand = timeErrorBits & ~(0x7 << 5);
177  return pow(2., exponent) * significand * LSB / 1000.;
178  }

References HLT_FULL_cff::exponent, extra_, getMasked(), and funct::pow().

Referenced by isTimeErrorValid(), and isTimeValid().

◆ unsetFlag()

void EcalRecHit::unsetFlag ( int  flag)
inline

Definition at line 184 of file EcalRecHit.h.

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

References RemoveAddSevLevel::flag, and flagBits_.

Member Data Documentation

◆ energy_

float EcalRecHit::energy_
private

Definition at line 222 of file EcalRecHit.h.

Referenced by energy(), and setEnergy().

◆ extra_

uint32_t EcalRecHit::extra_
private

Definition at line 229 of file EcalRecHit.h.

Referenced by chi2(), energyError(), setChi2(), setEnergyError(), setTimeError(), and timeError().

◆ flagBits_

uint32_t EcalRecHit::flagBits_
private

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

Definition at line 226 of file EcalRecHit.h.

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

◆ id_

DetId EcalRecHit::id_
private

Definition at line 221 of file EcalRecHit.h.

Referenced by detid().

◆ time_

float EcalRecHit::time_
private

Definition at line 223 of file EcalRecHit.h.

Referenced by setTime(), and time().

EcalRecHit::kNeighboursRecovered
Definition: EcalRecHit.h:29
EcalRecHit::getMasked
static uint32_t getMasked(uint32_t value, uint32_t offset, uint32_t width)
Definition: EcalRecHit.h:95
EcalRecHit::time_
float time_
Definition: EcalRecHit.h:223
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
EcalRecHit::kESTS15Sigmas
Definition: EcalRecHit.h:60
EcalRecHit::kTPSaturated
Definition: EcalRecHit.h:33
mps_fire.i
i
Definition: mps_fire.py:428
EcalRecHit::kESBadRatioFor23Lower
Definition: EcalRecHit.h:52
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
EcalRecHit::detid
const DetId & detid() const
Definition: EcalRecHit.h:72
EcalRecHit::kHasSwitchToGain6
Definition: EcalRecHit.h:37
EcalRecHit::energy_
float energy_
Definition: EcalRecHit.h:222
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
EcalRecHit::kL1SpikeFlag
Definition: EcalRecHit.h:34
EcalRecHit::kESHot
Definition: EcalRecHit.h:47
EcalRecHit::Flags
Flags
Definition: EcalRecHit.h:20
EcalRecHit::kSaturated
Definition: EcalRecHit.h:27
EcalRecHit::kESTS3Saturated
Definition: EcalRecHit.h:58
EcalRecHit::kESTwoGoodRatios
Definition: EcalRecHit.h:49
DDAxes::x
EcalRecHit::energy
float energy() const
Definition: EcalRecHit.h:68
EcalRecHit::kTowerRecovered
Definition: EcalRecHit.h:30
EcalRecHit::extra_
uint32_t extra_
Definition: EcalRecHit.h:229
DetId
Definition: DetId.h:17
EcalRecHit::kNoisy
Definition: EcalRecHit.h:25
EcalRecHit::time
float time() const
Definition: EcalRecHit.h:70
EcalRecHit::kUnknown
Definition: EcalRecHit.h:40
EcalRecHit::checkFlag
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:187
HLT_FULL_cff.exponent
exponent
Definition: HLT_FULL_cff.py:52824
EcalRecHit::flagBits_
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:226
EcalRecHit::kGood
Definition: EcalRecHit.h:21
EcalRecHit::isTimeValid
bool isTimeValid() const
Definition: EcalRecHit.h:83
b
double b
Definition: hdecay.h:118
EcalRecHit::chi2
float chi2() const
Definition: EcalRecHit.h:120
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
EcalRecHit::id_
DetId id_
Definition: EcalRecHit.h:221
EcalRecHit::kPoorReco
Definition: EcalRecHit.h:22
EcalRecHit::kLeadingEdgeRecovered
Definition: EcalRecHit.h:28
EcalRecHit::kOutOfTime
Definition: EcalRecHit.h:23
EcalRecHit::kESSaturated
Definition: EcalRecHit.h:56
EcalRecHit::kESTS1Largest
Definition: EcalRecHit.h:53
EcalRecHit::kESTS3Negative
Definition: EcalRecHit.h:55
EcalRecHit::kESTS13Sigmas
Definition: EcalRecHit.h:59
value
Definition: value.py:1
EcalRecHit::setMasked
static uint32_t setMasked(uint32_t value, uint32_t x, uint32_t offset, uint32_t width)
Definition: EcalRecHit.h:99
EcalRecHit::timeError
float timeError() const
Definition: EcalRecHit.h:165
EcalRecHit::kWeird
Definition: EcalRecHit.h:35
EcalRecHit::kDead
Definition: EcalRecHit.h:31
EcalRecHit::kESBadRatioFor12
Definition: EcalRecHit.h:50
EcalRecHit::kHasSwitchToGain1
Definition: EcalRecHit.h:38
relativeConstraints.value
value
Definition: relativeConstraints.py:53
EcalRecHit::kPoorCalib
Definition: EcalRecHit.h:26
EcalRecHit::getPower10
static int getPower10(float e)
Definition: EcalRecHit.h:106
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
EcalRecHit::kESPassBX
Definition: EcalRecHit.h:48
EcalRecHit::kDiWeird
Definition: EcalRecHit.h:36
EcalRecHit::kKilled
Definition: EcalRecHit.h:32
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
EcalRecHit::kESTS2Saturated
Definition: EcalRecHit.h:57
EcalRecHit::kESBadRatioFor23Upper
Definition: EcalRecHit.h:51
EcalRecHit::kESDead
Definition: EcalRecHit.h:46
EcalRecHit::kFaultyHardware
Definition: EcalRecHit.h:24
EcalRecHit::kESGood
Definition: EcalRecHit.h:45
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:117
EcalRecHit::kESTS3Largest
Definition: EcalRecHit.h:54
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37