test
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 | 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
 
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 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

Definition at line 17 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 44 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 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::EcalRecHit ( )
inline

Definition at line 63 of file EcalRecHit.h.

63 : energy_(0), time_(0), flagBits_(0) {}
float time_
Definition: EcalRecHit.h:219
float energy_
Definition: EcalRecHit.h:218
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:222
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.

65  :
66  id_(id), energy_(energy), time_(time), flagBits_(flagBits), extra_(extra) {}
float time() const
Definition: EcalRecHit.h:70
float time_
Definition: EcalRecHit.h:219
float energy() const
Definition: EcalRecHit.h:68
float energy_
Definition: EcalRecHit.h:218
uint32_t extra_
Definition: EcalRecHit.h:225
DetId id_
Definition: EcalRecHit.h:217
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:222

Member Function Documentation

bool EcalRecHit::checkFlag ( int  flag) const
inline

check if the flag is true

Definition at line 188 of file EcalRecHit.h.

References flagBits_.

Referenced by checkFlags(), isRecovered(), EleIsoDetIdCollectionProducer::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:222
bool EcalRecHit::checkFlagMask ( uint32_t  mask) const
inline

apply a bitmask to our flags. Experts only

Definition at line 202 of file EcalRecHit.h.

References flagBits_.

Referenced by EcalSeverityLevelAlgo::severityLevel().

202 { return flagBits_&mask; }
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:222
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 EleIsoDetIdCollectionProducer::produce().

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

Definition at line 120 of file EcalRecHit.h.

References extra_, and getMasked().

Referenced by BetaCalculatorECAL::addInfoToCandidate().

120  {
121  uint32_t rawChi2 = getMasked(extra_, 0, 7);
122  return (float)rawChi2 / (float)((1<<7)-1) * 64.;
123  }
static uint32_t getMasked(uint32_t value, uint32_t offset, uint32_t width)
Definition: EcalRecHit.h:96
uint32_t extra_
Definition: EcalRecHit.h:225
const DetId& EcalRecHit::detid ( ) const
inline
float EcalRecHit::energy ( ) const
inline

Definition at line 68 of file EcalRecHit.h.

References energy_.

Referenced by BetaCalculatorECAL::addInfoToCandidate(), AlCaElectronsTest::analyze(), TestMuonCaloCleaner::analyze(), EcalCosmicsHists::analyze(), EcalSelectiveReadoutValidation::analyzeEB(), EcalSelectiveReadoutValidation::analyzeEE(), CaloTowersCreationAlgo::assignHitEcal(), EcalBoundaryInfoCalculator< EcalDetId >::boundaryRecHits(), FWPFEcalRecHitRPProxyBuilder::build(), FWPFEcalRecHitLegoProxyBuilder::build(), HBHEHitMap::calcEcalNeighborTowers_(), HBHEHitMap::calcEcalSameTowers_(), ClusterShapeAlgo::Calculate_2ndEnergy(), ClusterShapeAlgo::Calculate_EnergyDepTopology(), ClusterShapeAlgo::Calculate_TopEnergy(), EcalClusterToolsT< noZS >::cluster2ndMoments(), ClusterShapeAlgo::Create_Map(), muonisolation::CaloExtractorByAssociator::deposits(), CSCHaloAlgo::ECALSegmentMatching(), MuonCaloDistanceProducer::fillDistanceMap(), EcalRecHitsFilter::filter(), EcalBoundaryInfoCalculator< EcalDetId >::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(), EcalDisplaysByEvent::makeHistos(), EcalRecHitLess::operator()(), less_mag::operator()(), ecalRecHitLess::operator()(), ecalRecHitSort::operator()(), eecalRecHitLess::operator()(), operator<(), operator<<(), EleIsoDetIdCollectionProducer::produce(), GamIsoDetIdCollectionProducer::produce(), InterestingDetIdFromSuperClusterProducer::produce(), InterestingDetIdCollectionProducer::produce(), reco::CentralityProducer::produce(), Jet.Jet::rawEnergy(), Multi5x5ClusterAlgo::ProtoBasicCluster::removeHit(), EcalClusterToolsT< noZS >::roundnessSelectedBarrelRecHits(), EcalRecHitWorkerRecover::run(), EEBadScFilter::scan5x5(), EcalMipGraphs::selectHits(), EcalDisplaysByEvent::selectHits(), setEnergy(), EcalSeverityLevelAlgo::severityLevel(), PFRecHitQTestECAL::test(), PFRecHitQTestES::test(), and ObjectValidator::validHit().

