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