CMS 3D CMS Logo

CSCStripDigi.cc
Go to the documentation of this file.
1 
8 #include <iostream>
9 #include <cstdint>
10 
11 // Comparison
12 bool CSCStripDigi::operator==(const CSCStripDigi& digi) const {
13  if (getStrip() != digi.getStrip())
14  return false;
15  if (getADCCounts().size() != digi.getADCCounts().size())
16  return false;
17  if (getADCCounts() != digi.getADCCounts())
18  return false;
19  return true;
20 }
21 
22 void CSCStripDigi::setADCCounts(const std::vector<int>& vADCCounts) {
23  bool badVal = false;
24  for (int i = 0; i < (int)vADCCounts.size(); i++) {
25  if (vADCCounts[i] < 1)
26  badVal = true;
27  }
28  if (!badVal) {
29  ADCCounts = vADCCounts;
30  } else {
31  std::vector<int> ZeroCounts(8, 0);
32  ADCCounts = ZeroCounts;
33  }
34 }
35 
36 // Debug
37 void CSCStripDigi::print() const {
38  std::ostringstream ost;
39  ost << "CSCStripDigi | strip " << getStrip() << " | ADCCounts ";
40  for (int i = 0; i < (int)getADCCounts().size(); i++) {
41  ost << getADCCounts()[i] << " ";
42  }
43  ost << " | Overflow ";
44  for (int i = 0; i < (int)getADCOverflow().size(); i++) {
45  ost << getADCOverflow()[i] << " ";
46  }
47  ost << " | Overlapped ";
48  for (int i = 0; i < (int)getOverlappedSample().size(); i++) {
49  ost << getOverlappedSample()[i] << " ";
50  }
51  ost << " | L1APhase ";
52  for (int i = 0; i < (int)getL1APhase().size(); i++) {
53  ost << getL1APhase()[i] << " ";
54  }
55  edm::LogVerbatim("CSCDigi") << ost.str();
56 }
57 
58 std::ostream& operator<<(std::ostream& o, const CSCStripDigi& digi) {
59  o << " " << digi.getStrip();
60  for (size_t i = 0; i < digi.getADCCounts().size(); ++i) {
61  o << " " << (digi.getADCCounts())[i];
62  }
63  return o;
64 }
std::vector< int > getL1APhase() const
Get L1APhase from OverlappedSample (9th bit)
Definition: CSCStripDigi.h:47
std::vector< uint16_t > const & getOverlappedSample() const
Definition: CSCStripDigi.h:58
std::vector< int > const & getADCCounts() const
Get ADC readings.
Definition: CSCStripDigi.h:44
std::ostream & operator<<(std::ostream &o, const CSCStripDigi &digi)
Definition: CSCStripDigi.cc:58
std::vector< int > ADCCounts
Definition: CSCStripDigi.h:76
void setADCCounts(const std::vector< int > &ADCCounts)
Definition: CSCStripDigi.cc:22
int getStrip() const
Definition: CSCStripDigi.h:41
std::vector< uint16_t > const & getADCOverflow() const
Other getters.
Definition: CSCStripDigi.h:57
void print() const
Definition: CSCStripDigi.cc:37
bool operator==(const CSCStripDigi &digi) const
Definition: CSCStripDigi.cc:12