CMS 3D CMS Logo

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 
23  PixelDigi(int chan, int adc) {
24  std::pair<int, int> rc = channelToPixel(chan);
25  init(rc.first, rc.second, adc);
26  }
27 
28  PixelDigi() : theData(0) {}
29 
30  void init(int row, int col, int adc) {
31 #ifdef FIXME_DEBUG
32  // This check is for the maximal row or col number that can be packed
33  // in a PixelDigi. The actual number of rows or columns in a detector
34  // may be smaller!
35  // it is done much better in Raw2Digi...
36  if (row < 0 || row > PixelChannelIdentifier::thePacking.max_row || col < 0 ||
37  col > PixelChannelIdentifier::thePacking.max_column) {
38  std::cout << "PixelDigi constructor: row or column out packing range " << row << ' ' << col << std::endl;
39  }
40 #endif
41 
42  // Set adc to max_adc in case of overflow
44  : std::max(adc, 0);
45 
47  (col << PixelChannelIdentifier::thePacking.column_shift) |
49  }
50 
51  // Access to digi information
52  int row() const {
54  }
55  int column() const {
56  return (theData >> PixelChannelIdentifier::thePacking.column_shift) &
58  }
59  //int time() const {return (theData >> PixelChannelIdentifier::thePacking.time_shift) & PixelChannelIdentifier::thePacking.time_mask;}
60  unsigned short adc() const {
62  }
63  PackedDigiType packedData() const { return theData; }
64 
65  static std::pair<int, int> channelToPixel(int ch) {
68  return std::pair<int, int>(row, col);
69  }
70 
71  static int pixelToChannel(int row, int col) { return (row << PixelChannelIdentifier::thePacking.column_width) | col; }
72 
74 
75 private:
76  PackedDigiType theData;
77 };
78 
79 // Comparison operators
80 
81 //inline bool operator<( const PixelDigi& one, const PixelDigi& other) {
82 // return one.channel() < other.channel();
83 //}
84 
85 inline bool operator<(const PixelDigi& one, const PixelDigi& other) {
88 }
89 
90 #include <iostream>
91 inline std::ostream& operator<<(std::ostream& o, const PixelDigi& digi) {
92  return o << " " << digi.channel() << " " << digi.adc();
93 }
94 
95 #endif
int row() const
Definition: PixelDigi.h:52
PixelDigi(int chan, int adc)
Definition: PixelDigi.h:23
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:65
unsigned int ChannelType
Definition: PixelDigi.h:17
PixelDigi(int row, int col, int adc)
Definition: PixelDigi.h:21
PackedDigiType packedData() const
Definition: PixelDigi.h:63
int channel() const
Definition: PixelDigi.h:73
static const Packing thePacking
PixelDigi(PackedDigiType packed_value)
Definition: PixelDigi.h:19
static int pixelToChannel(int row, int col)
Definition: PixelDigi.h:71
bool operator<(const PixelDigi &one, const PixelDigi &other)
Definition: PixelDigi.h:85
unsigned int PackedDigiType
Definition: PixelDigi.h:16
void init(int row, int col, int adc)
Definition: PixelDigi.h:30
unsigned short adc() const
Definition: PixelDigi.h:60
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
PixelDigi()
Definition: PixelDigi.h:28
col
Definition: cuy.py:1010
static int pixelToChannel(int row, int col)
int column() const
Definition: PixelDigi.h:55
PackedDigiType theData
Definition: PixelDigi.h:76
std::ostream & operator<<(std::ostream &o, const PixelDigi &digi)
Definition: PixelDigi.h:91