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
EcalRecHit Class Reference

#include <EcalRecHit.h>

Inheritance diagram for EcalRecHit:
CaloRecHit

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, kFake, kFakeNeighbours,
  kDead, kKilled, kTPSaturated, kL1SpikeFlag,
  kUnknown
}
 
typedef DetId key_type
 

Public Member Functions

float chi2 () const
 
float chi2Prob () const
 
 EcalRecHit ()
 
 EcalRecHit (const DetId &id, float energy, float time, uint32_t flags=0, uint32_t flagBits=0)
 
uint32_t flagBits () const
 
DetId id () const
 get the id More...
 
bool isRecovered () const
 
bool isTimeErrorValid () const
 
bool isTimeValid () const
 
float outOfTimeChi2 () const
 
float outOfTimeChi2Prob () const
 
float outOfTimeEnergy () const
 
uint32_t recoFlag () const
 
void setChi2 (float chi2)
 
void setChi2Prob (float chi2Prob)
 
void setFlagBits (uint32_t flagBits)
 
void setOutOfTimeChi2 (float chi2)
 
void setOutOfTimeChi2Prob (float chi2Prob)
 
void setOutOfTimeEnergy (float energy)
 
void setRecoFlag (uint32_t flag)
 
void setTimeError (uint8_t timeErrBits)
 
float timeError () const
 
- 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 setFlagField (uint32_t value, int base, int width=1)
 
void setFlags (uint32_t flags)
 
float time () const
 
virtual ~CaloRecHit ()
 

Private Attributes

uint32_t flagBits_
 

Detailed Description

id:
Author
P. Meridiani INFN Roma1

Definition at line 12 of file EcalRecHit.h.

Member Typedef Documentation

Definition at line 14 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 40 of file EcalRecHit.h.

Enumerator
kGood 
kPoorReco 
kOutOfTime 
kFaultyHardware 
kNoisy 
kPoorCalib 
kSaturated 
kLeadingEdgeRecovered 
kNeighboursRecovered 
kTowerRecovered 
kFake 
kFakeNeighbours 
kDead 
kKilled 
kTPSaturated 
kL1SpikeFlag 
kUnknown 

Definition at line 17 of file EcalRecHit.h.

17  {
18  kGood=0, // channel ok, the energy and time measurement are reliable
19  kPoorReco, // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2)
20  kOutOfTime, // the energy is available from the UncalibRecHit (sync reco), but the event is out of time
21  kFaultyHardware, // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy)
22  kNoisy, // the channel is very noisy
23  kPoorCalib, // the energy is available from the UncalibRecHit, but the calibration of the channel is poor
24  kSaturated, // saturated channel (recovery not tried)
25  kLeadingEdgeRecovered, // saturated channel: energy estimated from the leading edge before saturation
26  kNeighboursRecovered, // saturated/isolated dead: energy estimated from neighbours
27  kTowerRecovered, // channel in TT with no data link, info retrieved from Trigger Primitive
28  kFake, // the signal in the channel is a fake (e.g. a so-called spike)
29  kFakeNeighbours, // the signal in the channel is a fake and it is detected by looking at the neighbours
30  kDead, // channel is dead and any recovery fails
31  kKilled, // MC only flag: the channel is killed in the real detector
32  kTPSaturated, // only for flagBits_: the channel is in a region with saturated TP
33  kL1SpikeFlag, // only for flagBits_: the channel is in a region with TP with sFGVB = 0
34  // pro tempore, this will become obsolete when the online protection against spikes will be activated
35  //
36  kUnknown // to easy the interface with functions returning flags
37  };

Constructor & Destructor Documentation

EcalRecHit::EcalRecHit ( )

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 11 of file EcalRecHit.cc.

11  : CaloRecHit(), flagBits_(0) {
12 }
uint32_t flagBits_
Definition: EcalRecHit.h:98
EcalRecHit::EcalRecHit ( const DetId id,
float  energy,
float  time,
uint32_t  flags = 0,
uint32_t  flagBits = 0 
)

Definition at line 14 of file EcalRecHit.cc.

14  :
17 {
18 }
uint32_t flagBits() const
Definition: EcalRecHit.h:83
float time() const
Definition: CaloRecHit.h:20
float energy() const
Definition: CaloRecHit.h:19
uint32_t flags() const
Definition: CaloRecHit.h:22
uint32_t flagBits_
Definition: EcalRecHit.h:98

Member Function Documentation

float EcalRecHit::chi2 ( void  ) const

Definition at line 27 of file EcalRecHit.cc.

References CaloRecHit::flags().

Referenced by BetaCalculatorECAL::addInfoToCandidate().

28 {
29  uint32_t rawChi2 = 0x7F & (flags()>>4);
30  return (float)rawChi2 / (float)((1<<7)-1) * 64.;
31 }
uint32_t flags() const
Definition: CaloRecHit.h:22
float EcalRecHit::chi2Prob ( ) const

Definition at line 33 of file EcalRecHit.cc.

References ExpressReco_HICollisions_FallBack::cerr, and CaloRecHit::flags().

