CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Phase2TrackerDigi.h
Go to the documentation of this file.
1 #ifndef DataFormats_Phase2TrackerDigi_Phase2TrackerDigi_H
2 #define DataFormats_Phase2TrackerDigi_Phase2TrackerDigi_H
3 
4 #include <stdint.h>
5 #include <utility>
6 #include <cassert>
7 
13 public:
14 
15  typedef uint16_t PackedDigiType;
16 
17  Phase2TrackerDigi( unsigned int packed_channel) : theChannel(packed_channel) {}
18 
19  Phase2TrackerDigi( unsigned int row, unsigned int col) {
20  theChannel = pixelToChannel(row,col);
21  }
22 
24 
25  // Access to digi information - pixel sensors
26  unsigned int row() const { return channelToRow(theChannel); }
27  unsigned int column() const { return channelToColumn(theChannel); }
28  // Access to digi information - strip sensors
29  unsigned int strip() const { return row(); }
30  unsigned int edge() const { return column(); } // CD: any better name for that?
31  // Access to the (raw) channel number
32  unsigned int channel() const { return theChannel; }
33 
34  static std::pair<unsigned int,unsigned int> channelToPixel( unsigned int ch) {
35  return std::pair<unsigned int, unsigned int>(channelToRow(ch),channelToColumn(ch));
36  }
37 
38  static PackedDigiType pixelToChannel( unsigned int row, unsigned int col) {
39  assert(row<1016);
40  assert(col<32);
41  return row|(col<<10);
42  }
43 
44  private:
46  static unsigned int channelToRow( unsigned int ch) { return ch & 0x03FF; } // (theChannel & 0x03FF)>>0
47  static unsigned int channelToColumn( unsigned int ch) { return ch >> 10; } // (theChannel & 0xFC00)>>10
48 };
49 
50 // Comparison operators
51 inline bool operator<( const Phase2TrackerDigi& one, const Phase2TrackerDigi& other) {
52  return one.channel() < other.channel();
53 }
54 
55 #include<iostream>
56 inline std::ostream & operator<<(std::ostream & o, const Phase2TrackerDigi& digi) {
57  return o << " " << digi.channel();
58 }
59 
60 #endif // DataFormats_Phase2TrackerDigi_Phase2TrackerDigi_H
unsigned int column() const
unsigned int row() const
Phase2TrackerDigi(unsigned int packed_channel)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
bool operator<(const FedChannelConnection &, const FedChannelConnection &)
static PackedDigiType pixelToChannel(unsigned int row, unsigned int col)
unsigned int channel() const
static unsigned int channelToRow(unsigned int ch)
unsigned int edge() const
PackedDigiType theChannel
int col
Definition: cuy.py:1008
unsigned int strip() const
Phase2TrackerDigi(unsigned int row, unsigned int col)
static std::pair< unsigned int, unsigned int > channelToPixel(unsigned int ch)
static unsigned int channelToColumn(unsigned int ch)