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 
26 DTDigi::DTDigi() : theCounts(0), theWire(0), theNumber(0), theTDCBase(32) {}
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 }
DTDigi::tdcUnit
double tdcUnit() const
Get the TDC unit value in ns.
Definition: DTDigi.cc:45
DTDigi::number
int number() const
Identifies different digis within the same cell.
Definition: DTDigi.cc:43
DTDigi::DTDigi
DTDigi()
Default construction.
Definition: DTDigi.cc:26
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTDigi::theTDCBase
uint8_t theTDCBase
Definition: DTDigi.h:72
DTDigi::time
double time() const
Get time in ns.
Definition: DTDigi.cc:37
DTDigi::wire
int wire() const
Return wire number.
Definition: DTDigi.cc:41
DTDigi::theCounts
int32_t theCounts
Definition: DTDigi.h:69
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
DTDigi::tdcBase
int tdcBase() const
Get the TDC base (counts per BX)
Definition: DTDigi.cc:47
DTDigi::countsTDC
int32_t countsTDC() const
Get raw TDC count.
Definition: DTDigi.cc:39
DTDigi::print
void print() const
Print content of digi.
Definition: DTDigi.cc:49
createfilelist.int
int
Definition: createfilelist.py:10
DTDigi::theWire
uint16_t theWire
Definition: DTDigi.h:70
DTDigi::operator==
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
std
Definition: JetResolutionObject.h:76
Exception
Definition: hltDiff.cc:245
DTDigi
Definition: DTDigi.h:17
Exception.h
DTDigi.h
newFWLiteAna.base
base
Definition: newFWLiteAna.py:92
DTDigi::theNumber
uint8_t theNumber
Definition: DTDigi.h:71