CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PixelDigi.h
Go to the documentation of this file.
1 #ifndef TRACKINGOBJECTS_PIXELDIGI_H
2 #define TRACKINGOBJECTS_PIXELDIGI_H
3 
4 // 25/06/06 - get rid of time(), change adc() from int to undigned short. d.k.
5 
6 #include <utility>
7 #include <algorithm>
9 
14 class PixelDigi {
15 public:
16  typedef unsigned int PackedDigiType;
17  typedef unsigned int ChannelType;
18 
19  explicit PixelDigi(PackedDigiType packed_value) : theData(packed_value) {}
20 
21  PixelDigi(int row, int col, int adc) { init(row, col, adc); }
22  PixelDigi(int row, int col, int adc, int flag) { init(row, col, adc, flag); }
23 
24  PixelDigi(int chan, int adc) {
25  std::pair<int, int> rc = channelToPixel(chan);
26  init(rc.first, rc.second, adc);
27  }
28 
29  PixelDigi() : theData(0) {}
30 
31  void init(int row, int col, int adc, int flag = 0) {
32 #ifdef FIXME_DEBUG
33  // This check is for the maximal row or col number that can be packed
34  // in a PixelDigi. The actual number of rows or columns in a detector
35  // may be smaller!
36  // it is done much better in Raw2Digi...
37  if (row < 0 || row > PixelChannelIdentifier::thePacking.max_row || col < 0 ||
38  col > PixelChannelIdentifier::thePacking.max_column) {
39  std::cout << "PixelDigi constructor: row or column out packing range " << row << ' ' << col << std::endl;
40  }
41 #endif
42 
43  // Set adc to max_adc in case of overflow
45  : std::max(adc, 0);
46 
48  (col << PixelChannelIdentifier::thePacking.column_shift) |
51  }
52 
53  // Access to digi information
54  int row() const {
56  }
57  int column() const {
58  return (theData >> PixelChannelIdentifier::thePacking.column_shift) &
60  }
61  int flag() const {
63  }
64  unsigned short adc() const {
66  }
67  PackedDigiType packedData() const { return theData; }
68 
69  static std::pair<int, int> channelToPixel(int ch) {
72  return std::pair<int, int>(row, col);
73  }
74 
75  static int pixelToChannel(int row, int col) { return (row << PixelChannelIdentifier::thePacking.column_width) | col; }
76 
78 
79 private:
81 };
82 
83 // Comparison operators
84 
85 //inline bool operator<( const PixelDigi& one, const PixelDigi& other) {
86 // return one.channel() < other.channel();
87 //}
88 
89 inline bool operator<(const PixelDigi& one, const PixelDigi& other) {
92 }
93 
94 #include <iostream>
95 inline std::ostream& operator<<(std::ostream& o, const PixelDigi& digi) {
96  return o << " " << digi.channel() << " " << digi.adc();
97 }
98 
99 #endif
int row() const
Definition: PixelDigi.h:54
PixelDigi(int chan, int adc)
Definition: PixelDigi.h:24
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:69
tuple chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, &quot;NDC&quot;) lumi.SetBorderSize( 0 ) lumi...
unsigned int ChannelType
Definition: PixelDigi.h:17
PixelDigi(int row, int col, int adc)
Definition: PixelDigi.h:21
PackedDigiType packedData() const
Definition: PixelDigi.h:67
int channel() const
Definition: PixelDigi.h:77
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
PixelDigi(PackedDigiType packed_value)
Definition: PixelDigi.h:19
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:75
PixelDigi(int row, int col, int adc, int flag)
Definition: PixelDigi.h:22
unsigned int PackedDigiType
Definition: PixelDigi.h:16
static constexpr Packing thePacking
unsigned short adc() const
Definition: PixelDigi.h:64
bool operator<(DTCELinkId const &lhs, DTCELinkId const &rhs)
Definition: DTCELinkId.h:70
PixelDigi()
Definition: PixelDigi.h:29
void init(int row, int col, int adc, int flag=0)
Definition: PixelDigi.h:31
int flag() const
Definition: PixelDigi.h:61
static int pixelToChannel(int row, int col)
tuple cout
Definition: gather_cfg.py:144
int column() const
Definition: PixelDigi.h:57
int col
Definition: cuy.py:1009
PackedDigiType theData
Definition: PixelDigi.h:80