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>
6 
7 
9 
10  public:
11 
13  static const MTDChannelIdentifier instance(6, 5, 12, 9);
14  return instance;
15  }
16 
17  typedef unsigned int PackedDigiType;
18  typedef unsigned int ChannelType;
19 
20  static std::pair<int,int> channelToPixel( int ch) {
21  int row = ( ch >> GetInstance().column_width) & GetInstance().row_mask;
22  int col = ch & GetInstance().column_mask;
23  return std::pair<int,int>(row,col);
24  }
25 
26  static int pixelToChannel( int row, int col) {
27  return (row << GetInstance().column_width) | col;
28  }
29 
30 
31  private:
32 
33  MTDChannelIdentifier(unsigned int row_w, unsigned int column_w,
34  unsigned int time_w, unsigned int adc_w) :
35  row_width(row_w), column_width(column_w), adc_width(adc_w)
36  ,row_shift(0)
37  ,column_shift(row_shift + row_w)
38  ,time_shift(column_shift + column_w)
39  ,adc_shift(time_shift + time_w)
40  ,row_mask(~(~0U << row_w))
41  ,column_mask( ~(~0U << column_w))
42  ,time_mask(~(~0U << time_w))
43  ,adc_mask(~(~0U << adc_w))
44  ,rowcol_mask(~(~0U << (column_w+row_w)))
47  ,max_adc(adc_mask){}
48 
49  ~MTDChannelIdentifier() = default;
50 
55 
56  const int row_width;
57  const int column_width;
58  const int adc_width;
59 
60  const int row_shift;
61  const int column_shift;
62  const int time_shift;
63  const int adc_shift;
64 
65  const PackedDigiType row_mask;
66  const PackedDigiType column_mask;
67  const PackedDigiType time_mask;
68  const PackedDigiType adc_mask;
69  const PackedDigiType rowcol_mask;
70 
71  const int max_row;
72  const int max_column;
73  const int max_adc;
74 
75 };
76 
77 #endif
MTDChannelIdentifier & operator=(const MTDChannelIdentifier &)=delete
static PFTauRenderPlugin instance
MTDChannelIdentifier(unsigned int row_w, unsigned int column_w, unsigned int time_w, unsigned int adc_w)
const PackedDigiType time_mask
~MTDChannelIdentifier()=default
static std::pair< int, int > channelToPixel(int ch)
const PackedDigiType column_mask
static int pixelToChannel(int row, int col)
const PackedDigiType adc_mask
const PackedDigiType row_mask
const PackedDigiType rowcol_mask
col
Definition: cuy.py:1010
static const MTDChannelIdentifier & GetInstance()