CMS 3D CMS Logo

DTDigi.h
Go to the documentation of this file.
1 #ifndef DTDigi_DTDigi_h
2 #define DTDigi_DTDigi_h
3 
15 #include <boost/cstdint.hpp>
16 
17 class DTDigi{
18 
19 public:
20  // typedef uint32_t ChannelType;
21 
24  explicit DTDigi (int wire, int nTDC, int number=0);
25 
26  // Construct from the wire#, the time (ns) and the digi number.
27  // time is converted in TDC counts (1 TDC = 25./32. ns)
28  // number should identify uniquely multiple digis in the same cell.
29  explicit DTDigi (int wire, double tdrift, int number=0);
30 
31  // Construct from channel and counts.
32  // explicit DTDigi (ChannelType channel, int nTDC);
33 
35  DTDigi ();
36 
38  bool operator==(const DTDigi& digi) const;
39 
40  // The channel identifier and the digi number packed together
41  // ChannelType channel() const ;
42 
44  int wire() const;
45 
47  int number() const;
48 
50  double time() const;
51 
53  uint32_t countsTDC() const;
54 
56  void setTime(double time);
57 
59  void setCountsTDC (int nTDC);
60 
62  void print() const;
63 
64 private:
65  friend class testDTDigis;
66 
67  // The value of one TDC count in ns
68  static const double reso;
69 
70  // Masks&shifts for the channel identifier
71 // static const uint32_t wire_mask = 0xffff0000;
72 // static const uint32_t number_mask = 0xffff;
73 // static const uint32_t wire_offset = 16;
74 
75  uint16_t theWire; // channel number
76  uint32_t theCounts; // TDC count, up to 20 bits actually used
77  uint16_t theNumber; // counter for digis in the same cell
78 };
79 
80 #include<iostream>
81 inline std::ostream & operator<<(std::ostream & o, const DTDigi& digi) {
82  return o << " " << digi.wire()
83  << " " << digi.time()
84  << " " << digi.number();
85 }
86 #endif
87 
uint32_t theCounts
Definition: DTDigi.h:76
uint16_t theNumber
Definition: DTDigi.h:77
void print() const
Print content of digi.
Definition: DTDigi.cc:87
bool operator==(const DTDigi &digi) const
Digis are equal if they are on the same cell and have same TDC count.
Definition: DTDigi.cc:50
int wire() const
Return wire number.
Definition: DTDigi.cc:67
void setCountsTDC(int nTDC)
Set with a TDC count.
Definition: DTDigi.cc:77
uint16_t theWire
Definition: DTDigi.h:75
double time() const
Get time in ns.
Definition: DTDigi.cc:63
friend class testDTDigis
Definition: DTDigi.h:65
DTDigi()
Default construction.
Definition: DTDigi.cc:41
Definition: DTDigi.h:17
static const double reso
Definition: DTDigi.h:68
uint32_t countsTDC() const
Get raw TDC count.
Definition: DTDigi.cc:65
void setTime(double time)
Set with a time in ns.
Definition: DTDigi.cc:73
std::ostream & operator<<(std::ostream &o, const DTDigi &digi)
Definition: DTDigi.h:81
int number() const
Identifies different digis within the same.
Definition: DTDigi.cc:69