#include <SiPixelRecHitQuality.h>
Definition at line 23 of file SiPixelRecHitQuality.h.
SiPixelRecHitQuality::Packing::Packing | ( | ) |
Definition at line 5 of file SiPixelRecHitQuality.cc.
References bad_mask, bad_shift, bad_width, edge_mask, edge_shift, edge_width, Exception, hasFilledProb_mask, hasFilledProb_shift, hasFilledProb_width, create_public_lumi_plots::log, probX_1_over_log_units, probX_mask, probX_shift, probX_units, probX_width, probY_1_over_log_units, probY_mask, probY_shift, probY_units, probY_width, qBin_mask, qBin_shift, qBin_width, spare_width, twoROC_mask, twoROC_shift, and twoROC_width.
{ // Constructor: pre-computes masks and shifts from field widths // X is now XY // Y is now Q probX_width = 14; probY_width = 8; qBin_width = 3; edge_width = 1; bad_width = 1; twoROC_width = 1; hasFilledProb_width = 1; spare_width = 3; if ( probX_width + probY_width + qBin_width + edge_width + bad_width + twoROC_width + hasFilledProb_width + spare_width != 32 ) { throw cms::Exception("SiPixelRecHitQuality::Packing: ") << "\nERROR: The allocated bits for the quality word to not sum to 32." << "\n\n"; } probX_units = 1.0018; probY_units = 1.0461; probX_1_over_log_units = 1.0 / log( probX_units ); probY_1_over_log_units = 1.0 / log( probY_units ); // Fields are counted from right to left! probX_shift = 0; probY_shift = probX_shift + probX_width; qBin_shift = probY_shift + probY_width; edge_shift = qBin_shift + qBin_width; bad_shift = edge_shift + edge_width; twoROC_shift = bad_shift + bad_width; hasFilledProb_shift = twoROC_shift + twoROC_width; // Ensure the complement of the correct // number of bits: QualWordType zero32 = 0; // 32-bit wide set of 0's probX_mask = ~(~zero32 << probX_width); probY_mask = ~(~zero32 << probY_width); qBin_mask = ~(~zero32 << qBin_width); edge_mask = ~(~zero32 << edge_width); bad_mask = ~(~zero32 << bad_width); twoROC_mask = ~(~zero32 << twoROC_width); hasFilledProb_mask = ~(~zero32 << hasFilledProb_width); }
bool SiPixelRecHitQuality::Packing::hasBadPixels | ( | QualWordType | qualWord | ) | const [inline] |
bool SiPixelRecHitQuality::Packing::hasFilledProb | ( | QualWordType | qualWord | ) | const [inline] |
Definition at line 122 of file SiPixelRecHitQuality.h.
References hasFilledProb_mask, and hasFilledProb_shift.
{ return (qualWord >> hasFilledProb_shift) & hasFilledProb_mask; }
bool SiPixelRecHitQuality::Packing::isOnEdge | ( | QualWordType | qualWord | ) | const [inline] |
Definition at line 110 of file SiPixelRecHitQuality.h.
References edge_mask, and edge_shift.
{ return (qualWord >> edge_shift) & edge_mask; }
float SiPixelRecHitQuality::Packing::probabilityQ | ( | QualWordType | qualWord | ) | const [inline] |
Definition at line 88 of file SiPixelRecHitQuality.h.
References funct::pow(), mix_2012_Summer_inTimeOnly_cff::prob, probY_mask, probY_shift, and probY_units.
{ int raw = (qualWord >> probY_shift) & probY_mask; if(raw<0 || raw >255) { edm::LogWarning("OutOfBounds") << "Probability Q outside the bounds of the quality word. Defaulting to Prob=0. Raw = " << raw << " QualityWord = " << qualWord; raw = 255; } float prob = (raw==255) ? 0 : pow( probY_units, (float)( -raw) ); // cout << "Bits = " << raw << " --> Prob = " << prob << endl; return prob; }
float SiPixelRecHitQuality::Packing::probabilityX | ( | QualWordType | qualWord | ) | const [inline] |
Definition at line 69 of file SiPixelRecHitQuality.h.
{ edm::LogWarning("ObsoleteVariable") << "Since 39x, probabilityX and probabilityY have been replaced by probabilityXY and probabilityQ"; return -10; }
float SiPixelRecHitQuality::Packing::probabilityXY | ( | QualWordType | qualWord | ) | const [inline] |
Definition at line 78 of file SiPixelRecHitQuality.h.
References funct::pow(), mix_2012_Summer_inTimeOnly_cff::prob, probX_mask, probX_shift, and probX_units.
{ int raw = (qualWord >> probX_shift) & probX_mask; if(raw<0 || raw >16383) { edm::LogWarning("OutOfBounds") << "Probability XY outside the bounds of the quality word. Defaulting to Prob=0. Raw = " << raw << " QualityWord = " << qualWord; raw = 16383; } float prob = (raw==16383) ? 0: pow( probX_units, (float)( -raw) ); // cout << "Bits = " << raw << " --> Prob = " << prob << endl; return prob; }
float SiPixelRecHitQuality::Packing::probabilityY | ( | QualWordType | qualWord | ) | const [inline] |
Definition at line 73 of file SiPixelRecHitQuality.h.
{ edm::LogWarning("ObsoleteVariable") << "Since 39x, probabilityX and probabilityY have been replaced by probabilityXY and probabilityQ"; return -10; }
int SiPixelRecHitQuality::Packing::qBin | ( | QualWordType | qualWord | ) | const [inline] |
Definition at line 100 of file SiPixelRecHitQuality.h.
References qBin_mask, and qBin_shift.
{ int qbin = (qualWord >> qBin_shift) & qBin_mask; if(qbin<0 || qbin >7) { edm::LogWarning("OutOfBounds") << "Qbin outside the bounds of the quality word. Defaulting to Qbin=0. Qbin = " << qbin << " QualityWord = " << qualWord; qbin=0; } return qbin; }
void SiPixelRecHitQuality::Packing::setHasBadPixels | ( | bool | flag, |
QualWordType & | qualWord | ||
) | [inline] |
void SiPixelRecHitQuality::Packing::setHasFilledProb | ( | bool | flag, |
QualWordType & | qualWord | ||
) | [inline] |
Definition at line 169 of file SiPixelRecHitQuality.h.
References hasFilledProb_mask, and hasFilledProb_shift.
{ qualWord |= ((flag & hasFilledProb_mask) << hasFilledProb_shift); }
void SiPixelRecHitQuality::Packing::setIsOnEdge | ( | bool | flag, |
QualWordType & | qualWord | ||
) | [inline] |
Definition at line 160 of file SiPixelRecHitQuality.h.
References edge_mask, and edge_shift.
{ qualWord |= ((flag & edge_mask) << edge_shift); }
void SiPixelRecHitQuality::Packing::setProbabilityQ | ( | float | prob, |
QualWordType & | qualWord | ||
) | [inline] |
Definition at line 140 of file SiPixelRecHitQuality.h.
References cond::draw(), create_public_lumi_plots::log, mix_2012_Summer_inTimeOnly_cff::prob, probY_1_over_log_units, probY_mask, and probY_shift.
{ if(prob<0 || prob>1) { edm::LogWarning("OutOfBounds") << "Prob Q outside the bounds of the quality word. Defaulting to Prob=0. Prob = " << prob << " QualityWord = " << qualWord; prob=0; } double draw = (prob<=1E-5) ? 255 : - log( (double) prob ) * probY_1_over_log_units; unsigned int raw = (int) (draw+0.5); // convert to integer, round correctly // cout << "Prob = " << prob << " --> Bits = " << raw << endl; qualWord |= ((raw & probY_mask) << probY_shift); }
void SiPixelRecHitQuality::Packing::setProbabilityXY | ( | float | prob, |
QualWordType & | qualWord | ||
) | [inline] |
Definition at line 130 of file SiPixelRecHitQuality.h.
References cond::draw(), create_public_lumi_plots::log, mix_2012_Summer_inTimeOnly_cff::prob, probX_1_over_log_units, probX_mask, and probX_shift.
{ if(prob<0 || prob>1) { edm::LogWarning("OutOfBounds") << "Prob XY outside the bounds of the quality word. Defaulting to Prob=0. Prob = " << prob << " QualityWord = " << qualWord; prob=0; } double draw = (prob<=1.6E-13) ? 16383 : - log( (double) prob ) * probX_1_over_log_units; unsigned int raw = (int) (draw+0.5); // convert to integer, round correctly // cout << "Prob = " << prob << " --> Bits = " << raw << endl; qualWord |= ((raw & probX_mask) << probX_shift); }
void SiPixelRecHitQuality::Packing::setQBin | ( | int | qbin, |
QualWordType & | qualWord | ||
) | [inline] |
Definition at line 152 of file SiPixelRecHitQuality.h.
References qBin_mask, and qBin_shift.
{ if(qbin<0 || qbin >7) { edm::LogWarning("OutOfBounds") << "Qbin outside the bounds of the quality word. Defaulting to Qbin=0. Qbin = " << qbin << " QualityWord = " << qualWord; qbin=0; } qualWord |= ((qbin & qBin_mask) << qBin_shift); }
void SiPixelRecHitQuality::Packing::setSpansTwoROCs | ( | bool | flag, |
QualWordType & | qualWord | ||
) | [inline] |
Definition at line 166 of file SiPixelRecHitQuality.h.
References twoROC_mask, and twoROC_shift.
{ qualWord |= ((flag & twoROC_mask) << twoROC_shift); }
bool SiPixelRecHitQuality::Packing::spansTwoROCs | ( | QualWordType | qualWord | ) | const [inline] |
Definition at line 118 of file SiPixelRecHitQuality.h.
References twoROC_mask, and twoROC_shift.
{ return (qualWord >> twoROC_shift) & twoROC_mask; }
Definition at line 50 of file SiPixelRecHitQuality.h.
Referenced by hasBadPixels(), Packing(), and setHasBadPixels().
Definition at line 51 of file SiPixelRecHitQuality.h.
Referenced by hasBadPixels(), Packing(), and setHasBadPixels().
Definition at line 52 of file SiPixelRecHitQuality.h.
Referenced by Packing().
Definition at line 46 of file SiPixelRecHitQuality.h.
Referenced by isOnEdge(), Packing(), and setIsOnEdge().
Definition at line 47 of file SiPixelRecHitQuality.h.
Referenced by isOnEdge(), Packing(), and setIsOnEdge().
Definition at line 48 of file SiPixelRecHitQuality.h.
Referenced by Packing().
Definition at line 58 of file SiPixelRecHitQuality.h.
Referenced by hasFilledProb(), Packing(), and setHasFilledProb().
Definition at line 59 of file SiPixelRecHitQuality.h.
Referenced by hasFilledProb(), Packing(), and setHasFilledProb().
Definition at line 60 of file SiPixelRecHitQuality.h.
Referenced by Packing().
Definition at line 33 of file SiPixelRecHitQuality.h.
Referenced by Packing(), and setProbabilityXY().
Definition at line 30 of file SiPixelRecHitQuality.h.
Referenced by Packing(), probabilityXY(), and setProbabilityXY().
Definition at line 31 of file SiPixelRecHitQuality.h.
Referenced by Packing(), probabilityXY(), and setProbabilityXY().
Definition at line 32 of file SiPixelRecHitQuality.h.
Referenced by Packing(), and probabilityXY().
Definition at line 34 of file SiPixelRecHitQuality.h.
Referenced by Packing().
Definition at line 39 of file SiPixelRecHitQuality.h.
Referenced by Packing(), and setProbabilityQ().
Definition at line 36 of file SiPixelRecHitQuality.h.
Referenced by Packing(), probabilityQ(), and setProbabilityQ().
Definition at line 37 of file SiPixelRecHitQuality.h.
Referenced by Packing(), probabilityQ(), and setProbabilityQ().
Definition at line 38 of file SiPixelRecHitQuality.h.
Referenced by Packing(), and probabilityQ().
Definition at line 40 of file SiPixelRecHitQuality.h.
Referenced by Packing().
Definition at line 42 of file SiPixelRecHitQuality.h.
Definition at line 43 of file SiPixelRecHitQuality.h.
Definition at line 44 of file SiPixelRecHitQuality.h.
Referenced by Packing().
Definition at line 62 of file SiPixelRecHitQuality.h.
Referenced by Packing().
Definition at line 54 of file SiPixelRecHitQuality.h.
Referenced by Packing(), setSpansTwoROCs(), and spansTwoROCs().
Definition at line 55 of file SiPixelRecHitQuality.h.
Referenced by Packing(), setSpansTwoROCs(), and spansTwoROCs().
Definition at line 56 of file SiPixelRecHitQuality.h.
Referenced by Packing().