CMS 3D CMS Logo

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

#include <HGCRecHit.h>

Inheritance diagram for HGCRecHit:
CaloRecHit

Public Types

enum  Flags {
  kGood =0, kPoorReco, kOutOfTime, kFaultyHardware,
  kNoisy, kPoorCalib, kSaturated, kDead,
  kKilled, kWeird, kDiWeird, kUnknown
}
 
enum  HGCbheFlags {
  kHGCbheGood, kHGCbheDead, kHGCbheHot, kHGCbhePassBX,
  kHGCbheSaturated
}
 
enum  HGCfheFlags {
  kHGCfheGood, kHGCfheDead, kHGCfheHot, kHGCfhePassBX,
  kHGCfheSaturated
}
 
typedef DetId key_type
 

Public Member Functions

bool checkFlag (int flag) const
 check if the flag is true More...
 
bool checkFlags (const std::vector< int > &flagsvec) const
 check if one of the flags in a set is true More...
 
float chi2 () const
 
 HGCRecHit ()
 
 HGCRecHit (const DetId &id, float energy, float time, uint32_t flags=0, uint32_t flagBits=0)
 
DetId id () const
 get the id More...
 
bool isTimeErrorValid () const
 
bool isTimeValid () const
 
float outOfTimeChi2 () const
 
float outOfTimeEnergy () const
 
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 setSignalOverSigmaNoise (float sOverNoise)
 
void setTimeError (uint8_t timeErrBits)
 
float signalOverSigmaNoise () const
 
float timeError () const
 
void unsetFlag (int flag)
 
- Public Member Functions inherited from CaloRecHit
constexpr uint32_t aux () const
 
constexpr CaloRecHit ()
 
constexpr CaloRecHit (const DetId &id, float energy, float time, uint32_t flags=0, uint32_t aux=0)
 
constexpr const DetIddetid () const
 
constexpr float energy () const
 
constexpr uint32_t flagField (int base, int width=1) const
 
constexpr uint32_t flags () const
 
constexpr void setAux (uint32_t value)
 
constexpr void setEnergy (float energy)
 
constexpr void setFlagField (uint32_t value, int base, int width=1)
 
constexpr void setFlags (uint32_t flags)
 
constexpr void setTime (float time)
 
constexpr float time () const
 

Private Attributes

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

Detailed Description

based on EcalRecHit

Author
Valeri Andreev

Definition at line 14 of file HGCRecHit.h.

Member Typedef Documentation

Definition at line 16 of file HGCRecHit.h.

Member Enumeration Documentation

Enumerator
kGood 
kPoorReco 
kOutOfTime 
kFaultyHardware 
kNoisy 
kPoorCalib 
kSaturated 
kDead 
kKilled 
kWeird 
kDiWeird 
kUnknown 

Definition at line 19 of file HGCRecHit.h.

19  {
20  kGood=0, // channel ok, the energy and time measurement are reliable
21  kPoorReco, // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2)
22  kOutOfTime, // the energy is available from the UncalibRecHit (sync reco), but the event is out of time
23  kFaultyHardware, // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy)
24  kNoisy, // the channel is very noisy
25  kPoorCalib, // the energy is available from the UncalibRecHit, but the calibration of the channel is poor
26  kSaturated, // saturated channel (recovery not tried)
27  kDead, // channel is dead and any recovery fails
28  kKilled, // MC only flag: the channel is killed in the real detector
29  kWeird, // the signal is believed to originate from an anomalous deposit (spike)
30  kDiWeird, // the signal is anomalous, and neighbors another anomalous signal
31  //
32  kUnknown // to ease the interface with functions returning flags.
33  };
Enumerator
kHGCbheGood 
kHGCbheDead 
kHGCbheHot 
kHGCbhePassBX 
kHGCbheSaturated 

Definition at line 45 of file HGCRecHit.h.

Enumerator
kHGCfheGood 
kHGCfheDead 
kHGCfheHot 
kHGCfhePassBX 
kHGCfheSaturated 

Definition at line 36 of file HGCRecHit.h.

Constructor & Destructor Documentation

HGCRecHit::HGCRecHit ( )

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 HGCRecHit.cc.

9  : CaloRecHit(), flagBits_(0) {
10 }
constexpr CaloRecHit()
Definition: CaloRecHit.h:26
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: HGCRecHit.h:108
HGCRecHit::HGCRecHit ( const DetId id,
float  energy,
float  time,
uint32_t  flags = 0,
uint32_t  flagBits = 0 
)

Definition at line 12 of file HGCRecHit.cc.

