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;
115 return (
float)rawChi2 / (float)((1<<7)-1) * 64.;
120 if (chi2 > 64) chi2 = 64;
123 uint32_t rawChi2 = lround(chi2 / 64. * ((1<<7)-1));
129 uint16_t
exponent = rawEnergy >> 10;
130 uint16_t significand = ~(0xE<<9) & rawEnergy;
131 return (
float) significand*
pow(10,exponent-5);
137 uint32_t rawEnergy = 0;
138 if (energy > 0.001) {
139 uint16_t
exponent = lround(floor(log10(energy))) + 3;
140 uint16_t significand = lround(energy/
pow(10, exponent - 5));
142 rawEnergy = exponent << 10 | significand;
151 if( (0xFF & timeErrorBits) == 0x00 )
154 if( (0xFF & timeErrorBits) == 0xFF )
158 uint8_t
exponent = timeErrorBits>>5;
159 uint8_t significand = timeErrorBits & ~(0x7<<5);
160 return pow(2.,exponent)*significand*LSB/1000.;
176 for (std::vector<int>::const_iterator flagPtr = flagsvec.begin();
177 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)
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)