CMS 3D CMS Logo

CSCALCTDigi.cc
Go to the documentation of this file.
1 
11 #include <iomanip>
12 #include <iostream>
13 
14 using namespace std;
15 
17 CSCALCTDigi::CSCALCTDigi(const int valid,
18  const int quality,
19  const int accel,
20  const int patternb,
21  const int keywire,
22  const int bx,
23  const int trknmb) {
24  valid_ = valid;
25  quality_ = quality;
26  accel_ = accel;
27  patternb_ = patternb;
28  keywire_ = keywire;
29  bx_ = bx;
30  trknmb_ = trknmb;
31 }
32 
35  clear(); // set contents to zero
36 }
37 
40  valid_ = 0;
41  quality_ = 0;
42  accel_ = 0;
43  patternb_ = 0;
44  keywire_ = 0;
45  bx_ = 0;
46  trknmb_ = 0;
47  fullbx_ = 0;
48 }
49 
50 bool CSCALCTDigi::operator>(const CSCALCTDigi& rhs) const {
51  bool returnValue = false;
52 
53  // Early ALCTs are always preferred to the ones found at later bx's.
54  if (getBX() < rhs.getBX()) {
55  returnValue = true;
56  }
57  if (getBX() != rhs.getBX()) {
58  return returnValue;
59  }
60 
61  // The > operator then checks the quality of ALCTs.
62  // If two qualities are equal, the ALCT furthest from the beam axis
63  // (lowest eta, highest wire group number) is selected.
64  int quality1 = getQuality();
65  int quality2 = rhs.getQuality();
66  if (quality1 > quality2) {
67  returnValue = true;
68  } else if (quality1 == quality2 && getKeyWG() > rhs.getKeyWG()) {
69  returnValue = true;
70  }
71  return returnValue;
72 }
73 
74 bool CSCALCTDigi::operator==(const CSCALCTDigi& rhs) const {
75  // Exact equality.
76  bool returnValue = false;
77  if (isValid() == rhs.isValid() && getQuality() == rhs.getQuality() && getAccelerator() == rhs.getAccelerator() &&
78  getCollisionB() == rhs.getCollisionB() && getKeyWG() == rhs.getKeyWG() && getBX() == rhs.getBX()) {
79  returnValue = true;
80  }
81  return returnValue;
82 }
83 
84 bool CSCALCTDigi::operator!=(const CSCALCTDigi& rhs) const {
85  // True if == is false.
86  bool returnValue = true;
87  if ((*this) == rhs)
88  returnValue = false;
89  return returnValue;
90 }
91 
93 void CSCALCTDigi::print() const {
94  if (isValid()) {
95  edm::LogVerbatim("CSCDigi") << "CSC ALCT #" << setw(1) << getTrknmb() << ": Valid = " << setw(1) << isValid()
96  << " Quality = " << setw(2) << getQuality() << " Accel. = " << setw(1)
97  << getAccelerator() << " PatternB = " << setw(1) << getCollisionB()
98  << " Key wire group = " << setw(3) << getKeyWG() << " BX = " << setw(2) << getBX()
99  << " Full BX= " << std::setw(1) << getFullBX();
100  } else {
101  edm::LogVerbatim("CSCDigi") << "Not a valid Anode LCT.";
102  }
103 }
104 
105 std::ostream& operator<<(std::ostream& o, const CSCALCTDigi& digi) {
106  return o << "CSC ALCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " Quality = " << digi.getQuality()
107  << " Accel. = " << digi.getAccelerator() << " PatternB = " << digi.getCollisionB()
108  << " Key wire group = " << digi.getKeyWG() << " BX = " << digi.getBX();
109 }
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:32
void clear()
clear this ALCT
Definition: CSCALCTDigi.cc:39
bool operator!=(const CSCALCTDigi &) const
True if the preceding one is false.
Definition: CSCALCTDigi.cc:84
static const uint16_t valid_
Definition: Constants.h:17
bool operator>(const CSCALCTDigi &) const
Definition: CSCALCTDigi.cc:50
int getTrknmb() const
return track number (1,2)
Definition: CSCALCTDigi.h:71
CSCALCTDigi()
default
Definition: CSCALCTDigi.cc:34
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167
std::ostream & operator<<(std::ostream &out, const std::tuple< Types... > &value)
Definition: Utilities.h:38
int getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
Definition: CSCALCTDigi.h:65
bool operator==(const CSCALCTDigi &) const
True if all members (except the number) of both ALCTs are equal.
Definition: CSCALCTDigi.cc:74
int getQuality() const
return quality of a pattern
Definition: CSCALCTDigi.h:38
int getAccelerator() const
Definition: CSCALCTDigi.h:45
void print() const
Print content of digi.
Definition: CSCALCTDigi.cc:93
int getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:59
int getCollisionB() const
Definition: CSCALCTDigi.h:53