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