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 
24 private:
25  MTDChannelIdentifier(unsigned int row_w, unsigned int column_w, unsigned int time_w, unsigned int adc_w)
26  : row_width(row_w),
27  column_width(column_w),
28  adc_width(adc_w),
29  row_shift(0),
30  column_shift(row_shift + row_w),
31  time_shift(column_shift + column_w),
32  adc_shift(time_shift + time_w),
33  row_mask(~(~0U << row_w)),
34  column_mask(~(~0U << column_w)),
35  time_mask(~(~0U << time_w)),
36  adc_mask(~(~0U << adc_w)),
37  rowcol_mask(~(~0U << (column_w + row_w))),
40  max_adc(adc_mask) {}
41 
42  ~MTDChannelIdentifier() = default;
43 
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::max_row
const int max_row
Definition: MTDChannelIdentifier.h:64
MTDChannelIdentifier::MTDChannelIdentifier
MTDChannelIdentifier(unsigned int row_w, unsigned int column_w, unsigned int time_w, unsigned int adc_w)
Definition: MTDChannelIdentifier.h:25
MTDChannelIdentifier
Definition: MTDChannelIdentifier.h:6
MTDChannelIdentifier::column_shift
const int column_shift
Definition: MTDChannelIdentifier.h:54
MTDChannelIdentifier::time_shift
const int time_shift
Definition: MTDChannelIdentifier.h:55
cuy.col
col
Definition: cuy.py:1009
MTDChannelIdentifier::row_mask
const PackedDigiType row_mask
Definition: MTDChannelIdentifier.h:58
MTDChannelIdentifier::time_mask
const PackedDigiType time_mask
Definition: MTDChannelIdentifier.h:60
MTDChannelIdentifier::ChannelType
unsigned int ChannelType
Definition: MTDChannelIdentifier.h:14
MTDChannelIdentifier::adc_mask
const PackedDigiType adc_mask
Definition: MTDChannelIdentifier.h:61
MTDChannelIdentifier::column_width
const int column_width
Definition: MTDChannelIdentifier.h:50
MTDChannelIdentifier::pixelToChannel
static int pixelToChannel(int row, int col)
Definition: MTDChannelIdentifier.h:22
MTDChannelIdentifier::adc_width
const int adc_width
Definition: MTDChannelIdentifier.h:51
MTDChannelIdentifier::row_shift
const int row_shift
Definition: MTDChannelIdentifier.h:53
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
MTDChannelIdentifier::GetInstance
static const MTDChannelIdentifier & GetInstance()
Definition: MTDChannelIdentifier.h:8
MTDChannelIdentifier::rowcol_mask
const PackedDigiType rowcol_mask
Definition: MTDChannelIdentifier.h:62
MTDChannelIdentifier::~MTDChannelIdentifier
~MTDChannelIdentifier()=default
MTDChannelIdentifier::adc_shift
const int adc_shift
Definition: MTDChannelIdentifier.h:56
MTDChannelIdentifier::row_width
const int row_width
Definition: MTDChannelIdentifier.h:49
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
MTDChannelIdentifier::operator=
MTDChannelIdentifier & operator=(const MTDChannelIdentifier &)=delete
MTDChannelIdentifier::max_adc
const int max_adc
Definition: MTDChannelIdentifier.h:66
MTDChannelIdentifier::PackedDigiType
unsigned int PackedDigiType
Definition: MTDChannelIdentifier.h:13
MTDChannelIdentifier::max_column
const int max_column
Definition: MTDChannelIdentifier.h:65
MTDChannelIdentifier::channelToPixel
static std::pair< int, int > channelToPixel(int ch)
Definition: MTDChannelIdentifier.h:16
MTDChannelIdentifier::column_mask
const PackedDigiType column_mask
Definition: MTDChannelIdentifier.h:59