68 { return energy_; }
float energy_
Definition: EcalRecHit.h:218
float EcalRecHit::energyError ( ) const
inline

Definition at line 134 of file EcalRecHit.h.

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

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

Definition at line 107 of file EcalRecHit.h.

References b, constexpr, 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) if (e<p10[b]) break;
111  return b;
112  }
#define constexpr
double f[11][100]
double b
Definition: hdecay.h:120
DetId EcalRecHit::id ( ) const
inline

get the id

Definition at line 76 of file EcalRecHit.h.

References detid().

Referenced by AlCaElectronsTest::analyze(), TestMuonCaloCleaner::analyze(), EcalSelectiveReadoutValidation::analyzeEB(), EcalSelectiveReadoutValidation::analyzeEE(), EcalBoundaryInfoCalculator< EcalDetId >::boundaryRecHits(), ClusterShapeAlgo::Calculate_2ndEnergy(), ClusterShapeAlgo::Calculate_TopEnergy(), EcalBoundaryInfoCalculator< EBDetId >::checkRecHitHasDeadNeighbour(), EcalBoundaryInfoCalculator< EBDetId >::checkRecHitHasInvalidNeighbour(), EgammaHLTNxNClusterProducer::checkStatusOfEcalRecHit(), HLTEcalResonanceFilter::checkStatusOfEcalRecHit(), HLTRegionalEcalResonanceFilter::checkStatusOfEcalRecHit(), ClusterShapeAlgo::Create_Map(), CSCHaloAlgo::ECALSegmentMatching(), EcalLaserCorrFilter::filter(), EcalRecHitsFilter::filter(), EcalBoundaryInfoCalculator< EcalDetId >::gapRecHits(), EcalHaloAlgo::GetHaloClusterCandidateEB(), EcalHaloAlgo::GetHaloClusterCandidateEE(), HcalHaloAlgo::GetHaloClusterCandidateHB(), HcalHaloAlgo::GetHaloClusterCandidateHE(), ZeeCalibration::getHottestDetId(), EcalRecHitWorkerRecover::insertRecHit(), Multi5x5ClusterAlgo::mainSearch(), CosmicClusterAlgo::makeCluster(), EcalDisplaysByEvent::makeHistos(), PhysicsTowerOrganizer::PhysicsTowerOrganizer(), HLTRechitsToDigis::produce(), reco::CentralityProducer::produce(), Multi5x5ClusterAlgo::ProtoBasicCluster::removeHit(), EcalMipGraphs::selectHits(), and EcalDisplaysByEvent::selectHits().

76 { return DetId(detid());}
const DetId & detid() const
Definition: EcalRecHit.h:71
Definition: DetId.h:18
bool EcalRecHit::isRecovered ( ) const
inline
bool EcalRecHit::isTimeErrorValid ( ) const
inline

Definition at line 86 of file EcalRecHit.h.

References isTimeValid(), and timeError().

Referenced by BetaCalculatorECAL::addInfoToCandidate().

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

Definition at line 84 of file EcalRecHit.h.

References timeError().

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

84 { return (this->timeError() > 0); }
float timeError() const
Definition: EcalRecHit.h:164
Flags EcalRecHit::recoFlag ( ) const
inline

DEPRECATED provided for temporary backward compatibility.

Definition at line 205 of file EcalRecHit.h.

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

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

