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 
13 
14  CTPPSPixelDigi( int packed_value) : theData(packed_value) {}
15 
16  CTPPSPixelDigi( int row, int col, int adc) {
17  init( row, col, adc);
18  }
19 
20  CTPPSPixelDigi( int chan, int adc) {
21  std::pair<int,int> rc = channelToPixel(chan);
22  init( rc.first, rc.second, adc);
23  }
24 
26 
28  int row() const {return (theData >> row_shift) & row_mask;}
29  int column() const {return (theData >> column_shift) & column_mask;}
30  unsigned short adc() const {return (theData >> adc_shift) & adc_mask;}
31  uint32_t packedData() const {return theData;}
32 
33  static std::pair<int,int> channelToPixel( int ch) {
34  int row = ( ch >> column_width_ch) & row_mask_ch;
35  int col = ch & column_mask_ch;
36  return std::pair<int,int>(row,col);
37  }
38 
39  static int pixelToChannel( int row, int col) {
40  return (row << column_width_ch) | col;
41  }
42 
43  int channel() const {return pixelToChannel( row(), column());}
44 
46  static const uint32_t row_shift, column_shift, adc_shift;
47  static const uint32_t row_mask, column_mask, adc_mask, rowcol_mask;
48  static const uint32_t row_width, column_width, adc_width;
49  static const uint32_t max_row, max_column, max_adc;
50 
52  static const uint32_t column_width_ch;
53  static const uint32_t column_mask_ch;
54  static const uint32_t row_mask_ch;
55 
56  private:
57 
58  void init( int row, int col, int adc) ;
59  uint32_t theData;
60 };
61 
63 
64 inline bool operator<( const CTPPSPixelDigi& one, const CTPPSPixelDigi& other) {
66 }
67 
68 #include<iostream>
69 inline std::ostream & operator<<(std::ostream & o, const CTPPSPixelDigi& digi) {
70  return o << " " << digi.row() << " " << digi.column()
71  << " " << digi.adc();
72 }
73 
74 #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)
static const uint32_t column_width_ch
const values for channel definition with bit structure: row_bits+col_bits
static const uint32_t column_mask_ch
int channel() const
void init(int row, int col, int adc)
int row() const
Access to digi information.
static std::pair< int, int > channelToPixel(int ch)
CTPPSPixelDigi(int chan, int adc)
int column() const
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
uint32_t packedData() const
uint32_t theData
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
static int pixelToChannel(int row, int col)
col
Definition: cuy.py:1008
static const uint32_t max_row
static const uint32_t column_shift
unsigned short adc() 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