Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-30 10:17:10

0001 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitQuality.h"
0002 
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 
0005 SiPixelRecHitQuality::Packing::Packing() {
0006   // Constructor: pre-computes masks and shifts from field widths
0007   // X is now XY
0008   // Y is now Q
0009   probX_width = 14;
0010   probY_width = 8;
0011   qBin_width = 3;
0012   edge_width = 1;
0013   bad_width = 1;
0014   twoROC_width = 1;
0015   hasFilledProb_width = 1;
0016   spare_width = 3;
0017 
0018   if (probX_width + probY_width + qBin_width + edge_width + bad_width + twoROC_width + hasFilledProb_width +
0019           spare_width !=
0020       32) {
0021     throw cms::Exception("SiPixelRecHitQuality::Packing: ")
0022         << "\nERROR: The allocated bits for the quality word to not sum to 32."
0023         << "\n\n";
0024   }
0025 
0026   probX_units = 1.0018;
0027   probY_units = 1.0461;
0028   probX_1_over_log_units = 1.0 / log(probX_units);
0029   probY_1_over_log_units = 1.0 / log(probY_units);
0030 
0031   // Fields are counted from right to left!
0032   probX_shift = 0;
0033   probY_shift = probX_shift + probX_width;
0034   qBin_shift = probY_shift + probY_width;
0035   edge_shift = qBin_shift + qBin_width;
0036   bad_shift = edge_shift + edge_width;
0037   twoROC_shift = bad_shift + bad_width;
0038   hasFilledProb_shift = twoROC_shift + twoROC_width;
0039 
0040   // Ensure the complement of the correct
0041   // number of bits:
0042   QualWordType zero32 = 0;  // 32-bit wide set of 0's
0043 
0044   probX_mask = ~(~zero32 << probX_width);
0045   probY_mask = ~(~zero32 << probY_width);
0046   qBin_mask = ~(~zero32 << qBin_width);
0047   edge_mask = ~(~zero32 << edge_width);
0048   bad_mask = ~(~zero32 << bad_width);
0049   twoROC_mask = ~(~zero32 << twoROC_width);
0050   hasFilledProb_mask = ~(~zero32 << hasFilledProb_width);
0051 }
0052 
0053 //  Initialize the packing format singleton
0054 const SiPixelRecHitQuality::Packing SiPixelRecHitQuality::thePacking;
0055 
0056 void SiPixelRecHitQuality::warningObsolete() {
0057   edm::LogWarning("ObsoleteVariable")
0058       << "Since 39x, probabilityX and probabilityY have been replaced by probabilityXY and probabilityQ";
0059 }
0060 
0061 void SiPixelRecHitQuality::warningOutOfBoundQbin(int iValue, QualWordType const& iQualWord) {
0062   edm::LogWarning("OutOfBounds") << "Qbin outside the bounds of the quality word: Qbin = " << iValue
0063                                  << " and QualityWord = " << iQualWord << " --> Now defaulting to Qbin = 0.0";
0064 }
0065 
0066 void SiPixelRecHitQuality::warningOutOfBoundProb(const char* iName, float iProb, QualWordType const& iQualWord) {
0067   edm::LogWarning("OutOfBounds") << "Prob" << iName << " outside the bounds of the quality word: Prob" << iName
0068                                  << " = 1+" << iProb - 1 << " and QualityWord = " << iQualWord
0069                                  << " --> Now defaulting to Prob" << iName << " = 0.0";
0070 }
0071 
0072 void SiPixelRecHitQuality::warningOutOfBoundRaw(const char* iName, int iRaw, QualWordType const& iQualWord) {
0073   edm::LogWarning("OutOfBounds") << "Probability" << iName << " outside the bounds of the quality word: Raw = " << iRaw
0074                                  << " and QualityWord = " << iQualWord << " --> Now defaulting to Prob" << iName
0075                                  << " = 0.0";
0076 }