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 
16 namespace {
17  enum Pattern_Info { NUM_LAYERS = 6, ALCT_PATTERN_WIDTH = 5 };
18 
19  CSCALCTDigi::WireContainer makeEmptyContainer() {
21  ret.resize(NUM_LAYERS);
22  for (auto& p : ret) {
23  p.resize(ALCT_PATTERN_WIDTH);
24  }
25  return ret;
26  }
27 } // namespace
28 
30  static WireContainer const s_container = makeEmptyContainer();
31  return s_container;
32 }
33 
36  const uint16_t quality,
37  const uint16_t accel,
38  const uint16_t patternb,
39  const uint16_t keywire,
40  const uint16_t bx,
41  const uint16_t trknmb,
42  const uint16_t hmt,
43  const Version version)
44  : valid_(valid),
45  quality_(quality),
46  accel_(accel),
47  patternb_(patternb),
48  keywire_(keywire),
49  bx_(bx),
50  trknmb_(trknmb),
51  hmt_(hmt),
52  version_(version) {}
53 
56  clear(); // set contents to zero
57 }
58 
61  valid_ = 0;
62  quality_ = 0;
63  accel_ = 0;
64  patternb_ = 0;
65  keywire_ = 0;
66  bx_ = 0;
67  trknmb_ = 0;
68  fullbx_ = 0;
69  hmt_ = 0;
70  hits_.clear();
72 }
73 
74 uint16_t CSCALCTDigi::getHMT() const { return (isRun3() ? hmt_ : std::numeric_limits<uint16_t>::max()); }
75 
77 
79 
80 bool CSCALCTDigi::operator>(const CSCALCTDigi& rhs) const {
81  bool returnValue = false;
82 
83  // Early ALCTs are always preferred to the ones found at later bx's.
84  if (getBX() < rhs.getBX()) {
85  returnValue = true;
86  }
87  if (getBX() != rhs.getBX()) {
88  return returnValue;
89  }
90 
91  // The > operator then checks the quality of ALCTs.
92  // If two qualities are equal, the ALCT furthest from the beam axis
93  // (lowest eta, highest wire group number) is selected.
94  uint16_t quality1 = getQuality();
95  uint16_t quality2 = rhs.getQuality();
96  if (quality1 > quality2) {
97  returnValue = true;
98  } else if (quality1 == quality2 && getKeyWG() > rhs.getKeyWG()) {
99  returnValue = true;
100  }
101  return returnValue;
102 }
103 
104 bool CSCALCTDigi::operator==(const CSCALCTDigi& rhs) const {
105  // Exact equality.
106  bool returnValue = false;
107  if (isValid() == rhs.isValid() && getQuality() == rhs.getQuality() && getAccelerator() == rhs.getAccelerator() &&
108  getCollisionB() == rhs.getCollisionB() && getKeyWG() == rhs.getKeyWG() && getBX() == rhs.getBX()) {
109  returnValue = true;
110  }
111  return returnValue;
112 }
113 
114 bool CSCALCTDigi::operator!=(const CSCALCTDigi& rhs) const {
115  // True if == is false.
116  bool returnValue = true;
117  if ((*this) == rhs)
118  returnValue = false;
119  return returnValue;
120 }
121 
123 void CSCALCTDigi::print() const {
124  if (isValid()) {
125  edm::LogVerbatim("CSCDigi") << "CSC ALCT #" << setw(1) << getTrknmb() << ": Valid = " << setw(1) << isValid()
126  << " Quality = " << setw(2) << getQuality() << " Accel. = " << setw(1)
127  << getAccelerator() << " PatternB = " << setw(1) << getCollisionB()
128  << " Key wire group = " << setw(3) << getKeyWG() << " BX = " << setw(2) << getBX()
129  << " Full BX = " << std::setw(1) << getFullBX();
130  } else {
131  edm::LogVerbatim("CSCDigi") << "Not a valid Anode LCT.";
132  }
133 }
134 
135 std::ostream& operator<<(std::ostream& o, const CSCALCTDigi& digi) {
136  return o << "CSC ALCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " Quality = " << digi.getQuality()
137  << " Accel. = " << digi.getAccelerator() << " PatternB = " << digi.getCollisionB()
138  << " Key wire group = " << digi.getKeyWG() << " BX = " << digi.getBX();
139 }
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:40
Log< level::Info, true > LogVerbatim
Version version_
Definition: CSCALCTDigi.h:138
uint16_t getTrknmb() const
return track number (1,2)
Definition: CSCALCTDigi.h:79
uint16_t getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
Definition: CSCALCTDigi.h:73
uint16_t bx_
Definition: CSCALCTDigi.h:129
uint16_t trknmb_
Definition: CSCALCTDigi.h:130
ret
prodAgent to be discontinued
uint16_t patternb_
Definition: CSCALCTDigi.h:127
void clear()
clear this ALCT
Definition: CSCALCTDigi.cc:60
uint16_t keywire_
Definition: CSCALCTDigi.h:128
static const WireContainer & emptyContainer()
Definition: CSCALCTDigi.cc:29
static const uint16_t valid_
Definition: Constants.h:17
uint16_t valid_
Definition: CSCALCTDigi.h:124
uint16_t getQuality() const
return quality of a pattern
Definition: CSCALCTDigi.h:46
bool operator>(const CSCALCTDigi &) const
Definition: CSCALCTDigi.cc:80
void print() const
Print content of digi.
Definition: CSCALCTDigi.cc:123
CSCALCTDigi()
default
Definition: CSCALCTDigi.cc:55
bool operator!=(const CSCALCTDigi &) const
True if the preceding one is false.
Definition: CSCALCTDigi.cc:114
void setHMT(const uint16_t hmt)
set the high multiplicity bits
Definition: CSCALCTDigi.cc:76
uint16_t getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:67
uint16_t getCollisionB() const
Definition: CSCALCTDigi.h:61
Pattern_Info
Definition: CSCALCTDigi.cc:17
void setRun3(const bool isRun3)
Definition: CSCALCTDigi.cc:78
uint16_t getFullBX() const
return 12-bit full BX.
Definition: CSCALCTDigi.h:85
uint16_t fullbx_
Definition: CSCALCTDigi.h:131
std::vector< std::vector< uint16_t > > WireContainer
Definition: CSCALCTDigi.h:21
uint16_t accel_
Definition: CSCALCTDigi.h:126
WireContainer hits_
Definition: CSCALCTDigi.h:140
std::ostream & operator<<(std::ostream &o, const CSCALCTDigi &digi)
Definition: CSCALCTDigi.cc:135
uint16_t getAccelerator() const
Definition: CSCALCTDigi.h:53
uint16_t hmt_
Definition: CSCALCTDigi.h:136
uint16_t quality_
Definition: CSCALCTDigi.h:125
bool isRun3() const
Distinguish Run-1/2 from Run-3.
Definition: CSCALCTDigi.h:113
uint16_t getHMT() const
return the high multiplicity bits
Definition: CSCALCTDigi.cc:74
string quality
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
bool operator==(const CSCALCTDigi &) const
True if all members (except the number) of both ALCTs are equal.
Definition: CSCALCTDigi.cc:104