12  :
13  CaloRecHit(id,energy,time,flags), flagBits_(flagBits) {
14 }
constexpr float energy() const
Definition: CaloRecHit.h:31
constexpr CaloRecHit()
Definition: CaloRecHit.h:26
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: HGCRecHit.h:108
constexpr float time() const
Definition: CaloRecHit.h:33
constexpr uint32_t flags() const
Definition: CaloRecHit.h:36

Member Function Documentation

bool HGCRecHit::checkFlag ( int  flag) const
inline

check if the flag is true

Definition at line 99 of file HGCRecHit.h.

References checkFlags(), RemoveAddSevLevel::flag, and flagBits_.

Referenced by checkFlags().

99 {return flagBits_ & ( 0x1<<flag);}
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: HGCRecHit.h:108
bool HGCRecHit::checkFlags ( const std::vector< int > &  flagsvec) const

check if one of the flags in a set is true

Definition at line 110 of file HGCRecHit.cc.

References checkFlag().

Referenced by checkFlag().

110  {
111 
112  for (std::vector<int>::const_iterator flagPtr = flagsvec.begin();
113  flagPtr!= flagsvec.end(); ++flagPtr) { // check if one of the flags is up
114  if (checkFlag(*flagPtr)) return true;
115  }
116  return false;
117 }
bool checkFlag(int flag) const
check if the flag is true
Definition: HGCRecHit.h:99
float HGCRecHit::chi2 ( void  ) const

Definition at line 16 of file HGCRecHit.cc.

References f, CaloRecHit::flags(), and objects.autophobj::float.

Referenced by id().

16  {
17  uint32_t rawChi2 = 0x7F & (flags()>>4);
18  return (float)rawChi2 / (float)((1<<7)-1) * 64.f;
19 }
double f[11][100]
constexpr uint32_t flags() const
Definition: CaloRecHit.h:36
DetId HGCRecHit::id ( ) const
inline
bool HGCRecHit::isTimeErrorValid ( ) const

Definition at line 100 of file HGCRecHit.cc.

References isTimeValid(), and timeError().

Referenced by id().

100  {
101  if(!isTimeValid())
102  return false;
103  if(timeError() >= 10000)
104  return false;
105 
106  return true;
107 }
bool isTimeValid() const
Definition: HGCRecHit.cc:93
float timeError() const
Definition: HGCRecHit.cc:78
bool HGCRecHit::isTimeValid ( ) const

Definition at line 93 of file HGCRecHit.cc.

References timeError().

Referenced by id(), and isTimeErrorValid().

93  {
94  if(timeError() <= 0)
95  return false;
96  else
97  return true;
98 }
float timeError() const
Definition: HGCRecHit.cc:78
float HGCRecHit::outOfTimeChi2 ( ) const

Definition at line 21 of file HGCRecHit.cc.

References f, CaloRecHit::flags(), and objects.autophobj::float.

Referenced by id().

21  {
22  uint32_t rawChi2Prob = 0x7F & (flags()>>24);
23  return (float)rawChi2Prob / (float)((1<<7)-1) * 64.f;
24 }
double f[11][100]
constexpr uint32_t flags() const
Definition: CaloRecHit.h:36
float HGCRecHit::outOfTimeEnergy ( ) const

Definition at line 26 of file HGCRecHit.cc.

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

Referenced by id().

26  {
27  uint32_t rawEnergy = (0x1FFF & flags()>>11);
28  uint16_t exponent = rawEnergy>>10;
29  uint16_t significand = ~(0xE<<9) & rawEnergy;
30  return (float) significand*pow(10,exponent-5);
31 }
constexpr uint32_t flags() const
Definition: CaloRecHit.h:36
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void HGCRecHit::setChi2 ( float  chi2)

Definition at line 33 of file HGCRecHit.cc.

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

Referenced by id().

33  {
34  // bound the max value of the chi2
35  if ( chi2 > 64 ) chi2 = 64;
36  // use 7 bits
37  uint32_t rawChi2 = lround( chi2 / 64.f * ((1<<7)-1) );
38  // shift by 4 bits (recoFlag)
39  setFlags( (~(0x7F<<4) & flags()) | ((rawChi2 & 0x7F)<<4) );
40 }
double f[11][100]
float chi2() const
Definition: HGCRecHit.cc:16
constexpr void setFlags(uint32_t flags)
Definition: CaloRecHit.h:37
constexpr uint32_t flags() const
Definition: CaloRecHit.h:36
void HGCRecHit::setFlag ( int  flag)
inline

set the flags (from Flags or ESFlags)

Definition at line 95 of file HGCRecHit.h.

References RemoveAddSevLevel::flag, and flagBits_.

