1 #ifndef DATAFORMATS_ECALRECHIT_H
2 #define DATAFORMATS_ECALRECHIT_H 1
97 return (value >> offset) & ((1 <<
width) - 1);
101 const uint32_t mask = ((1 <<
width) - 1) <<
offset;
103 value |= (x & ((1U <<
width) - 1)) << offset;
108 static constexpr float p10[] = {1.e-2
f,1.e-1
f,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;
122 return (
float)rawChi2 / (float)((1<<7)-1) * 64.;
127 if (chi2 > 64) chi2 = 64;
130 uint32_t rawChi2 = lround(chi2 / 64. * ((1<<7)-1));
136 uint16_t
exponent = rawEnergy >> 10;
137 uint16_t significand = ~(0xE<<9) & rawEnergy;
138 return (
float) significand*
pow(10,exponent-5);
144 uint32_t rawEnergy = 0;
145 if (energy > 0.001) {
147 static constexpr float ip10[] = {1.e5f,1.e4f,1.e3f,1.e2f,1.e1f,1.e0f,1.e-1
f,1.e-2
f,1.e-3
f,1.e-4};
148 uint16_t significand = lround(energy*ip10[exponent]);
150 rawEnergy = exponent << 10 | significand;
167 if( (0xFF & timeErrorBits) == 0x00 )
170 if( (0xFF & timeErrorBits) == 0xFF )
174 uint8_t
exponent = timeErrorBits>>5;
175 uint8_t significand = timeErrorBits & ~(0x7<<5);
176 return pow(2.,exponent)*significand*LSB/1000.;
192 for (std::vector<int>::const_iterator flagPtr = flagsvec.begin();
193 flagPtr!= flagsvec.end(); ++flagPtr) {
bool isTimeErrorValid() const
bool checkFlags(const std::vector< int > &flagsvec) const
check if one of the flags in a set is true
static uint32_t setMasked(uint32_t value, uint32_t x, uint32_t offset, uint32_t width)
static int getPower10(float e)
const DetId & detid() const
void setFlag(int flag)
set the flags (from Flags or ESFlags)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
void setEnergyError(float energy)
void setTimeError(uint8_t timeErrBits)
bool checkFlag(int flag) const
check if the flag is true
static uint32_t getMasked(uint32_t value, uint32_t offset, uint32_t width)
float energyError() const
DetId id() const
get the id
void setEnergy(float energy)
Flags recoFlag() const
DEPRECATED provided for temporary backward compatibility.
EcalRecHit(const DetId &id, float energy, float time, uint32_t extra=0, uint32_t flagBits=0)
bool checkFlagMask(uint32_t mask) const
apply a bitmask to our flags. Experts only
uint32_t flagBits_
store rechit condition (see Flags enum) in a bit-wise way
Power< A, B >::type pow(const A &a, const B &b)