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
 
float nonCorrectedTime () 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 16 of file EcalRecHit.h.

Member Typedef Documentation

◆ key_type

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

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

Constructor & Destructor Documentation

◆ EcalRecHit() [1/2]

EcalRecHit::EcalRecHit ( )
inline

Definition at line 64 of file EcalRecHit.h.

64 : energy_(0), time_(0), flagBits_(0) {}
float time_
Definition: EcalRecHit.h:234
float energy_
Definition: EcalRecHit.h:233
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:237

◆ EcalRecHit() [2/2]

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

Definition at line 66 of file EcalRecHit.h.

67  : id_(id), energy_(energy), time_(time), flagBits_(flagBits), extra_(extra) {}
float time() const
Definition: EcalRecHit.h:71
float time_
Definition: EcalRecHit.h:234
float energy_
Definition: EcalRecHit.h:233
uint32_t extra_
Definition: EcalRecHit.h:240
DetId id_
Definition: EcalRecHit.h:232
float energy() const
Definition: EcalRecHit.h:69
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:237

Member Function Documentation

◆ checkFlag()

bool EcalRecHit::checkFlag ( int  flag) const
inline

check if the flag is true

Definition at line 188 of file EcalRecHit.h.

References RemoveAddSevLevel::flag, and flagBits_.

Referenced by checkFlags(), isRecovered(), EgammaIsoDetIdCollectionProducer< T1 >::produce(), recoFlag(), EEBadScFilter::scan5x5(), EcalSeverityLevelAlgo::severityLevel(), PFRecHitQTestECAL::test(), and PFRecHitQTestES::test().

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

◆ checkFlagMask()

bool EcalRecHit::checkFlagMask ( uint32_t  mask) const
inline

apply a bitmask to our flags. Experts only

Definition at line 205 of file EcalRecHit.h.

References flagBits_, and ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask.

Referenced by EcalSeverityLevelAlgo::severityLevel().

205 { return flagBits_ & mask; }
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:237

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

References checkFlag().

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

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

◆ chi2()

float EcalRecHit::chi2 ( void  ) const
inline

Definition at line 121 of file EcalRecHit.h.

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

Referenced by setChi2().

121  {
122  uint32_t rawChi2 = getMasked(extra_, 0, 7);
123  return (float)rawChi2 / (float)((1 << 7) - 1) * 64.;
124  }
static uint32_t getMasked(uint32_t value, uint32_t offset, uint32_t width)
Definition: EcalRecHit.h:96
uint32_t extra_
Definition: EcalRecHit.h:240

◆ detid()

const DetId& EcalRecHit::detid ( ) const
inline

◆ energy()

float EcalRecHit::energy ( ) const
inline

Definition at line 69 of file EcalRecHit.h.

References energy_.

Referenced by AlCaElectronsTest::analyze(), EcalCosmicsHists::analyze(), EcalBoundaryInfoCalculator< EBDetId >::boundaryRecHits(), FWPFEcalRecHitRPProxyBuilder::build(), FWPFEcalRecHitLegoProxyBuilder::build(), ClusterShapeAlgo::Calculate_2ndEnergy(), ClusterShapeAlgo::Calculate_EnergyDepTopology(), ClusterShapeAlgo::Calculate_TopEnergy(), EcalClusterToolsT< noZS >::cluster2ndMoments(), ClusterShapeAlgo::Create_Map(), muonisolation::CaloExtractorByAssociator::deposits(), CSCHaloAlgo::ECALSegmentMatching(), EcalBoundaryInfoCalculator< EBDetId >::gapRecHits(), calib::CalibElectron::getCalibModulesWeights(), EcalClusterToolsT< noZS >::getEnergyDepTopology(), EcalHaloAlgo::GetHaloClusterCandidateEB(), EcalHaloAlgo::GetHaloClusterCandidateEE(), HcalHaloAlgo::GetHaloClusterCandidateHB(), HcalHaloAlgo::GetHaloClusterCandidateHE(), ZeeCalibration::getHottestDetId(), EcalClusterToolsT< noZS >::getSeedPosition(), IslandClusterAlgo::makeCluster(), CosmicClusterAlgo::makeCluster(), Multi5x5ClusterAlgo::makeCluster(), HybridClusterAlgo::makeDomino(), EgammaIsoDetIdCollectionProducer< T1 >::produce(), Jet.Jet::rawEnergy(), Multi5x5ClusterAlgo::ProtoBasicCluster::removeHit(), EcalClusterToolsT< noZS >::roundnessSelectedBarrelRecHits(), EEBadScFilter::scan5x5(), setEnergy(), setEnergyError(), EcalSeverityLevelAlgo::severityLevel(), PFRecHitQTestECAL::test(), and PFRecHitQTestES::test().

