File indexing completed on 2024-04-06 12:03:59
0001
0002
0003
0004
0005
0006 #include "DataFormats/CSCDigi/interface/CSCStripDigi.h"
0007 #include "DataFormats/CSCDigi/interface/CSCConstants.h"
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 #include <iostream>
0010 #include <cstdint>
0011
0012
0013 bool CSCStripDigi::operator==(const CSCStripDigi& digi) const {
0014 if (getStrip() != digi.getStrip())
0015 return false;
0016 if (getADCCounts().size() != digi.getADCCounts().size())
0017 return false;
0018 if (getADCCounts() != digi.getADCCounts())
0019 return false;
0020 return true;
0021 }
0022
0023
0024
0025 int CSCStripDigi::getCFEB() const { return (strip - 1) / CSCConstants::NUM_STRIPS_PER_CFEB; }
0026
0027 void CSCStripDigi::setADCCounts(const std::vector<int>& vADCCounts) {
0028 bool badVal = false;
0029 for (int i = 0; i < (int)vADCCounts.size(); i++) {
0030 if (vADCCounts[i] < 1)
0031 badVal = true;
0032 }
0033 if (!badVal) {
0034 ADCCounts = vADCCounts;
0035 } else {
0036 std::vector<int> ZeroCounts(8, 0);
0037 ADCCounts = ZeroCounts;
0038 }
0039 }
0040
0041
0042 void CSCStripDigi::print() const {
0043 std::ostringstream ost;
0044 ost << "CSCStripDigi | strip " << getStrip() << " | ADCCounts ";
0045 for (int i = 0; i < (int)getADCCounts().size(); i++) {
0046 ost << getADCCounts()[i] << " ";
0047 }
0048 ost << " | Overflow ";
0049 for (int i = 0; i < (int)getADCOverflow().size(); i++) {
0050 ost << getADCOverflow()[i] << " ";
0051 }
0052 ost << " | Overlapped ";
0053 for (int i = 0; i < (int)getOverlappedSample().size(); i++) {
0054 ost << getOverlappedSample()[i] << " ";
0055 }
0056 ost << " | L1APhase ";
0057 for (int i = 0; i < (int)getL1APhase().size(); i++) {
0058 ost << getL1APhase()[i] << " ";
0059 }
0060 edm::LogVerbatim("CSCDigi") << ost.str();
0061 }
0062
0063 std::ostream& operator<<(std::ostream& o, const CSCStripDigi& digi) {
0064 o << " " << digi.getStrip();
0065 for (size_t i = 0; i < digi.getADCCounts().size(); ++i) {
0066 o << " " << (digi.getADCCounts())[i];
0067 }
0068 return o;
0069 }