CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTDigi.cc
Go to the documentation of this file.
1 
11 
12 
13 using namespace std;
14 
15 
16 const double DTDigi::reso = 25./32.; //ns
17 
18 
19 DTDigi::DTDigi (int wire, int nTDC, int number) :
20  theWire(wire),
21  theCounts(nTDC),
22  theNumber(number)
23 {}
24 
25 
26 DTDigi::DTDigi (int wire, double tdrift, int number):
27  theWire(wire),
28  theCounts(static_cast<int>(tdrift/reso)),
29  theNumber(number)
30 {}
31 
32 
33 // DTDigi::DTDigi (ChannelType channel, int nTDC):
34 // theWire(0),
35 // theCounts(nTDC),
36 // theNumber(0)
37 // {
38 // theNumber = channel&number_mask;
39 // theWire = (channel&wire_mask)>>wire_offset;
40 // }
41 
42 
44  theWire(0),
45  theCounts(0),
46  theNumber(0)
47 {}
48 
49 
50 // Comparison
51 bool
52 DTDigi::operator == (const DTDigi& digi) const {
53  if ( theWire != digi.wire() ||
54  // theNumber != digi.number() || //FIXME required ??
55  theCounts != digi.countsTDC() ) return false;
56  return true;
57 }
58 
59 // Getters
60 // DTDigi::ChannelType
61 // DTDigi::channel() const {
62 // return (theNumber & number_mask) | (theWire<<wire_offset)&wire_mask;
63 // }
64 
65 double DTDigi::time() const { return theCounts*reso; }
66 
67 uint32_t DTDigi::countsTDC() const { return theCounts; }
68 
69 int DTDigi::wire() const { return theWire; }
70 
71 int DTDigi::number() const { return theNumber; }
72 
73 // Setters
74 
75 void DTDigi::setTime(double time){
76  theCounts = static_cast<int>(time/reso);
77 }
78 
79 void DTDigi::setCountsTDC (int nTDC) {
80  if (nTDC<0) cout << "WARNING: DTDigi::setCountsTDC: negative TDC count not supported "
81  << nTDC << endl;
82  theCounts = nTDC;
83 }
84 
85 
86 // Debug
87 
88 void
89 DTDigi::print() const {
90  cout << "Wire " << wire()
91  << " Digi # " << number()
92  << " Drift time (ns) " << time() << endl;
93 }
94 
uint32_t theCounts
Definition: DTDigi.h:78
uint16_t theNumber
Definition: DTDigi.h:79
void print() const
Print content of digi.
Definition: DTDigi.cc:89
bool operator==(const DTDigi &digi) const
Digis are equal if they are on the same cell and have same TDC count.
Definition: DTDigi.cc:52
int wire() const
Return wire number.
Definition: DTDigi.cc:69
void setCountsTDC(int nTDC)
Set with a TDC count.
Definition: DTDigi.cc:79
uint16_t theWire
Definition: DTDigi.h:77
double time() const
Get time in ns.
Definition: DTDigi.cc:65
DTDigi()
Default construction.
Definition: DTDigi.cc:43
Definition: DTDigi.h:19
uint32_t countsTDC() const
Get raw TDC count.
Definition: DTDigi.cc:67
static const double reso
Definition: DTDigi.h:70
void setTime(double time)
Set with a time in ns.
Definition: DTDigi.cc:75
int number() const
Identifies different digis within the same.
Definition: DTDigi.cc:71
tuple cout
Definition: gather_cfg.py:121