69 { return energy_; }
float energy_
Definition: EcalRecHit.h:233

◆ energyError()

float EcalRecHit::energyError ( ) const
inline

Definition at line 136 of file EcalRecHit.h.

References HLT_2024v14_cff::exponent, extra_, getMasked(), funct::pow(), and electrons_cff::rawEnergy.

136  {
137  uint32_t rawEnergy = getMasked(extra_, 8, 13);
138  uint16_t exponent = rawEnergy >> 10;
139  uint16_t significand = ~(0xE << 9) & rawEnergy;
140  return (float)significand * pow(10, exponent - 5);
141  }
static uint32_t getMasked(uint32_t value, uint32_t offset, uint32_t width)
Definition: EcalRecHit.h:96
uint32_t extra_
Definition: EcalRecHit.h:240
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ flagsBits()

uint32_t EcalRecHit::flagsBits ( ) const
inline

Definition at line 202 of file EcalRecHit.h.

References flagBits_.

202 { return flagBits_; }
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:237

◆ getMasked()

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

◆ getPower10()

static int EcalRecHit::getPower10 ( float  e)
inlinestatic

Definition at line 107 of file EcalRecHit.h.

References b, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), MillePedeFileConverter_cfg::e, and f.

Referenced by setEnergyError().

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

◆ id()

DetId EcalRecHit::id ( ) const
inline

◆ isRecovered()

bool EcalRecHit::isRecovered ( ) const
inline

◆ isTimeErrorValid()

bool EcalRecHit::isTimeErrorValid ( ) const
inline

Definition at line 86 of file EcalRecHit.h.

References isTimeValid(), and timeError().

86  {
87  if (!isTimeValid())
88  return false;
89 
90  if (timeError() >= 10000)
91  return false;
92 
93  return true;
94  }
float timeError() const
Definition: EcalRecHit.h:166
bool isTimeValid() const
Definition: EcalRecHit.h:84

◆ isTimeValid()

bool EcalRecHit::isTimeValid ( ) const
inline

Definition at line 84 of file EcalRecHit.h.

References timeError().

Referenced by isTimeErrorValid().

84 { return (this->timeError() > 0); }
float timeError() const
Definition: EcalRecHit.h:166

◆ nonCorrectedTime()

float EcalRecHit::nonCorrectedTime ( ) const
inline

Definition at line 221 of file EcalRecHit.h.

References ecalcctiming::clockToNS, ecalcctiming::encodingOffest, ecalcctiming::encodingValue, extra_, getMasked(), ecalcctiming::nonCorrectedSlope, and time_.

221  {
222  uint8_t jitterErrorBits = getMasked(extra_, 24, 8);
223  float encBits = static_cast<float>(jitterErrorBits);
225  float nonCorrectedTime =
226  (encBits > 1 && encBits < 254) ? ecalcctiming::nonCorrectedSlope * time_ + decTimeDif : -30.0;
227  return nonCorrectedTime;
228  }
constexpr const float encodingValue
Definition: EcalConstants.h:13
constexpr const float nonCorrectedSlope
Definition: EcalConstants.h:11
constexpr const float clockToNS
Definition: EcalConstants.h:10
float nonCorrectedTime() const
Definition: EcalRecHit.h:221
float time_
Definition: EcalRecHit.h:234
constexpr const float encodingOffest
Definition: EcalConstants.h:12
static uint32_t getMasked(uint32_t value, uint32_t offset, uint32_t width)
Definition: EcalRecHit.h:96
uint32_t extra_
Definition: EcalRecHit.h:240

◆ recoFlag()

Flags EcalRecHit::recoFlag ( ) const
inline

DEPRECATED provided for temporary backward compatibility.

Definition at line 208 of file EcalRecHit.h.

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

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

208  {
209  for (int i = kUnknown;; --i) {
210  if (checkFlag(i))
211  return Flags(i);
212  if (i == 0)
213  break;
214  }
215 
216  // no flag assigned, assume good
217  return kGood;
218  }
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:188

◆ setChi2()

void EcalRecHit::setChi2 ( float  chi2)
inline

Definition at line 126 of file EcalRecHit.h.

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

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

126  {
127  // bound the max value of the chi2
128  if (chi2 > 64)
129  chi2 = 64;
130 
131  // use 7 bits
132  uint32_t rawChi2 = lround(chi2 / 64. * ((1 << 7) - 1));
133  extra_ = setMasked(extra_, rawChi2, 0, 7);
134  }
static uint32_t setMasked(uint32_t value, uint32_t x, uint32_t offset, uint32_t width)
Definition: EcalRecHit.h:100
uint32_t extra_
Definition: EcalRecHit.h:240
float chi2() const
Definition: EcalRecHit.h:121

◆ setEnergy()

void EcalRecHit::setEnergy ( float  energy)
inline

