CMS 3D CMS Logo

CTPPSPixelDigi.h
Go to the documentation of this file.
1 #ifndef CTPPS_CTPPSDigi_CTPPSPixelDigi_h
2 #define CTPPS_CTPPSDigi_CTPPSPixelDigi_h
3 
9 
11 public:
12  CTPPSPixelDigi(int packed_value) : theData(packed_value) {}
13 
14  CTPPSPixelDigi(int row, int col, int adc) { init(row, col, adc); }
15 
16  CTPPSPixelDigi(int chan, int adc) {
17  std::pair<int, int> rc = channelToPixel(chan);
18  init(rc.first, rc.second, adc);
19  }
20 
22 
24  int row() const { return (theData >> row_shift) & row_mask; }
25  int column() const { return (theData >> column_shift) & column_mask; }
26  unsigned short adc() const { return (theData >> adc_shift) & adc_mask; }
27  uint32_t packedData() const { return theData; }
28 
29  static std::pair<int, int> channelToPixel(int ch) {
30  int row = (ch >> column_width_ch) & row_mask_ch;
31  int col = ch & column_mask_ch;
32  return std::pair<int, int>(row, col);
33  }
34 
35  static int pixelToChannel(int row, int col) { return (row << column_width_ch) | col; }
36 
37  int channel() const { return pixelToChannel(row(), column()); }
38 
40  static const uint32_t row_shift, column_shift, adc_shift;
41  static const uint32_t row_mask, column_mask, adc_mask, rowcol_mask;
42  static const uint32_t row_width, column_width, adc_width;
43  static const uint32_t max_row, max_column, max_adc;
44 
46  static const uint32_t column_width_ch;
47  static const uint32_t column_mask_ch;
48  static const uint32_t row_mask_ch;
49 
50 private:
51  void init(int row, int col, int adc);
52  uint32_t theData;
53 };
54 
56 
57 inline bool operator<(const CTPPSPixelDigi& one, const CTPPSPixelDigi& other) {
58  return (one.packedData() & CTPPSPixelDigi::rowcol_mask) < (other.packedData() & CTPPSPixelDigi::rowcol_mask);
59 }
60 
61 #include <iostream>
62 inline std::ostream& operator<<(std::ostream& o, const CTPPSPixelDigi& digi) {
63  return o << " " << digi.row() << " " << digi.column() << " " << digi.adc();
64 }
65 
66 #endif
static const uint32_t row_mask_ch
std::ostream & operator<<(std::ostream &o, const CTPPSPixelDigi &digi)
static const uint32_t column_width
static const uint32_t rowcol_mask
static const uint32_t adc_mask
CTPPSPixelDigi(int row, int col, int adc)
int channel() const
static const uint32_t column_width_ch
const values for channel definition with bit structure: row_bits+col_bits
static std::pair< int, int > channelToPixel(int ch)
static const uint32_t column_mask_ch
void init(int row, int col, int adc)
CTPPSPixelDigi(int chan, int adc)
static const uint32_t adc_shift
CTPPSPixelDigi(int packed_value)
static const uint32_t row_mask
static const uint32_t row_shift
const values for digi packing with bit structure: adc_bits+col_bits+row_bits
static const uint32_t adc_width
unsigned short adc() const
uint32_t theData
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
uint32_t packedData() const
static int pixelToChannel(int row, int col)
col
Definition: cuy.py:1009
int row() const
Access to digi information.
static const uint32_t max_row
static const uint32_t column_shift
int column() const
static const uint32_t max_column
static const uint32_t row_width
bool operator<(const CTPPSPixelDigi &one, const CTPPSPixelDigi &other)
Comparison operator.
static const uint32_t column_mask
static const uint32_t max_adc