File indexing completed on 2023-10-25 09:38:49
0001 #include "DataFormats/CSCDigi/interface/CSCShowerDigi.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 #include <iomanip>
0004 #include <iostream>
0005
0006 using namespace std;
0007
0008
0009 CSCShowerDigi::CSCShowerDigi(const uint16_t bitsInTime,
0010 const uint16_t bitsOutOfTime,
0011 const uint16_t cscID,
0012 const uint16_t bx,
0013 const uint16_t showerType,
0014 const uint16_t wireNHits,
0015 const uint16_t compNHits)
0016 : bitsInTime_(bitsInTime),
0017 bitsOutOfTime_(bitsOutOfTime),
0018 cscID_(cscID),
0019 bx_(bx),
0020 showerType_(showerType),
0021 wireNHits_(wireNHits),
0022 comparatorNHits_(compNHits) {}
0023
0024
0025 CSCShowerDigi::CSCShowerDigi()
0026 : bitsInTime_(0), bitsOutOfTime_(0), cscID_(0), bx_(0), showerType_(0), wireNHits_(0), comparatorNHits_(0) {}
0027
0028 void CSCShowerDigi::clear() {
0029 bitsInTime_ = 0;
0030 bitsOutOfTime_ = 0;
0031 cscID_ = 0;
0032 bx_ = 0;
0033 showerType_ = 0;
0034 wireNHits_ = 0;
0035 comparatorNHits_ = 0;
0036 }
0037
0038 bool CSCShowerDigi::isValid() const {
0039
0040
0041 return isLooseInTime() and isValidShowerType();
0042 }
0043
0044 bool CSCShowerDigi::isLooseInTime() const { return bitsInTime() >= kLoose; }
0045
0046 bool CSCShowerDigi::isNominalInTime() const { return bitsInTime() >= kNominal; }
0047
0048 bool CSCShowerDigi::isTightInTime() const { return bitsInTime() >= kTight; }
0049
0050 bool CSCShowerDigi::isLooseOutOfTime() const { return bitsOutOfTime() >= kLoose; }
0051
0052 bool CSCShowerDigi::isNominalOutOfTime() const { return bitsOutOfTime() >= kNominal; }
0053
0054 bool CSCShowerDigi::isTightOutOfTime() const { return bitsOutOfTime() >= kTight; }
0055
0056 bool CSCShowerDigi::isValidShowerType() const { return showerType_ > kInvalidShower; }
0057
0058 std::ostream& operator<<(std::ostream& o, const CSCShowerDigi& digi) {
0059 unsigned int showerType = digi.getShowerType();
0060 std::string compHitsStr(", comparatorHits ");
0061 compHitsStr += std::to_string(digi.getComparatorNHits());
0062 std::string wireHitsStr(", wireHits ");
0063 wireHitsStr += std::to_string(digi.getWireNHits());
0064 std::string showerStr;
0065 switch (showerType) {
0066 case 0:
0067 showerStr = "Invalid ShowerType";
0068 break;
0069 case 1:
0070 showerStr = "AnodeShower";
0071 break;
0072 case 2:
0073 showerStr = "CathodeShower";
0074 break;
0075 case 3:
0076 showerStr = "MatchedShower";
0077 break;
0078 case 4:
0079 showerStr = "EMTFShower";
0080 break;
0081 case 5:
0082 showerStr = "GMTShower";
0083 break;
0084 default:
0085 showerStr = "UnknownShowerType";
0086 }
0087
0088 return o << showerStr << ": bx " << digi.getBX() << ", in-time bits " << digi.bitsInTime() << ", out-of-time bits "
0089 << digi.bitsOutOfTime() << ((showerType == 1 or showerType == 3) ? wireHitsStr : "")
0090 << ((showerType == 2 or showerType == 3) ? compHitsStr : "") << ";";
0091 }