34 {
35  std::cerr << "Please retrieve the chi2 value instead of its probability.\n";
36  std::cerr << "Use the method EcalRecHit::chi2() for that purpose.\n";
37  std::cerr << "The chi2 is still in a commissioning phase and further\n";
38  std::cerr << "actions will be taken in the future. Thanks.\n";
39  assert(false);
40  uint32_t rawChi2Prob = 0x7F & (flags()>>4);
41  return (float)rawChi2Prob / (float)((1<<7)-1);
42 }
uint32_t flags() const
Definition: CaloRecHit.h:22
uint32_t EcalRecHit::flagBits ( ) const
inline

Definition at line 83 of file EcalRecHit.h.

References flagBits_.

Referenced by setFlagBits().

83 { return flagBits_; }
uint32_t flagBits_
Definition: EcalRecHit.h:98
DetId EcalRecHit::id ( void  ) const
inline
bool EcalRecHit::isRecovered ( ) const
bool EcalRecHit::isTimeErrorValid ( ) const

Definition at line 184 of file EcalRecHit.cc.

References isTimeValid(), and timeError().

Referenced by BetaCalculatorECAL::addInfoToCandidate().

185 {
186  if(!isTimeValid())
187  return false;
188  if(timeError() >= 10000)
189  return false;
190 
191  return true;
192 }
bool isTimeValid() const
Definition: EcalRecHit.cc:175
float timeError() const
Definition: EcalRecHit.cc:158
bool EcalRecHit::isTimeValid ( ) const

Definition at line 175 of file EcalRecHit.cc.

References timeError().

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

176 {
177  if(timeError() <= 0)
178  return false;
179  else
180  return true;
181 }
float timeError() const
Definition: EcalRecHit.cc:158
float EcalRecHit::outOfTimeChi2 ( ) const

Definition at line 58 of file EcalRecHit.cc.

References CaloRecHit::flags().

Referenced by BetaCalculatorECAL::addInfoToCandidate().

59 {
60  uint32_t rawChi2Prob = 0x7F & (flags()>>24);
61  return (float)rawChi2Prob / (float)((1<<7)-1) * 64.;
62 }
uint32_t flags() const
Definition: CaloRecHit.h:22
float EcalRecHit::outOfTimeChi2Prob ( ) const

Definition at line 44 of file EcalRecHit.cc.

References ExpressReco_HICollisions_FallBack::cerr.

45 {
46  std::cerr << "Please retrieve the chi2 value instead of its probability.\n";
47  std::cerr << "Use the method EcalRecHit::outOfTimeChi2() for that purpose.\n";
48  std::cerr << "The chi2 is still in a commissioning phase and further\n";
49  std::cerr << "actions will be taken in the future. Thanks.\n";
50  assert(false);
51  /*
52  uint32_t rawChi2Prob = 0x7F & (flags()>>24);
53  return (float)rawChi2Prob / (float)((1<<7)-1);
54  */
55  return -1; // will never get here
56 }
float EcalRecHit::outOfTimeEnergy ( ) const

Definition at line 64 of file EcalRecHit.cc.

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

Referenced by BetaCalculatorECAL::addInfoToCandidate().

65 {
66  uint32_t rawEnergy = (0x1FFF & flags()>>11);
67  uint16_t exponent = rawEnergy>>10;
68  uint16_t significand = ~(0xE<<9) & rawEnergy;
69  return (float) significand*pow(10,exponent-5);
70 }
uint32_t flags() const
Definition: CaloRecHit.h:22
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
uint32_t EcalRecHit::recoFlag ( ) const
inline
void EcalRecHit::setChi2 ( float  chi2)

Definition at line 97 of file EcalRecHit.cc.

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

Referenced by EcalRecHitSimpleAlgo::makeRecHit().

98 {
99  // bound the max value of the chi2
100  if ( chi2 > 64 ) chi2 = 64;
101  // use 7 bits
102  uint32_t rawChi2 = lround( chi2 / 64. * ((1<<7)-1) );
103  // shift by 4 bits (recoFlag)
104  setFlags( (~(0x7F<<4) & flags()) | ((rawChi2 & 0x7F)<<4) );
105 }
float chi2() const
Definition: EcalRecHit.cc:27
uint32_t flags() const
Definition: CaloRecHit.h:22
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:23
void EcalRecHit::setChi2Prob ( float  chi2Prob)

Definition at line 77 of file EcalRecHit.cc.

References ExpressReco_HICollisions_FallBack::cerr.

78 {
79  /* not used - store the raw chi2 instead */
80  std::cerr << "Please store the chi2 value instead of its probability.\n";
81  std::cerr << "Use the method EcalRecHit::setChi2() for that purpose.\n";
82  std::cerr << "The chi2 is still in a commissioning phase and further\n";
83  std::cerr << "actions will be taken in the future. Thanks.\n";
84  assert(false);
85  /*
86  if ( chi2Prob < 0 || chi2Prob > 1 ) {
87  edm::LogWarning("EcalRecHit::setChi2Prob") << "chi2Prob outside limits [0, 1] : " << chi2Prob;
88  } else {
89  // use 7 bits
90  uint32_t rawChi2Prob = lround( chi2Prob * ((1<<7)-1) );
91  // shift by 4 bits (recoFlag)
92  setFlags( (~(0x7F<<4) & flags()) | ((rawChi2Prob & 0x7F)<<4) );
93  }
94  */
95 }
void EcalRecHit::setFlagBits ( uint32_t  flagBits)
inline

