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