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
SiPixelPI::one
Definition: SiPixelPayloadInspectorHelper.h:39
CTPPSPixelDigi::row_mask
static const uint32_t row_mask
Definition: CTPPSPixelDigi.h:41
CTPPSPixelDigi::packedData
uint32_t packedData() const
Definition: CTPPSPixelDigi.h:27
CTPPSPixelDigi::column_shift
static const uint32_t column_shift
Definition: CTPPSPixelDigi.h:40
cuy.col
col
Definition: cuy.py:1009
CTPPSPixelDigi::max_column
static const uint32_t max_column
Definition: CTPPSPixelDigi.h:43
CTPPSPixelDigi::column
int column() const
Definition: CTPPSPixelDigi.h:25
CTPPSPixelDigi::row_shift
static const uint32_t row_shift
const values for digi packing with bit structure: adc_bits+col_bits+row_bits
Definition: CTPPSPixelDigi.h:40
CTPPSPixelDigi::max_adc
static const uint32_t max_adc
Definition: CTPPSPixelDigi.h:43
CTPPSPixelDigi::init
void init(int row, int col, int adc)
Definition: CTPPSPixelDigi.cc:22
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
CTPPSPixelDigi::column_mask
static const uint32_t column_mask
Definition: CTPPSPixelDigi.h:41
CTPPSPixelDigi::max_row
static const uint32_t max_row
Definition: CTPPSPixelDigi.h:43
CTPPSPixelDigi::rowcol_mask
static const uint32_t rowcol_mask
Definition: CTPPSPixelDigi.h:41
CTPPSPixelDigi::row
int row() const
Access to digi information.
Definition: CTPPSPixelDigi.h:24
CTPPSPixelDigi::row_width
static const uint32_t row_width
Definition: CTPPSPixelDigi.h:42
CTPPSPixelDigi::column_mask_ch
static const uint32_t column_mask_ch
Definition: CTPPSPixelDigi.h:47
CTPPSPixelDigi::adc
unsigned short adc() const
Definition: CTPPSPixelDigi.h:26
CTPPSPixelDigi::row_mask_ch
static const uint32_t row_mask_ch
Definition: CTPPSPixelDigi.h:48
CTPPSPixelDigi::CTPPSPixelDigi
CTPPSPixelDigi(int row, int col, int adc)
Definition: CTPPSPixelDigi.h:14
trackingPlots.other
other
Definition: trackingPlots.py:1464
operator<<
std::ostream & operator<<(std::ostream &o, const CTPPSPixelDigi &digi)
Definition: CTPPSPixelDigi.h:62
CTPPSPixelDigi::adc_shift
static const uint32_t adc_shift
Definition: CTPPSPixelDigi.h:40
CTPPSPixelDigi
Definition: CTPPSPixelDigi.h:10
CTPPSPixelDigi::column_width
static const uint32_t column_width
Definition: CTPPSPixelDigi.h:42
CTPPSPixelDigi::adc_width
static const uint32_t adc_width
Definition: CTPPSPixelDigi.h:42
CTPPSPixelDigi::theData
uint32_t theData
Definition: CTPPSPixelDigi.h:52
CTPPSPixelDigi::channelToPixel
static std::pair< int, int > channelToPixel(int ch)
Definition: CTPPSPixelDigi.h:29
CTPPSPixelDigi::CTPPSPixelDigi
CTPPSPixelDigi(int packed_value)
Definition: CTPPSPixelDigi.h:12
CTPPSPixelDigi::CTPPSPixelDigi
CTPPSPixelDigi(int chan, int adc)
Definition: CTPPSPixelDigi.h:16
CTPPSPixelDigi::CTPPSPixelDigi
CTPPSPixelDigi()
Definition: CTPPSPixelDigi.h:21
CTPPSPixelDigi::pixelToChannel
static int pixelToChannel(int row, int col)
Definition: CTPPSPixelDigi.h:35
officialStyle.chan
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
Definition: officialStyle.py:106
CTPPSPixelDigi::channel
int channel() const
Definition: CTPPSPixelDigi.h:37
Exception.h
CTPPSPixelDigi::column_width_ch
static const uint32_t column_width_ch
const values for channel definition with bit structure: row_bits+col_bits
Definition: CTPPSPixelDigi.h:46
operator<
bool operator<(const CTPPSPixelDigi &one, const CTPPSPixelDigi &other)
Comparison operator.
Definition: CTPPSPixelDigi.h:57
CTPPSPixelDigi::adc_mask
static const uint32_t adc_mask
Definition: CTPPSPixelDigi.h:41