File indexing completed on 2024-04-06 12:03:59
0001 #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigi.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003
0004 #include <iomanip>
0005 #include <iostream>
0006
0007
0008 CSCCLCTPreTriggerDigi::CSCCLCTPreTriggerDigi(const int valid,
0009 const int quality,
0010 const int pattern,
0011 const int striptype,
0012 const int bend,
0013 const int strip,
0014 const int cfeb,
0015 const int bx,
0016 const int trknmb,
0017 const int fullbx)
0018 : valid_(valid),
0019 quality_(quality),
0020 pattern_(pattern),
0021 striptype_(striptype),
0022 bend_(bend),
0023 strip_(strip),
0024 cfeb_(cfeb),
0025 bx_(bx),
0026 trknmb_(trknmb),
0027 fullbx_(fullbx) {}
0028
0029
0030 CSCCLCTPreTriggerDigi::CSCCLCTPreTriggerDigi()
0031 : valid_(0),
0032 quality_(0),
0033 pattern_(0),
0034 striptype_(0),
0035 bend_(0),
0036 strip_(0),
0037 cfeb_(0),
0038 bx_(0),
0039 trknmb_(0),
0040 fullbx_(0) {}
0041
0042
0043 void CSCCLCTPreTriggerDigi::clear() {
0044 valid_ = 0;
0045 quality_ = 0;
0046 pattern_ = 0;
0047 striptype_ = 0;
0048 bend_ = 0;
0049 strip_ = 0;
0050 cfeb_ = 0;
0051 bx_ = 0;
0052 trknmb_ = 0;
0053 fullbx_ = 0;
0054 }
0055
0056 bool CSCCLCTPreTriggerDigi::operator>(const CSCCLCTPreTriggerDigi& rhs) const {
0057
0058
0059
0060 bool returnValue = false;
0061
0062 int quality1 = getQuality();
0063 int quality2 = rhs.getQuality();
0064
0065
0066 int pattern1 = getPattern() & 14;
0067 int pattern2 = rhs.getPattern() & 14;
0068
0069
0070
0071
0072
0073
0074
0075 if ((quality1 > quality2) || (quality1 == quality2 && pattern1 > pattern2) ||
0076 (quality1 == quality2 && pattern1 == pattern2 && getKeyStrip() < rhs.getKeyStrip())) {
0077 returnValue = true;
0078 }
0079
0080 return returnValue;
0081 }
0082
0083 bool CSCCLCTPreTriggerDigi::operator==(const CSCCLCTPreTriggerDigi& rhs) const {
0084
0085 bool returnValue = false;
0086 if (isValid() == rhs.isValid() && getQuality() == rhs.getQuality() && getPattern() == rhs.getPattern() &&
0087 getKeyStrip() == rhs.getKeyStrip() && getStripType() == rhs.getStripType() && getBend() == getBend() &&
0088 getBX() == rhs.getBX()) {
0089 returnValue = true;
0090 }
0091 return returnValue;
0092 }
0093
0094 bool CSCCLCTPreTriggerDigi::operator!=(const CSCCLCTPreTriggerDigi& rhs) const {
0095
0096 bool returnValue = true;
0097 if ((*this) == rhs)
0098 returnValue = false;
0099 return returnValue;
0100 }
0101
0102
0103 void CSCCLCTPreTriggerDigi::print() const {
0104 if (isValid()) {
0105 char stripType = (getStripType() == 0) ? 'D' : 'H';
0106 char bend = (getBend() == 0) ? 'L' : 'R';
0107
0108 edm::LogVerbatim("CSCDigi") << " CSC CLCT #" << std::setw(1) << getTrknmb() << ": Valid = " << std::setw(1)
0109 << isValid() << " Key Strip = " << std::setw(3) << getKeyStrip()
0110 << " Strip = " << std::setw(2) << getStrip() << " Quality = " << std::setw(1)
0111 << getQuality() << " Pattern = " << std::setw(1) << getPattern()
0112 << " Bend = " << std::setw(1) << bend << " Strip type = " << std::setw(1) << stripType
0113 << " CFEB ID = " << std::setw(1) << getCFEB() << " BX = " << std::setw(1) << getBX()
0114 << " Full BX= " << std::setw(1) << getFullBX();
0115 } else {
0116 edm::LogVerbatim("CSCDigi") << "Not a valid Cathode LCT.";
0117 }
0118 }
0119
0120 std::ostream& operator<<(std::ostream& o, const CSCCLCTPreTriggerDigi& digi) {
0121 return o << "CSC CLCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " Quality = " << digi.getQuality()
0122 << " Pattern = " << digi.getPattern() << " StripType = " << digi.getStripType()
0123 << " Bend = " << digi.getBend() << " Strip = " << digi.getStrip() << " KeyStrip = " << digi.getKeyStrip()
0124 << " CFEB = " << digi.getCFEB() << " BX = " << digi.getBX();
0125 }