CMS 3D CMS Logo

Phase2TrackerDigi.h
Go to the documentation of this file.
1 #ifndef DataFormats_Phase2TrackerDigi_Phase2TrackerDigi_H
2 #define DataFormats_Phase2TrackerDigi_Phase2TrackerDigi_H
3 
4 #include <cstdint>
5 #include <utility>
6 #include <cassert>
7 
13 public:
14  typedef uint16_t PackedDigiType;
15 
16  Phase2TrackerDigi(unsigned int packed_channel) : theChannel(packed_channel) {}
17 
18  Phase2TrackerDigi(unsigned int row, unsigned int col) { theChannel = pixelToChannel(row, col); }
19 
20  Phase2TrackerDigi(unsigned int row, unsigned int col, bool ot_flag) {
22  if (ot_flag)
23  theChannel |= (1 << 15);
24  }
25 
27 
28  // Access to digi information - pixel sensors
29  unsigned int row() const { return channelToRow(theChannel); }
30  unsigned int column() const { return channelToColumn(theChannel); }
31  // Access to digi information - strip sensors
32  unsigned int strip() const { return row(); }
33  unsigned int edge() const { return column(); } // CD: any better name for that?
34  // Access to the (raw) channel number
35  unsigned int channel() const { return 0x7FFF & theChannel; }
36  // Access Overthreshold bit
37  bool overThreshold() const { return (otBit(theChannel) ? true : false); }
38 
39  static std::pair<unsigned int, unsigned int> channelToPixel(unsigned int ch) {
40  return std::pair<unsigned int, unsigned int>(channelToRow(ch), channelToColumn(ch));
41  }
42 
43  static PackedDigiType pixelToChannel(unsigned int row, unsigned int col) {
44  assert(row < 1016);
45  assert(col < 32);
46  return row | (col << 10);
47  }
48 
49 private:
51  static unsigned int channelToRow(unsigned int ch) { return ch & 0x03FF; }
52  static unsigned int channelToColumn(unsigned int ch) { return ((ch >> 10) & 0x1F); }
53  static unsigned int otBit(unsigned int ch) { return ((ch >> 15) & 0x1); }
54 };
55 
56 // Comparison operators
57 inline bool operator<(const Phase2TrackerDigi& one, const Phase2TrackerDigi& other) {
58  return one.channel() < other.channel();
59 }
60 
61 // distance operators
63  return int(one.channel()) - int(other.channel());
64 }
65 
66 #include <iostream>
67 inline std::ostream& operator<<(std::ostream& o, const Phase2TrackerDigi& digi) { return o << " " << digi.channel(); }
68 
69 #endif // DataFormats_Phase2TrackerDigi_Phase2TrackerDigi_H
Phase2TrackerDigi::Phase2TrackerDigi
Phase2TrackerDigi(unsigned int row, unsigned int col)
Definition: Phase2TrackerDigi.h:18
Phase2TrackerDigi::row
unsigned int row() const
Definition: Phase2TrackerDigi.h:29
operator<<
std::ostream & operator<<(std::ostream &o, const Phase2TrackerDigi &digi)
Definition: Phase2TrackerDigi.h:67
SiPixelPI::one
Definition: SiPixelPayloadInspectorHelper.h:39
Phase2TrackerDigi::edge
unsigned int edge() const
Definition: Phase2TrackerDigi.h:33
cuy.col
col
Definition: cuy.py:1009
Phase2TrackerDigi::Phase2TrackerDigi
Phase2TrackerDigi(unsigned int packed_channel)
Definition: Phase2TrackerDigi.h:16
cms::cuda::assert
assert(be >=bs)
Phase2TrackerDigi::Phase2TrackerDigi
Phase2TrackerDigi(unsigned int row, unsigned int col, bool ot_flag)
Definition: Phase2TrackerDigi.h:20
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
Phase2TrackerDigi::column
unsigned int column() const
Definition: Phase2TrackerDigi.h:30
Phase2TrackerDigi::pixelToChannel
static PackedDigiType pixelToChannel(unsigned int row, unsigned int col)
Definition: Phase2TrackerDigi.h:43
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
trackingPlots.other
other
Definition: trackingPlots.py:1464
Phase2TrackerDigi::channelToRow
static unsigned int channelToRow(unsigned int ch)
Definition: Phase2TrackerDigi.h:51
operator<
bool operator<(const Phase2TrackerDigi &one, const Phase2TrackerDigi &other)
Definition: Phase2TrackerDigi.h:57
createfilelist.int
int
Definition: createfilelist.py:10
Phase2TrackerDigi::channelToPixel
static std::pair< unsigned int, unsigned int > channelToPixel(unsigned int ch)
Definition: Phase2TrackerDigi.h:39
operator-
int operator-(const Phase2TrackerDigi &one, const Phase2TrackerDigi &other)
Definition: Phase2TrackerDigi.h:62
Phase2TrackerDigi::theChannel
PackedDigiType theChannel
Definition: Phase2TrackerDigi.h:50
Phase2TrackerDigi::otBit
static unsigned int otBit(unsigned int ch)
Definition: Phase2TrackerDigi.h:53
Phase2TrackerDigi::PackedDigiType
uint16_t PackedDigiType
Definition: Phase2TrackerDigi.h:14
Phase2TrackerDigi
Definition: Phase2TrackerDigi.h:12
Phase2TrackerDigi::channel
unsigned int channel() const
Definition: Phase2TrackerDigi.h:35
Phase2TrackerDigi::Phase2TrackerDigi
Phase2TrackerDigi()
Definition: Phase2TrackerDigi.h:26
Phase2TrackerDigi::channelToColumn
static unsigned int channelToColumn(unsigned int ch)
Definition: Phase2TrackerDigi.h:52
Phase2TrackerDigi::strip
unsigned int strip() const
Definition: Phase2TrackerDigi.h:32
Phase2TrackerDigi::overThreshold
bool overThreshold() const
Definition: Phase2TrackerDigi.h:37