CMS 3D CMS Logo

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