Referenced by HGCalRecHitSimpleAlgo::makeRecHit().

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

Definition at line 53 of file HGCRecHit.cc.

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

Referenced by id().

53  {
54  // bound the max value of chi2
55  if ( chi2 > 64 ) chi2 = 64;
56  // use 7 bits
57  uint32_t rawChi2 = lround( chi2 / 64.f * ((1<<7)-1) );
58  // shift by 24 bits (recoFlag + chi2 + outOfTimeEnergy)
59  setFlags( (~(0x7F<<24) & flags()) | ((rawChi2 & 0x7F)<<24) );
60 }
double f[11][100]
float chi2() const
Definition: HGCRecHit.cc:16
constexpr void setFlags(uint32_t flags)
Definition: CaloRecHit.h:37
constexpr uint32_t flags() const
Definition: CaloRecHit.h:36
void HGCRecHit::setOutOfTimeEnergy ( float  energy)

Definition at line 42 of file HGCRecHit.cc.

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

Referenced by id().

42  {
43  if ( energy > 0.001f ) {
44  uint16_t exponent = lround(floor(log10(energy)))+3;
45  uint16_t significand = lround(energy/pow(10,exponent-5));
46  // use 13 bits (3 exponent, 10 significand)
47  uint32_t rawEnergy = exponent<<10 | significand;
48  // shift by 11 bits (recoFlag + chi2)
49  setFlags( ( ~(0x1FFF<<11) & flags()) | ((rawEnergy & 0x1FFF)<<11) );
50  }
51 }
constexpr float energy() const
Definition: CaloRecHit.h:31
double f[11][100]
constexpr void setFlags(uint32_t flags)
Definition: CaloRecHit.h:37
constexpr uint32_t flags() const
Definition: CaloRecHit.h:36
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void HGCRecHit::setSignalOverSigmaNoise ( float  sOverNoise)

Definition at line 62 of file HGCRecHit.cc.

References f, and signalOverSigmaNoise_.

Referenced by id().

62  {
63  // bound the max value of sOverNoise
64  if(sOverNoise > 32.f) sOverNoise = 32.f;
65  //use 8 bits
66  signalOverSigmaNoise_ = lround( sOverNoise / 32.f * ((1<<8)-1) );
67 }
uint8_t signalOverSigmaNoise_
Definition: HGCRecHit.h:109
double f[11][100]
void HGCRecHit::setTimeError ( uint8_t  timeErrBits)

Definition at line 73 of file HGCRecHit.cc.

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

Referenced by id().

73  {
74  // take the bits and put them in the right spot
75  setAux( (~0xFF & aux()) | timeErrBits );
76 }
constexpr uint32_t aux() const
Definition: CaloRecHit.h:52
constexpr void setAux(uint32_t value)
Definition: CaloRecHit.h:51
float HGCRecHit::signalOverSigmaNoise ( ) const

Definition at line 69 of file HGCRecHit.cc.

References signalOverSigmaNoise_.

Referenced by id(), and PFRecHitQTestHGCalThresholdSNR::test().

69  {
70  return (float)signalOverSigmaNoise_ * 0.125f;
71 }
uint8_t signalOverSigmaNoise_
Definition: HGCRecHit.h:109
float HGCRecHit::timeError ( ) const

Definition at line 78 of file HGCRecHit.cc.

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

Referenced by id(), isTimeErrorValid(), and isTimeValid().

78  {
79  uint32_t timeErrorBits = 0xFF & aux();
80  // all bits off --> time reco bailed out (return negative value)
81  if( (0xFF & timeErrorBits) == 0x00 )
82  return -1;
83  // all bits on --> time error over 5 ns (return large value)
84  if( (0xFF & timeErrorBits) == 0xFF )
85  return 10000;
86 
87  float LSB = 1.26008;
88  uint8_t exponent = timeErrorBits>>5;
89  uint8_t significand = timeErrorBits & ~(0x7<<5);
90  return pow(2.,exponent)*significand*LSB/1000.f;
91 }
constexpr uint32_t aux() const
Definition: CaloRecHit.h:52
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void HGCRecHit::unsetFlag ( int  flag)
inline

Definition at line 96 of file HGCRecHit.h.

References RemoveAddSevLevel::flag, and flagBits_.

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

Member Data Documentation

uint32_t HGCRecHit::flagBits_
private

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

Definition at line 108 of file HGCRecHit.h.

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

uint8_t HGCRecHit::signalOverSigmaNoise_
private

Definition at line 109 of file HGCRecHit.h.

Referenced by setSignalOverSigmaNoise(), and signalOverSigmaNoise().