1 #ifndef DataFormats_SiPixelRecHitQuality_h 2 #define DataFormats_SiPixelRecHitQuality_h 1 63 edm::LogWarning(
"ObsoleteVariable") <<
"Since 39x, probabilityX and probabilityY have been replaced by probabilityXY and probabilityQ";
67 edm::LogWarning(
"ObsoleteVariable") <<
"Since 39x, probabilityX and probabilityY have been replaced by probabilityXY and probabilityQ";
73 if(raw<0 || raw >16383) {
74 edm::LogWarning(
"OutOfBounds") <<
"Probability XY outside the bounds of the quality word. Defaulting to Prob=0. Raw = " << raw <<
" QualityWord = " << qualWord;
77 float prob = (raw==16383) ? 0:
pow( probX_units, (
float)( -raw) );
83 if(raw<0 || raw >255) {
84 edm::LogWarning(
"OutOfBounds") <<
"Probability Q outside the bounds of the quality word. Defaulting to Prob=0. Raw = " << raw <<
" QualityWord = " << qualWord;
87 float prob = (raw==255) ? 0 :
pow( probY_units, (
float)( -raw) );
93 inline int qBin( QualWordType qualWord )
const {
94 int qbin = (qualWord >>
qBin_shift) & qBin_mask;
95 if(qbin<0 || qbin >7) {
96 edm::LogWarning(
"OutOfBounds") <<
"Qbin outside the bounds of the quality word. Defaulting to Qbin=0. Qbin = " << qbin <<
" QualityWord = " << qualWord;
103 inline bool isOnEdge( QualWordType qualWord )
const {
104 return (qualWord >> edge_shift) &
edge_mask;
108 return (qualWord >> bad_shift) &
bad_mask;
124 if(prob<0 || prob>1) {
125 edm::LogWarning(
"OutOfBounds") <<
"Prob XY outside the bounds of the quality word. Defaulting to Prob=0. Prob = " << prob <<
" QualityWord = " << qualWord;
128 double draw = (prob<=1.6E-13) ? 16383 : -
log( (
double)
prob ) * probX_1_over_log_units;
129 unsigned int raw = (
int) (draw+0.5);
131 qualWord |= ((raw &
probX_mask) << probX_shift);
134 if(prob<0 || prob>1) {
135 edm::LogWarning(
"OutOfBounds") <<
"Prob Q outside the bounds of the quality word. Defaulting to Prob=0. Prob = " << 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);
145 inline void setQBin(
int qbin, QualWordType & qualWord )
const {
146 if(qbin<0 || qbin >7) {
147 edm::LogWarning(
"OutOfBounds") <<
"Qbin outside the bounds of the quality word. Defaulting to Qbin=0. Qbin = " << qbin <<
" QualityWord = " << qualWord;
150 qualWord |= ((qbin &
qBin_mask) << qBin_shift);
154 qualWord |= ((flag &
edge_mask) << edge_shift);
157 qualWord |= ((flag &
bad_mask) << bad_shift);
160 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
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
def draw(name, histos, styles, legendLabels=[], xtitle=None, ytitle=None, drawOpt="HIST", legendDx=0, legendDy=0, legendDw=0, legendDh=0, xmin=None, ymin=0, xmax=None, ymax=None, xlog=False, ylog=False, xgrid=True, ygrid=True, ratio=False, ratioYmin=0.5, ratioYmax=1.5, ratioYTitle=plotting._ratioYTitle)
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