205  {
206  for (int i=kUnknown; ; --i){
207  if (checkFlag(i)) return Flags(i);
208  if (i==0) break;
209  }
210 
211  // no flag assigned, assume good
212  return kGood;
213  }
int i
Definition: DBlmapReader.cc:9
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:188
void EcalRecHit::setChi2 ( float  chi2)
inline

Definition at line 125 of file EcalRecHit.h.

References extra_, and setMasked().

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

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

Definition at line 69 of file EcalRecHit.h.

References energy(), and energy_.

Referenced by CaloRecHitMixer< T >::buildRecHit().

69 { energy_=energy; }
float energy() const
Definition: EcalRecHit.h:68
float energy_
Definition: EcalRecHit.h:218
void EcalRecHit::setEnergyError ( float  energy)
inline

Definition at line 143 of file EcalRecHit.h.

References constexpr, HLT_25ns10e33_v2_cff::exponent, extra_, f, getPower10(), and setMasked().

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

143  {
144  uint32_t rawEnergy = 0;
145  if (energy > 0.001) {
146  uint16_t exponent = getPower10(energy);
147  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};
148  uint16_t significand = lround(energy*ip10[exponent]);
149  // use 13 bits (3 exponent, 10 significand)
150  rawEnergy = exponent << 10 | significand;
151  /* here for doc and regression test
152  uint16_t exponent_old = lround(floor(log10(energy))) + 3;
153  uint16_t significand_old = lround(energy/pow(10, exponent - 5));
154  std::cout << energy << ' ' << exponent << ' ' << significand
155  << ' ' << exponent_old << ' ' << significand_old << std::endl;
156  assert(exponent==exponent_old);
157  assert(significand==significand_old);
158  */
159  }
160 
161  extra_ = setMasked(extra_, rawEnergy, 8, 13);
162  }
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
#define constexpr
float energy() const
Definition: EcalRecHit.h:68
double f[11][100]
uint32_t extra_
Definition: EcalRecHit.h:225
void EcalRecHit::setFlag ( int  flag)
inline

set the flags (from Flags or ESFlags)

Definition at line 184 of file EcalRecHit.h.

References flagBits_.

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

184 {flagBits_|= (0x1 << flag);}
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: EcalRecHit.h:222
static uint32_t EcalRecHit::setMasked ( uint32_t  value,
uint32_t  x,
uint32_t  offset,
uint32_t  width 
)
inlinestatic

Definition at line 100 of file EcalRecHit.h.

References hltrates_dqm_sourceclient-live_cfg::offset, relativeConstraints::value, and create_public_lumi_plots::width.

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

100  {
101  const uint32_t mask = ((1 << width) - 1) << offset;
102  value &= ~mask;
103  value |= (x & ((1U << width) - 1)) << offset;
104  return value;
105  }
void EcalRecHit::setTimeError ( uint8_t  timeErrBits)
inline

Definition at line 179 of file EcalRecHit.h.

References extra_, and setMasked().

179  {
180  extra_ = setMasked(extra_, timeErrBits & 0xFF, 24, 8);
181  }
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:225
float EcalRecHit::time ( ) const
inline
float EcalRecHit::timeError ( ) const
inline

Definition at line 164 of file EcalRecHit.h.

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

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

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

Definition at line 185 of file EcalRecHit.h.

References flagBits_.

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

Member Data Documentation

float EcalRecHit::energy_
private

Definition at line 218 of file EcalRecHit.h.

Referenced by energy(), and setEnergy().

uint32_t EcalRecHit::extra_
private

Definition at line 225 of file EcalRecHit.h.

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

uint32_t EcalRecHit::flagBits_
private

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

Definition at line 222 of file EcalRecHit.h.

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

DetId EcalRecHit::id_
private

Definition at line 217 of file EcalRecHit.h.

Referenced by detid().

float EcalRecHit::time_
private

Definition at line 219 of file EcalRecHit.h.

Referenced by time().