00001 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitQuality.h" 00002 00003 #include <iostream> 00004 00005 SiPixelRecHitQuality::Packing::Packing() 00006 { 00007 // Constructor: pre-computes masks and shifts from field widths 00008 // Order of fields (from right to left) is 00009 // noise, pedestal, gain, status count. 00010 probX_width = 8; 00011 probY_width = 8; 00012 cotAlpha_width = 4; 00013 cotBeta_width = 4; 00014 qBin_width = 3; 00015 edge_width = 1; 00016 bad_width = 1; 00017 twoROC_width = 1; 00018 spare_width = 2; 00019 00020 if ( probX_width + probY_width + cotAlpha_width + cotBeta_width + 00021 qBin_width + edge_width + bad_width + twoROC_width + 00022 spare_width 00023 != 32 ) { 00024 std::cout << std::endl << "Error in SiPixelRecHitQuality::Packing constructor:" 00025 << "sum of field widths != 32" << std::endl; 00026 // &&& throw an exception? 00027 } 00028 00029 probX_units = 0.0625; 00030 probY_units = 0.0625; 00031 cotAlpha_units = 1.0/16; 00032 cotBeta_units = 1.0/16; 00033 00034 00035 // Fields are counted from right to left! 00036 probX_shift = 0; 00037 probY_shift = probX_shift + probX_width; 00038 cotAlpha_shift = probY_shift + probY_width; 00039 cotBeta_shift = cotAlpha_shift + cotAlpha_width; 00040 qBin_shift = cotBeta_shift + cotBeta_width; 00041 edge_shift = qBin_shift + qBin_width; 00042 bad_shift = edge_shift + edge_width; 00043 twoROC_shift = bad_shift + bad_width; 00044 00045 // Ensure the complement of the correct 00046 // number of bits: 00047 QualWordType zero32 = 0; // 32-bit wide set of 0's 00048 00049 probX_mask = ~(~zero32 << probX_width); 00050 probY_mask = ~(~zero32 << probY_width); 00051 cotAlpha_mask = ~(~zero32 << cotAlpha_width); 00052 cotBeta_mask = ~(~zero32 << cotBeta_width); 00053 qBin_mask = ~(~zero32 << qBin_width); 00054 edge_mask = ~(~zero32 << edge_width); 00055 bad_mask = ~(~zero32 << bad_width); 00056 twoROC_mask = ~(~zero32 << twoROC_width); 00057 } 00058 00059 // Initialize the packing format singleton 00060 SiPixelRecHitQuality::Packing SiPixelRecHitQuality::thePacking; 00061 00062