Definition at line 70 of file EcalRecHit.h.

References energy(), and energy_.

70 { energy_ = energy; }
float energy_
Definition: EcalRecHit.h:233
float energy() const
Definition: EcalRecHit.h:69

◆ setEnergyError()

void EcalRecHit::setEnergyError ( float  energy)
inline

Definition at line 145 of file EcalRecHit.h.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), energy(), HLT_2024v14_cff::exponent, extra_, f, getPower10(), electrons_cff::rawEnergy, and setMasked().

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

145  {
146  uint32_t rawEnergy = 0;
147  if (energy > 0.001) {
148  uint16_t exponent = getPower10(energy);
149  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};
150  uint16_t significand = lround(energy * ip10[exponent]);
151  // use 13 bits (3 exponent, 10 significand)
152  rawEnergy = exponent << 10 | significand;
153  /* here for doc and regression test
154  uint16_t exponent_old = lround(floor(log10(energy))) + 3;
155  uint16_t significand_old = lround(energy/pow(10, exponent - 5));
156  std::cout << energy << ' ' << exponent << ' ' << significand
157  << ' ' << exponent_old << ' ' << significand_old << std::endl;
158  assert(exponent==exponent_old);
159  assert(significand==significand_old);
160  */
161  }
162 
163  extra_ = setMasked(extra_, rawEnergy, 8, 13);
164  }
static uint32_t setMasked(uint32_t value, uint32_t x, uint32_t offset, uint32_t width)
Definition: EcalRecHit.h:100
static int getPower10(float e)
Definition: EcalRecHit.h:107
double f[11][100]
uint32_t extra_
Definition: EcalRecHit.h:240
float energy() const
Definition: EcalRecHit.h:69

◆ setFlag()

void EcalRecHit::setFlag ( int  flag)
inline

set the flags (from Flags or ESFlags)

Definition at line 184 of file EcalRecHit.h.

References RemoveAddSevLevel::flag, and flagBits_.

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

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

◆ setMasked()

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

◆ setTime()

void EcalRecHit::setTime ( float  time)
inline

Definition at line 72 of file EcalRecHit.h.

References time(), and time_.

Referenced by EcalDetailedTimeRecHitProducer::produce().

72 { time_ = time; }
float time() const
Definition: EcalRecHit.h:71
float time_
Definition: EcalRecHit.h:234

◆ setTimeError()

void EcalRecHit::setTimeError ( uint8_t  timeErrBits)
inline

Definition at line 181 of file EcalRecHit.h.

References extra_, and setMasked().

181 { extra_ = setMasked(extra_, timeErrBits & 0xFF, 24, 8); }
static uint32_t setMasked(uint32_t value, uint32_t x, uint32_t offset, uint32_t width)
Definition: EcalRecHit.h:100
uint32_t extra_
Definition: EcalRecHit.h:240

◆ time()

float EcalRecHit::time ( ) const
inline

◆ timeError()

float EcalRecHit::timeError ( ) const
inline

Definition at line 166 of file EcalRecHit.h.

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

Referenced by isTimeErrorValid(), and isTimeValid().

166  {
167  uint32_t timeErrorBits = getMasked(extra_, 24, 8);
168  // all bits off --> time reco bailed out (return negative value)
169  if ((0xFF & timeErrorBits) == 0x00)
170  return -1;
171  // all bits on --> time error over 5 ns (return large value)
172  if ((0xFF & timeErrorBits) == 0xFF)
173  return 10000;
174 
175  float LSB = 1.26008;
176  uint8_t exponent = timeErrorBits >> 5;
177  uint8_t significand = timeErrorBits & ~(0x7 << 5);
178  return pow(2., exponent) * significand * LSB / 1000.;
179  }
static uint32_t getMasked(uint32_t value, uint32_t offset, uint32_t width)
Definition: EcalRecHit.h:96
uint32_t extra_
Definition: EcalRecHit.h:240
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ unsetFlag()

void EcalRecHit::unsetFlag ( int  flag)
inline

Definition at line 185 of file EcalRecHit.h.

References RemoveAddSevLevel::flag, and flagBits_.

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

Member Data Documentation

◆ energy_

float EcalRecHit::energy_
private

Definition at line 233 of file EcalRecHit.h.

Referenced by energy(), and setEnergy().

◆ extra_

uint32_t EcalRecHit::extra_
private

◆ flagBits_

uint32_t EcalRecHit::flagBits_
private

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

Definition at line 237 of file EcalRecHit.h.

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

◆ id_

DetId EcalRecHit::id_
private

Definition at line 232 of file EcalRecHit.h.

Referenced by detid().

◆ time_

float EcalRecHit::time_
private

Definition at line 234 of file EcalRecHit.h.

Referenced by nonCorrectedTime(), setTime(), and time().