1 #ifndef DATAFORMATS_ECALRECHIT_H
2 #define DATAFORMATS_ECALRECHIT_H 1
98 return (value >> offset) & ((1 <<
width) - 1);
102 const uint32_t mask = ((1 <<
width) - 1) <<
offset;
104 value |= (x & ((1U <<
width) - 1)) << offset;
109 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};
110 int b = e<p10[4] ? 0 : 5;
111 for (;b<9;++
b)
if (e<p10[b])
break;
123 return (
float)rawChi2 / (float)((1<<7)-1) * 64.;
128 if (chi2 > 64) chi2 = 64;
131 uint32_t rawChi2 = lround(chi2 / 64. * ((1<<7)-1));
137 uint16_t
exponent = rawEnergy >> 10;
138 uint16_t significand = ~(0xE<<9) & rawEnergy;
139 return (
float) significand*
pow(10,exponent-5);
145 uint32_t rawEnergy = 0;
146 if (energy > 0.001) {
148 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};
149 uint16_t significand = lround(energy*ip10[exponent]);
151 rawEnergy = exponent << 10 | significand;
168 if( (0xFF & timeErrorBits) == 0x00 )
171 if( (0xFF & timeErrorBits) == 0xFF )
175 uint8_t
exponent = timeErrorBits>>5;
176 uint8_t significand = timeErrorBits & ~(0x7<<5);
177 return pow(2.,exponent)*significand*LSB/1000.;
193 for (std::vector<int>::const_iterator flagPtr = flagsvec.begin();
194 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)