CMS 3D CMS Logo

DTDigi.cc
Go to the documentation of this file.
1 
9 
10 using namespace std;
11 
12 DTDigi::DTDigi(int wire, int nTDC, int number, int base)
13  : theCounts(nTDC), theWire(wire), theNumber(number), theTDCBase(base) {
14  if (number > 255 || number < 0 || !(base == 30 || base == 32)) {
15  throw cms::Exception("BadConfig") << "DTDigi ctor: invalid parameters: number: " << number << " base: " << base;
16  }
17 }
18 
19 DTDigi::DTDigi(int wire, double tdrift, int number, int base)
20  : theCounts(static_cast<int>(tdrift / 25. * base)), theWire(wire), theNumber(number), theTDCBase(base) {
21  if (number > 255 || number < 0 || !(base == 30 || base == 32)) {
22  throw cms::Exception("BadConfig") << "DTDigi ctor: invalid parameters: number: " << number << " base: " << base;
23  }
24 }
25 
27 
28 // Comparison
29 bool DTDigi::operator==(const DTDigi& digi) const {
30  if (theWire != digi.wire() ||
31  // theNumber != digi.number() || //FIXME required ??
32  theCounts != digi.countsTDC())
33  return false;
34  return true;
35 }
36 
37 double DTDigi::time() const { return theCounts * 25. / theTDCBase; }
38 
39 int32_t DTDigi::countsTDC() const { return theCounts; }
40 
41 int DTDigi::wire() const { return theWire; }
42 
43 int DTDigi::number() const { return theNumber; }
44 
45 double DTDigi::tdcUnit() const { return 25. / theTDCBase; }
46 
47 int DTDigi::tdcBase() const { return theTDCBase; }
48 
49 void DTDigi::print() const {
50  cout << "Wire " << wire() << " Digi # " << number() << " Drift time (ns) " << time() << endl;
51 }
int32_t theCounts
Definition: DTDigi.h:69
void print() const
Print content of digi.
Definition: DTDigi.cc:49
bool operator==(const DTDigi &digi) const
Digis are equal if they are on the same cell and have same TDC count.
Definition: DTDigi.cc:29
base
Main Program
Definition: newFWLiteAna.py:92
double tdcUnit() const
Get the TDC unit value in ns.
Definition: DTDigi.cc:45
int wire() const
Return wire number.
Definition: DTDigi.cc:41
int tdcBase() const
Get the TDC base (counts per BX)
Definition: DTDigi.cc:47
uint16_t theWire
Definition: DTDigi.h:70
double time() const
Get time in ns.
Definition: DTDigi.cc:37
DTDigi()
Default construction.
Definition: DTDigi.cc:26
Definition: DTDigi.h:17
uint8_t theTDCBase
Definition: DTDigi.h:72
uint8_t theNumber
Definition: DTDigi.h:71
int number() const
Identifies different digis within the same cell.
Definition: DTDigi.cc:43
int32_t countsTDC() const
Get raw TDC count.
Definition: DTDigi.cc:39