1 #ifndef DataFormats_SiPixelRecHitQuality_h 2 #define DataFormats_SiPixelRecHitQuality_h 1 60 <<
"Since 39x, probabilityX and probabilityY have been replaced by probabilityXY and probabilityQ";
65 <<
"Since 39x, probabilityX and probabilityY have been replaced by probabilityXY and probabilityQ";
71 if (raw < 0 || raw > 16383) {
73 <<
"Probability XY outside the bounds of the quality word. Defaulting to Prob=0. Raw = " << raw
74 <<
" QualityWord = " << qualWord;
77 float prob = (raw == 16383) ? 0 :
pow(probX_units, (
float)(-raw));
83 if (raw < 0 || raw > 255) {
85 <<
"Probability Q outside the bounds of the quality word. Defaulting to Prob=0. Raw = " << raw
86 <<
" QualityWord = " << qualWord;
89 float prob = (raw == 255) ? 0 :
pow(probY_units, (
float)(-raw));
95 inline int qBin(QualWordType qualWord)
const {
96 int qbin = (qualWord >>
qBin_shift) & qBin_mask;
97 if (qbin < 0 || qbin > 7) {
98 edm::LogWarning(
"OutOfBounds") <<
"Qbin outside the bounds of the quality word. Defaulting to Qbin=0. Qbin = " 99 << qbin <<
" QualityWord = " << qualWord;
106 inline bool isOnEdge(QualWordType qualWord)
const {
return (qualWord >> edge_shift) &
edge_mask; }
121 if (prob < 0 || prob > 1) {
123 <<
"Prob XY outside the bounds of the quality word. Defaulting to Prob=0. Prob = " << prob
124 <<
" QualityWord = " << qualWord;
127 double draw = (prob <= 1.6E-13) ? 16383 : -
log((
double)
prob) * probX_1_over_log_units;
128 unsigned int raw = (
int)(draw + 0.5);
130 qualWord |= ((raw &
probX_mask) << probX_shift);
133 if (prob < 0 || prob > 1) {
134 edm::LogWarning(
"OutOfBounds") <<
"Prob Q outside the bounds of the quality word. Defaulting to Prob=0. Prob = " 135 << prob <<
" QualityWord = " << qualWord;
138 double draw = (prob <= 1E-5) ? 255 : -
log((
double)
prob) * probY_1_over_log_units;
139 unsigned int raw = (
int)(draw + 0.5);
141 qualWord |= ((raw &
probY_mask) << probY_shift);
144 inline void setQBin(
int qbin, QualWordType& qualWord)
const {
145 if (qbin < 0 || qbin > 7) {
146 edm::LogWarning(
"OutOfBounds") <<
"Qbin outside the bounds of the quality word. Defaulting to Qbin=0. Qbin = " 147 << qbin <<
" QualityWord = " << qualWord;
150 qualWord |= ((qbin &
qBin_mask) << qBin_shift);
155 qualWord |= ((flag &
bad_mask) << bad_shift);
158 qualWord |= ((flag &
twoROC_mask) << twoROC_shift);
float probabilityQ(QualWordType qualWord) const
void setProbabilityXY(float prob, QualWordType &qualWord) const
double probX_1_over_log_units
bool spansTwoROCs(QualWordType qualWord) const
static const Packing thePacking
float probabilityXY(QualWordType qualWord) const
double probY_1_over_log_units
def draw(name, histos, styles=_defaultStyles, legendLabels=[], kwargs)
void setHasBadPixels(bool flag, QualWordType &qualWord) const
void setProbabilityQ(float prob, QualWordType &qualWord) const
float probabilityY(QualWordType qualWord) const
int qBin(QualWordType qualWord) const
void setSpansTwoROCs(bool flag, QualWordType &qualWord) const
float probabilityX(QualWordType qualWord) const
void setIsOnEdge(bool flag, QualWordType &qualWord) const
bool isOnEdge(QualWordType qualWord) const
unsigned int QualWordType
bool hasBadPixels(QualWordType qualWord) const
void setHasFilledProb(bool flag, QualWordType &qualWord) const
void setQBin(int qbin, QualWordType &qualWord) const
QualWordType hasFilledProb_mask
Power< A, B >::type pow(const A &a, const B &b)
bool hasFilledProb(QualWordType qualWord) const