CMS 3D CMS Logo

MTDChannelIdentifier.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_MTDCHANNELIDENTIFIER_H
2 #define DATAFORMATS_MTDCHANNELIDENTIFIER_H
3 
4 #include <utility>
5 
7 public:
8  static const MTDChannelIdentifier& GetInstance() {
9  static const MTDChannelIdentifier instance(6, 5, 12, 9);
10  return instance;
11  }
12 
13  typedef unsigned int PackedDigiType;
14  typedef unsigned int ChannelType;
15 
16  static std::pair<int, int> channelToPixel(int ch) {
17  int row = (ch >> GetInstance().column_width) & GetInstance().row_mask;
18  int col = ch & GetInstance().column_mask;
19  return std::pair<int, int>(row, col);
20  }
21 
22  static int pixelToChannel(int row, int col) { return (row << GetInstance().column_width) | col; }
23 
28 
29 private:
30  MTDChannelIdentifier(unsigned int row_w, unsigned int column_w, unsigned int time_w, unsigned int adc_w)
31  : row_width(row_w),
32  column_width(column_w),
33  adc_width(adc_w),
34  row_shift(0),
35  column_shift(row_shift + row_w),
36  time_shift(column_shift + column_w),
37  adc_shift(time_shift + time_w),
38  row_mask(~(~0U << row_w)),
39  column_mask(~(~0U << column_w)),
40  time_mask(~(~0U << time_w)),
41  adc_mask(~(~0U << adc_w)),
42  rowcol_mask(~(~0U << (column_w + row_w))),
45  max_adc(adc_mask) {}
46 
47  ~MTDChannelIdentifier() = default;
48 
49  const int row_width;
50  const int column_width;
51  const int adc_width;
52 
53  const int row_shift;
54  const int column_shift;
55  const int time_shift;
56  const int adc_shift;
57 
63 
64  const int max_row;
65  const int max_column;
66  const int max_adc;
67 };
68 
69 #endif
MTDChannelIdentifier & operator=(const MTDChannelIdentifier &)=delete
static PFTauRenderPlugin instance
static std::pair< int, int > channelToPixel(int ch)
MTDChannelIdentifier(unsigned int row_w, unsigned int column_w, unsigned int time_w, unsigned int adc_w)
const PackedDigiType time_mask
~MTDChannelIdentifier()=default
const PackedDigiType column_mask
static int pixelToChannel(int row, int col)
const PackedDigiType adc_mask
MTDChannelIdentifier(const MTDChannelIdentifier &)=delete
const PackedDigiType row_mask
const PackedDigiType rowcol_mask
col
Definition: cuy.py:1009
static const MTDChannelIdentifier & GetInstance()