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

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 8 of file HGCRecHit.cc.

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

Definition at line 11 of file HGCRecHit.cc.

11  :
12  CaloRecHit(id,energy,time,flags), flagBits_(flagBits) {
13 }
float time() const
Definition: CaloRecHit.h:19
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Definition: HGCRecHit.h:104
float energy() const
Definition: CaloRecHit.h:17
uint32_t flags() const
Definition: CaloRecHit.h:21

Member Function Documentation

bool HGCRecHit::checkFlag ( int  flag) const
inline

check if the flag is true

Definition at line 95 of file HGCRecHit.h.

References flagBits_.

Referenced by checkFlags().

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

check if one of the flags in a set is true

Definition at line 98 of file HGCRecHit.cc.

References checkFlag().

98  {
99 
100  for (std::vector<int>::const_iterator flagPtr = flagsvec.begin();
101  flagPtr!= flagsvec.end(); ++flagPtr) { // check if one of the flags is up
102  if (checkFlag(*flagPtr)) return true;
103  }
104  return false;
105 }
bool checkFlag(int flag) const
check if the flag is true
Definition: HGCRecHit.h:95
float HGCRecHit::chi2 ( void  ) const

Definition at line 15 of file HGCRecHit.cc.

References CaloRecHit::flags().

15  {
16  uint32_t rawChi2 = 0x7F & (flags()>>4);
17  return (float)rawChi2 / (float)((1<<7)-1) * 64.;
18 }
uint32_t flags() const
Definition: CaloRecHit.h:21
DetId HGCRecHit::id ( ) const
inline

get the id

Definition at line 69 of file HGCRecHit.h.

References CaloRecHit::detid().

69 { return DetId(detid());}
const DetId & detid() const
Definition: CaloRecHit.h:20
Definition: DetId.h:18
bool HGCRecHit::isTimeErrorValid ( ) const

Definition at line 88 of file HGCRecHit.cc.

References isTimeValid(), and timeError().

88  {
89  if(!isTimeValid())
90  return false;
91  if(timeError() >= 10000)
92  return false;
93 
94  return true;
95 }
bool isTimeValid() const
Definition: HGCRecHit.cc:81
float timeError() const
Definition: HGCRecHit.cc:66
bool HGCRecHit::isTimeValid ( ) const

Definition at line 81 of file HGCRecHit.cc.

References timeError().

Referenced by isTimeErrorValid().

81  {
82  if(timeError() <= 0)
83  return false;
84  else
85  return true;
86 }
float timeError() const
Definition: HGCRecHit.cc:66
float HGCRecHit::outOfTimeChi2 ( ) const

Definition at line 20 of file HGCRecHit.cc.

References CaloRecHit::flags().

20  {
21  uint32_t rawChi2Prob = 0x7F & (flags()>>24);
22  return (float)rawChi2Prob / (float)((1<<7)-1) * 64.;
23 }
uint32_t flags() const
Definition: CaloRecHit.h:21
float HGCRecHit::outOfTimeEnergy ( ) const

Definition at line 25 of file HGCRecHit.cc.

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

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

Definition at line 32 of file HGCRecHit.cc.

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

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

set the flags (from Flags or ESFlags)

Definition at line 91 of file HGCRecHit.h.

References flagBits_.

Referenced by HGCalRecHitSimpleAlgo::makeRecHit().

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

Definition at line 52 of file HGCRecHit.cc.

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

52  {
53  // bound the max value of chi2
54  if ( chi2 > 64 ) chi2 = 64;
55  // use 7 bits
56  uint32_t rawChi2 = lround( chi2 / 64. * ((1<<7)-1) );
57  // shift by 24 bits (recoFlag + chi2 + outOfTimeEnergy)
58  setFlags( (~(0x7F<<24) & flags()) | ((rawChi2 & 0x7F)<<24) );
59 }
uint32_t flags() const
Definition: CaloRecHit.h:21
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:22
float chi2() const
Definition: HGCRecHit.cc:15
void HGCRecHit::setOutOfTimeEnergy ( float  energy)

Definition at line 41 of file HGCRecHit.cc.

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

41  {
42  if ( energy > 0.001 ) {
43  uint16_t exponent = lround(floor(log10(energy)))+3;
44  uint16_t significand = lround(energy/pow(10,exponent-5));
45  // use 13 bits (3 exponent, 10 significand)
46  uint32_t rawEnergy = exponent<<10 | significand;
47  // shift by 11 bits (recoFlag + chi2)
48  setFlags( ( ~(0x1FFF<<11) & flags()) | ((rawEnergy & 0x1FFF)<<11) );
49  }
50 }
float energy() const
Definition: CaloRecHit.h:17
uint32_t flags() const
Definition: CaloRecHit.h:21
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:22
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void HGCRecHit::setTimeError ( uint8_t  timeErrBits)

Definition at line 61 of file HGCRecHit.cc.

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

61  {
62  // take the bits and put them in the right spot
63  setAux( (~0xFF & aux()) | timeErrBits );
64 }
uint32_t aux() const
Definition: CaloRecHit.h:26
void setAux(uint32_t value)
Definition: CaloRecHit.h:25
float HGCRecHit::timeError ( ) const

Definition at line 66 of file HGCRecHit.cc.

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

Referenced by isTimeErrorValid(), and isTimeValid().

66  {
67  uint32_t timeErrorBits = 0xFF & aux();
68  // all bits off --> time reco bailed out (return negative value)
69  if( (0xFF & timeErrorBits) == 0x00 )
70  return -1;
71  // all bits on --> time error over 5 ns (return large value)
72  if( (0xFF & timeErrorBits) == 0xFF )
73  return 10000;
74 
75  float LSB = 1.26008;
76  uint8_t exponent = timeErrorBits>>5;
77  uint8_t significand = timeErrorBits & ~(0x7<<5);
78  return pow(2.,exponent)*significand*LSB/1000.;
79 }
uint32_t aux() const
Definition: CaloRecHit.h:26
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void HGCRecHit::unsetFlag ( int  flag)
inline

Definition at line 92 of file HGCRecHit.h.

References flagBits_.

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

Member Data Documentation

uint32_t HGCRecHit::flagBits_
private

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

Definition at line 104 of file HGCRecHit.h.

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