CMS 3D CMS Logo

SiPixelDigiConstants.h
Go to the documentation of this file.
1 #ifndef DataFormats_SiPixelDigi_interface_SiPixelDigiConstants
2 #define DataFormats_SiPixelDigi_interface_SiPixelDigiConstants
3 
5 #include <cstdint>
6 
9 
10 namespace sipixelconstants {
11  constexpr cms_uint32_t dummyDetId = 0xffffffff;
12 
13  constexpr uint32_t CRC_bits = 1;
14  constexpr uint32_t DCOL_bits = 5; // double column
15  constexpr uint32_t PXID_bits = 8; // pixel id
16  constexpr uint32_t ADC_bits = 8;
17  constexpr uint32_t OMIT_ERR_bits = 1;
18  // GO BACK TO OLD VALUES. THE 48-CHAN FED DOES NOT NEED A NEW FORMAT 28/9/16 d.k.
19  constexpr uint32_t LINK_bits = 6; // 7;
20  constexpr uint32_t ROC_bits = 5; // 4;
21 
22  constexpr uint32_t CRC_shift = 2;
23  constexpr uint32_t ADC_shift = 0;
24  constexpr uint32_t PXID_shift = ADC_shift + ADC_bits;
25  constexpr uint32_t DCOL_shift = PXID_shift + PXID_bits;
26  constexpr uint32_t ROC_shift = DCOL_shift + DCOL_bits;
27  constexpr uint32_t LINK_shift = ROC_shift + ROC_bits;
28  constexpr uint32_t OMIT_ERR_shift = 20;
29 
30  constexpr uint64_t CRC_mask = ~(~Word64(0) << CRC_bits);
31  constexpr uint32_t ERROR_mask = ~(~Word32(0) << ROC_bits);
32  constexpr uint32_t LINK_mask = ~(~Word32(0) << LINK_bits);
33  constexpr uint32_t ROC_mask = ~(~Word32(0) << ROC_bits);
34  constexpr uint32_t OMIT_ERR_mask = ~(~Word32(0) << OMIT_ERR_bits);
35  constexpr uint32_t DCOL_mask = ~(~Word32(0) << DCOL_bits);
36  constexpr uint32_t PXID_mask = ~(~Word32(0) << PXID_bits);
37  constexpr uint32_t ADC_mask = ~(~Word32(0) << ADC_bits);
38 
39  // Special for layer 1 bpix rocs 6/9/16 d.k. THIS STAYS.
40  inline namespace phase1layer1 {
41  constexpr uint32_t COL_bits1_l1 = 6;
42  constexpr uint32_t ROW_bits1_l1 = 7;
43  constexpr uint32_t ROW_shift = ADC_shift + ADC_bits;
44  constexpr uint32_t COL_shift = ROW_shift + ROW_bits1_l1;
45  constexpr uint32_t COL_mask = ~(~Word32(0) << COL_bits1_l1);
46  constexpr uint32_t ROW_mask = ~(~Word32(0) << ROW_bits1_l1);
47  } // namespace phase1layer1
48 
49  // constexpr functions are available in device code (GPU) as well
50  inline namespace functions {
51  inline constexpr uint32_t getLink(uint32_t ww) { return ((ww >> LINK_shift) & LINK_mask); }
52  inline constexpr uint32_t getROC(uint32_t ww) { return ((ww >> ROC_shift) & ROC_mask); }
53  inline constexpr uint32_t getADC(uint32_t ww) { return ((ww >> ADC_shift) & ADC_mask); }
54  inline constexpr uint32_t getCol(uint32_t ww) { return ((ww >> COL_shift) & COL_mask); }
55  inline constexpr uint32_t getRow(uint32_t ww) { return ((ww >> ROW_shift) & ROW_mask); }
56  inline constexpr uint32_t getDCol(uint32_t ww) { return ((ww >> DCOL_shift) & DCOL_mask); }
57  inline constexpr uint32_t getPxId(uint32_t ww) { return ((ww >> PXID_shift) & PXID_mask); }
58  inline constexpr uint32_t removeADC(uint32_t ww) { return (ww & ~(ADC_mask << ADC_shift)); }
59  } // namespace functions
60 } // namespace sipixelconstants
61 
62 #endif // DataFormats_SiPixelDigi_interface_SiPixelDigiConstants
constexpr uint32_t getRow(uint32_t ww)
constexpr cms_uint32_t dummyDetId
constexpr uint32_t ROC_bits
constexpr uint32_t DCOL_shift
constexpr uint32_t PXID_shift
constexpr uint32_t getCol(uint32_t ww)
constexpr uint32_t PXID_bits
constexpr uint32_t ADC_bits
constexpr uint32_t ROC_shift
constexpr uint32_t ADC_shift
constexpr uint32_t OMIT_ERR_bits
constexpr uint32_t ERROR_mask
constexpr uint32_t DCOL_mask
constexpr uint32_t getPxId(uint32_t ww)
constexpr uint64_t CRC_mask
constexpr uint32_t DCOL_bits
constexpr uint32_t getDCol(uint32_t ww)
constexpr uint32_t OMIT_ERR_shift
cms_uint32_t Word32
constexpr uint32_t getADC(uint32_t ww)
constexpr uint32_t getLink(uint32_t ww)
constexpr uint32_t LINK_bits
unsigned int cms_uint32_t
Definition: typedefs.h:15
constexpr uint32_t getROC(uint32_t ww)
constexpr uint32_t LINK_shift
constexpr uint32_t CRC_shift
unsigned long long uint64_t
Definition: Time.h:13
constexpr uint32_t LINK_mask
constexpr uint32_t PXID_mask
constexpr uint32_t CRC_bits
constexpr uint32_t OMIT_ERR_mask
unsigned long long cms_uint64_t
Definition: typedefs.h:17
constexpr uint32_t ADC_mask
constexpr uint32_t ROC_mask
constexpr uint32_t removeADC(uint32_t ww)
cms_uint64_t Word64