00001 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitQuality.h" 00002 00003 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00004 00005 SiPixelRecHitQuality::Packing::Packing() 00006 { 00007 // Constructor: pre-computes masks and shifts from field widths 00008 // X is now XY 00009 // Y is now Q 00010 probX_width = 14; 00011 probY_width = 8; 00012 qBin_width = 3; 00013 edge_width = 1; 00014 bad_width = 1; 00015 twoROC_width = 1; 00016 hasFilledProb_width = 1; 00017 spare_width = 3; 00018 00019 if ( probX_width + probY_width + qBin_width + edge_width + 00020 bad_width + twoROC_width + hasFilledProb_width + spare_width 00021 != 32 ) { 00022 throw cms::Exception("SiPixelRecHitQuality::Packing: ") 00023 << "\nERROR: The allocated bits for the quality word to not sum to 32." 00024 << "\n\n"; 00025 } 00026 00027 probX_units = 1.0018; 00028 probY_units = 1.0461; 00029 probX_1_over_log_units = 1.0 / log( probX_units ); 00030 probY_1_over_log_units = 1.0 / log( probY_units ); 00031 00032 // Fields are counted from right to left! 00033 probX_shift = 0; 00034 probY_shift = probX_shift + probX_width; 00035 qBin_shift = probY_shift + probY_width; 00036 edge_shift = qBin_shift + qBin_width; 00037 bad_shift = edge_shift + edge_width; 00038 twoROC_shift = bad_shift + bad_width; 00039 hasFilledProb_shift = twoROC_shift + twoROC_width; 00040 00041 // Ensure the complement of the correct 00042 // number of bits: 00043 QualWordType zero32 = 0; // 32-bit wide set of 0's 00044 00045 probX_mask = ~(~zero32 << probX_width); 00046 probY_mask = ~(~zero32 << probY_width); 00047 qBin_mask = ~(~zero32 << qBin_width); 00048 edge_mask = ~(~zero32 << edge_width); 00049 bad_mask = ~(~zero32 << bad_width); 00050 twoROC_mask = ~(~zero32 << twoROC_width); 00051 hasFilledProb_mask = ~(~zero32 << hasFilledProb_width); 00052 } 00053 00054 // Initialize the packing format singleton 00055 SiPixelRecHitQuality::Packing SiPixelRecHitQuality::thePacking; 00056