Definition at line 94 of file EcalRecHit.h.

References flagBits(), and flagBits_.

Referenced by EcalRecHitWorkerRecover::run().

94 { flagBits_ = flagBits; }
uint32_t flagBits() const
Definition: EcalRecHit.h:83
uint32_t flagBits_
Definition: EcalRecHit.h:98
void EcalRecHit::setOutOfTimeChi2 ( float  chi2)

Definition at line 140 of file EcalRecHit.cc.

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

141 {
142  // bound the max value of chi2
143  if ( chi2 > 64 ) chi2 = 64;
144  // use 7 bits
145  uint32_t rawChi2 = lround( chi2 / 64. * ((1<<7)-1) );
146  // shift by 24 bits (recoFlag + chi2 + outOfTimeEnergy)
147  setFlags( (~(0x7F<<24) & flags()) | ((rawChi2 & 0x7F)<<24) );
148 }
float chi2() const
Definition: EcalRecHit.cc:27
uint32_t flags() const
Definition: CaloRecHit.h:22
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:23
void EcalRecHit::setOutOfTimeChi2Prob ( float  chi2Prob)

Definition at line 119 of file EcalRecHit.cc.

References ExpressReco_HICollisions_FallBack::cerr.

120 {
121  /* not used - store the raw chi2 instead */
122  std::cerr << "Please store the chi2 value instead of its probability.\n";
123  std::cerr << "Use the method EcalRecHit::setOutOfTimeChi2() for that purpose.\n";
124  std::cerr << "The chi2 is still in a commissioning phase and further\n";
125  std::cerr << "actions will be taken in the future. Thanks.\n";
126  assert(false);
127  /*
128  if ( chi2Prob < 0 || chi2Prob > 1 ) {
129  edm::LogWarning("EcalRecHit::setOutOfTimeChi2Prob") << "chi2Prob outside limits [0, 1] : " << chi2Prob;
130  } else {
131  // use 7 bits
132  uint32_t rawChi2Prob = lround( chi2Prob * ((1<<7)-1) );
133  // shift by 24 bits (recoFlag + chi2 + outOfTimeEnergy)
134  setFlags( (~(0x7F<<24) & flags()) | ((rawChi2Prob & 0x7F)<<24) );
135  }
136  */
137 }
void EcalRecHit::setOutOfTimeEnergy ( float  energy)

Definition at line 107 of file EcalRecHit.cc.

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

Referenced by ESRecHitSimAlgo::reconstruct().

108 {
109  if ( energy > 0.001 ) {
110  uint16_t exponent = lround(floor(log10(energy)))+3;
111  uint16_t significand = lround(energy/pow(10,exponent-5));
112  // use 13 bits (3 exponent, 10 significand)
113  uint32_t rawEnergy = exponent<<10 | significand;
114  // shift by 11 bits (recoFlag + chi2)
115  setFlags( ( ~(0x1FFF<<11) & flags()) | ((rawEnergy & 0x1FFF)<<11) );
116  }
117 }
float energy() const
Definition: CaloRecHit.h:19
uint32_t flags() const
Definition: CaloRecHit.h:22
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:23
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void EcalRecHit::setRecoFlag ( uint32_t  flag)

Definition at line 72 of file EcalRecHit.cc.

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

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

73 {
74  setFlags( (~0xF & flags()) | (flag & 0xF) );
75 }
long int flag
Definition: mlp_lapack.h:47
uint32_t flags() const
Definition: CaloRecHit.h:22
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:23
void EcalRecHit::setTimeError ( uint8_t  timeErrBits)

Definition at line 151 of file EcalRecHit.cc.

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

152 {
153  // take the bits and put them in the right spot
154  setAux( (~0xFF & aux()) | timeErrBits );
155 }
uint32_t aux() const
Definition: CaloRecHit.h:27
void setAux(uint32_t value)
Definition: CaloRecHit.h:26
float EcalRecHit::timeError ( ) const

Definition at line 158 of file EcalRecHit.cc.

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

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

159 {
160  uint32_t timeErrorBits = 0xFF & aux();
161  // all bits off --> time reco bailed out (return negative value)
162  if( (0xFF & timeErrorBits) == 0x00 )
163  return -1;
164  // all bits on --> time error over 5 ns (return large value)
165  if( (0xFF & timeErrorBits) == 0xFF )
166  return 10000;
167 
168  float LSB = 1.26008;
169  uint8_t exponent = timeErrorBits>>5;
170  uint8_t significand = timeErrorBits & ~(0x7<<5);
171  return pow(2.,exponent)*significand*LSB/1000.;
172 }
uint32_t aux() const
Definition: CaloRecHit.h:27
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40

Member Data Documentation

uint32_t EcalRecHit::flagBits_
private

Definition at line 98 of file EcalRecHit.h.

Referenced by flagBits(), and setFlagBits().