diff --git a/DataFormats/CSCDigi/interface/CSCShowerDigi.h b/DataFormats/CSCDigi/interface/CSCShowerDigi.h index f376ddfa56e73..78896227eec3d 100644 --- a/DataFormats/CSCDigi/interface/CSCShowerDigi.h +++ b/DataFormats/CSCDigi/interface/CSCShowerDigi.h @@ -11,11 +11,16 @@ class CSCShowerDigi { // Run-3 definitions as provided in DN-20-033 enum Run3Shower { kInvalid = 0, kLoose = 1, kNominal = 2, kTight = 3 }; // Shower types. and showers from OTMB/TMB are assigned with kLCTShower - enum ShowerType { kInvalidShower = 0, kALCTShower = 1, kCLCTShower = 2, kLCTShower = 3}; + enum ShowerType { kInvalidShower = 0, kALCTShower = 1, kCLCTShower = 2, kLCTShower = 3 }; /// Constructors - CSCShowerDigi(const uint16_t inTimeBits, const uint16_t outTimeBits, const uint16_t cscID, - const uint16_t bx, const uint16_t showerType, const uint16_t wireNHits, const uint16_t compNHits); + CSCShowerDigi(const uint16_t inTimeBits, + const uint16_t outTimeBits, + const uint16_t cscID, + const uint16_t bx, + const uint16_t showerType, + const uint16_t wireNHits, + const uint16_t compNHits); /// default CSCShowerDigi(); @@ -36,7 +41,7 @@ class CSCShowerDigi { uint16_t bitsInTime() const { return bitsInTime_; } uint16_t bitsOutOfTime() const { return bitsOutOfTime_; } - uint16_t getBX() const {return bx_; } + uint16_t getBX() const { return bx_; } uint16_t getCSCID() const { return cscID_; } uint16_t getShowerType() const { return showerType_; } uint16_t getWireNHits() const { return wireNHits_; } @@ -44,7 +49,7 @@ class CSCShowerDigi { /// set cscID void setCSCID(const uint16_t c) { cscID_ = c; } - void setBX(const uint16_t bx) {bx_ = bx; } + void setBX(const uint16_t bx) { bx_ = bx; } private: uint16_t bitsInTime_; diff --git a/DataFormats/CSCDigi/src/CSCShowerDigi.cc b/DataFormats/CSCDigi/src/CSCShowerDigi.cc index b269ebedef6f6..415b8c0ac502a 100644 --- a/DataFormats/CSCDigi/src/CSCShowerDigi.cc +++ b/DataFormats/CSCDigi/src/CSCShowerDigi.cc @@ -6,14 +6,24 @@ using namespace std; /// Constructors -CSCShowerDigi::CSCShowerDigi(const uint16_t bitsInTime, const uint16_t bitsOutOfTime, const uint16_t cscID, - const uint16_t bx, const uint16_t showerType, const uint16_t wireNHits, const uint16_t compNHits) - : bitsInTime_(bitsInTime), bitsOutOfTime_(bitsOutOfTime), cscID_(cscID), - bx_(bx), showerType_(showerType), wireNHits_(wireNHits), comparatorNHits_(compNHits) {} +CSCShowerDigi::CSCShowerDigi(const uint16_t bitsInTime, + const uint16_t bitsOutOfTime, + const uint16_t cscID, + const uint16_t bx, + const uint16_t showerType, + const uint16_t wireNHits, + const uint16_t compNHits) + : bitsInTime_(bitsInTime), + bitsOutOfTime_(bitsOutOfTime), + cscID_(cscID), + bx_(bx), + showerType_(showerType), + wireNHits_(wireNHits), + comparatorNHits_(compNHits) {} /// Default -CSCShowerDigi::CSCShowerDigi() : bitsInTime_(0), bitsOutOfTime_(0), cscID_(0), - bx_(0), showerType_(0), wireNHits_(0), comparatorNHits_(0){} +CSCShowerDigi::CSCShowerDigi() + : bitsInTime_(0), bitsOutOfTime_(0), cscID_(0), bx_(0), showerType_(0), wireNHits_(0), comparatorNHits_(0) {} void CSCShowerDigi::clear() { bitsInTime_ = 0; @@ -46,15 +56,16 @@ bool CSCShowerDigi::isTightOutOfTime() const { return bitsOutOfTime() >= kTight; bool CSCShowerDigi::isValidShowerType() const { return showerType_ > kInvalidShower; } std::ostream& operator<<(std::ostream& o, const CSCShowerDigi& digi) { - unsigned int showerType = digi.getShowerType(); std::string compHitsStr(", comparatorHits "); compHitsStr += std::to_string(digi.getComparatorNHits()); std::string wireHitsStr(", wireHits "); wireHitsStr += std::to_string(digi.getWireNHits()); - return o <<(showerType == 0 ? "Invalid ShowerType" : (showerType == 1 ? "ALCTShower" : (showerType == 2 ? "CLCTShower" : "correlatedLCTShower"))) - <<": bx "<< digi.getBX() <<", in-time bits " << digi.bitsInTime() << ", out-of-time bits " << digi.bitsOutOfTime() - << ((showerType == 1 or showerType == 3 ) ? wireHitsStr : "") - << ((showerType == 2 or showerType == 3 ) ? compHitsStr : "") << ";"; + return o << (showerType == 0 + ? "Invalid ShowerType" + : (showerType == 1 ? "ALCTShower" : (showerType == 2 ? "CLCTShower" : "correlatedLCTShower"))) + << ": bx " << digi.getBX() << ", in-time bits " << digi.bitsInTime() << ", out-of-time bits " + << digi.bitsOutOfTime() << ((showerType == 1 or showerType == 3) ? wireHitsStr : "") + << ((showerType == 2 or showerType == 3) ? compHitsStr : "") << ";"; } diff --git a/DataFormats/CSCDigi/src/classes_def.xml.generated b/DataFormats/CSCDigi/src/classes_def.xml.generated deleted file mode 100644 index 4a4b1e09b45e4..0000000000000 --- a/DataFormats/CSCDigi/src/classes_def.xml.generated +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h b/EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h index 5a116fce7ef08..4c4b021e5f14d 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h +++ b/EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h @@ -169,7 +169,7 @@ class CSCALCTHeader { if ((!theALCTs.empty()) && (theALCTs.size() == unsigned(header2007.lctBins * 2))) { for (unsigned bx = 0; bx < header2007.lctBins; bx++) { //CSCID is set to be 0 - //ALCTshower, showerType_= 1, wireNHits and ComparatorNHits are not available in data + //ALCTshower, showerType_= 1, wireNHits and ComparatorNHits are not available in data results.push_back(CSCShowerDigi(theALCTs[bx * 2].reserved & 0x3, 0, 0, bx, 1, 0, 0)); } return results; diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h index d71bdca80b374..86f04d6324750 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader.h @@ -54,7 +54,7 @@ class CSCTMBHeader { uint16_t sizeInBytes() const { return theHeaderFormat->sizeInWords() * 2; } - uint16_t L1AMatchTime() const {return theHeaderFormat->L1AMatchTime(); } + uint16_t L1AMatchTime() const { return theHeaderFormat->L1AMatchTime(); } /// will throw if the cast fails CSCTMBHeader2007 tmbHeader2007() const; CSCTMBHeader2007_rev0x50c3 tmbHeader2007_rev0x50c3() const; diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2006.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2006.h index fa950b531c8a4..aace95458d019 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2006.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2006.h @@ -26,7 +26,7 @@ struct CSCTMBHeader2006 : public CSCVTMBHeaderFormat { uint16_t syncErrorCLCT() const override { return (bits.clct0_sync_err | bits.clct1_sync_err); } uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; } uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; } - uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; } + uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; } /// == Run 3 CSC-GEM Trigger Format uint16_t clct0_ComparatorCode() const override { return 0; } diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007.h index 02296fb8dc008..6d851838d3021 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007.h @@ -26,7 +26,7 @@ struct CSCTMBHeader2007 : public CSCVTMBHeaderFormat { uint16_t syncErrorCLCT() const override { return (bits.clct0_sync_err | bits.clct1_sync_err); } uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; } uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; } - uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; } + uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; } /// == Run 3 CSC-GEM Trigger Format uint16_t clct0_ComparatorCode() const override { return 0; } diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007_rev0x50c3.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007_rev0x50c3.h index cf3366ff8577b..fc2a5b118e816 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007_rev0x50c3.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2007_rev0x50c3.h @@ -26,7 +26,7 @@ struct CSCTMBHeader2007_rev0x50c3 : public CSCVTMBHeaderFormat { uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; } uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; } uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; } - uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; } + uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; } /// == Run 3 CSC-GEM Trigger Format uint16_t clct0_ComparatorCode() const override { return 0; } diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2013.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2013.h index 73f61796bd54c..dba992dd22e6a 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2013.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2013.h @@ -26,7 +26,7 @@ struct CSCTMBHeader2013 : public CSCVTMBHeaderFormat { uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; } uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; } uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; } - uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; } + uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; } /// == Run 3 CSC-GEM Trigger Format uint16_t clct0_ComparatorCode() const override { return 0; } diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_CCLUT.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_CCLUT.h index fbbc576126387..f1b3847aa701e 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_CCLUT.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_CCLUT.h @@ -26,7 +26,7 @@ struct CSCTMBHeader2020_CCLUT : public CSCVTMBHeaderFormat { uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; } uint16_t syncErrorMPC0() const override { return 0; } uint16_t syncErrorMPC1() const override { return 0; } - uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; } + uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; } // == Run 3 CSC-GEM Trigger Format uint16_t clct0_ComparatorCode() const override { return bits.clct0_comparator_code; } diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_GEM.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_GEM.h index 446e7fc5c253e..f95f1a5f02727 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_GEM.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_GEM.h @@ -26,7 +26,7 @@ struct CSCTMBHeader2020_GEM : public CSCVTMBHeaderFormat { uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; } uint16_t syncErrorMPC0() const override { return 0; } uint16_t syncErrorMPC1() const override { return 0; } - uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; } + uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; } // == Run 3 CSC-GEM Trigger Format uint16_t clct0_ComparatorCode() const override { return bits.clct0_comparator_code; } diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_Run2.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_Run2.h index 163d588d2832f..163d5bf01349a 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_Run2.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_Run2.h @@ -26,7 +26,7 @@ struct CSCTMBHeader2020_Run2 : public CSCVTMBHeaderFormat { uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; } uint16_t syncErrorMPC0() const override { return bits.MPC_Muon0_SyncErr_; } uint16_t syncErrorMPC1() const override { return bits.MPC_Muon1_SyncErr_; } - uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; } + uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; } // == Run 3 CSC-GEM Trigger Format uint16_t clct0_ComparatorCode() const override { return 0; } diff --git a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_TMB.h b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_TMB.h index 6705e6092af1d..a3d03d1642876 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_TMB.h +++ b/EventFilter/CSCRawToDigi/interface/CSCTMBHeader2020_TMB.h @@ -26,7 +26,7 @@ struct CSCTMBHeader2020_TMB : public CSCVTMBHeaderFormat { uint16_t syncErrorCLCT() const override { return bits.clct_sync_err; } uint16_t syncErrorMPC0() const override { return 0; } uint16_t syncErrorMPC1() const override { return 0; } - uint16_t L1AMatchTime() const override {return bits.pop_l1a_match_win; } + uint16_t L1AMatchTime() const override { return bits.pop_l1a_match_win; } // == Run 3 CSC-GEM Trigger Format uint16_t clct0_ComparatorCode() const override { return 0; } diff --git a/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h b/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h index 53f57ed2c3e81..11ea88b519dd4 100644 --- a/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h +++ b/EventFilter/CSCRawToDigi/interface/CSCVTMBHeaderFormat.h @@ -86,7 +86,6 @@ class CSCVTMBHeaderFormat { virtual void print(std::ostream& os) const = 0; - protected: void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2); }; diff --git a/EventFilter/CSCRawToDigi/src/CSCALCTHeader.cc b/EventFilter/CSCRawToDigi/src/CSCALCTHeader.cc index bca6c7589787b..4c90847f15f03 100644 --- a/EventFilter/CSCRawToDigi/src/CSCALCTHeader.cc +++ b/EventFilter/CSCRawToDigi/src/CSCALCTHeader.cc @@ -229,7 +229,7 @@ void CSCALCTHeader::addShower(const std::vector &digis) { if (bx < (int)header2007.lctBins) { const CSCShowerDigi &digi = digis[bx]; int i = bx * 2; - unsigned hmt_bits = digi.isValid() ? digi.bitsInTime() : 0; + unsigned hmt_bits = digi.isValid() ? digi.bitsInTime() : 0; theALCTs[i].reserved = hmt_bits & 0x3; theALCTs[i + 1].reserved = hmt_bits & 0x3; } diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_CCLUT.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_CCLUT.cc index cd7e7c4d6cf09..eb830ef41c62b 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_CCLUT.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_CCLUT.cc @@ -161,19 +161,20 @@ std::vector CSCTMBHeader2020_CCLUT::CorrelatedLCTDigis(uin CSCShowerDigi CSCTMBHeader2020_CCLUT::showerDigi(uint32_t idlayer) const { unsigned hmt_bits = bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1); // HighMultiplicityTrigger bits - uint16_t cscid = bits.cscID; // ??? What is 4-bits CSC Id in CSshowerDigi + uint16_t cscid = bits.cscID; // ??? What is 4-bits CSC Id in CSshowerDigi //L1A_TMB_WINDOW is not included in below formula //correct version: CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win + L1A_TMB_WINDOW/2; // same for anode HMT and cathode HMT - uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; + uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; //LCTshower with showerType = 3. comparatorNHits from hmt_nhits() and wireNHit is not available - CSCShowerDigi result(hmt_bits & 0x3, (hmt_bits >> 2) & 0x3, cscid, bx, 3, 0, hmt_nhits()); // 2-bits intime, 2-bits out of time + CSCShowerDigi result( + hmt_bits & 0x3, (hmt_bits >> 2) & 0x3, cscid, bx, 3, 0, hmt_nhits()); // 2-bits intime, 2-bits out of time return result; } CSCShowerDigi CSCTMBHeader2020_CCLUT::anodeShowerDigi(uint32_t idlayer) const { uint16_t cscid = bits.cscID; - uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; + uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; //ALCT shower with showerType = 1. nhits_ is not available from unpack data CSCShowerDigi result(bits.anode_hmt & 0x3, 0, cscid, bx, 1, 0, 0); // 2-bits intime, no out of time return result; @@ -181,8 +182,8 @@ CSCShowerDigi CSCTMBHeader2020_CCLUT::anodeShowerDigi(uint32_t idlayer) const { CSCShowerDigi CSCTMBHeader2020_CCLUT::cathodeShowerDigi(uint32_t idlayer) const { uint16_t cscid = bits.cscID; - uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win - bits.hmt_match_win + 3; - //CLCT shower with showerType = 2. + uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win - bits.hmt_match_win + 3; + //CLCT shower with showerType = 2. CSCShowerDigi result(bits.cathode_hmt & 0x3, 0, cscid, bx, 2, 0, hmt_nhits()); // 2-bits intime, no out of time return result; } @@ -282,42 +283,45 @@ void CSCTMBHeader2020_CCLUT::addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) void CSCTMBHeader2020_CCLUT::addShower(const CSCShowerDigi& digi) { uint16_t hmt_bits = (digi.bitsInTime() & 0x3) + ((digi.bitsOutOfTime() & 0x3) << 2); //not valid LCT shower, then in-time bits must be 0. keep out-of-time HMT - if (not digi.isValid()) hmt_bits = ((digi.bitsOutOfTime() & 0x3) << 2); + if (not digi.isValid()) + hmt_bits = ((digi.bitsOutOfTime() & 0x3) << 2); bits.MPC_Muon_HMT_bit0 = hmt_bits & 0x1; bits.MPC_Muon_HMT_high = (hmt_bits >> 1) & 0x7; - //to keep pop_l1a_match_win + //to keep pop_l1a_match_win if (digi.isValid()) - bits.pop_l1a_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); + bits.pop_l1a_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); else - bits.pop_l1a_match_win = 3;//default value + bits.pop_l1a_match_win = 3; //default value } void CSCTMBHeader2020_CCLUT::addAnodeShower(const CSCShowerDigi& digi) { uint16_t hmt_bits = digi.bitsInTime() & 0x3; - if (not digi.isValid()) hmt_bits = 0; + if (not digi.isValid()) + hmt_bits = 0; bits.anode_hmt = hmt_bits; if (not(bits.MPC_Muon_HMT_bit0 or bits.MPC_Muon_HMT_high) and digi.isValid()) - bits.pop_l1a_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); + bits.pop_l1a_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); else if (not(digi.isValid())) - bits.pop_l1a_match_win = 3;//default value + bits.pop_l1a_match_win = 3; //default value } void CSCTMBHeader2020_CCLUT::addCathodeShower(const CSCShowerDigi& digi) { uint16_t hmt_bits = digi.bitsInTime() & 0x3; - if (not digi.isValid()) hmt_bits = 0; + if (not digi.isValid()) + hmt_bits = 0; bits.cathode_hmt = hmt_bits; bits.hmt_nhits_bit0 = digi.getComparatorNHits() & 0x1; bits.hmt_nhits_bit1 = (digi.getComparatorNHits() >> 1) & 0x1; bits.hmt_nhits_bits_high = (digi.getComparatorNHits() >> 2) & 0x1F; - if (bits.MPC_Muon_HMT_bit0 or bits.MPC_Muon_HMT_high or bits.anode_hmt){ - //matched HMT is found, then pop_l1a_match_win is assigned - bits.hmt_match_win = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win + 3 - digi.getBX(); - }else if (digi.isValid()){ - bits.pop_l1a_match_win = 3;//default value - bits.hmt_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); - }else { - bits.pop_l1a_match_win = 3;//default value - bits.hmt_match_win = 0; //no HMT case + if (bits.MPC_Muon_HMT_bit0 or bits.MPC_Muon_HMT_high or bits.anode_hmt) { + //matched HMT is found, then pop_l1a_match_win is assigned + bits.hmt_match_win = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win + 3 - digi.getBX(); + } else if (digi.isValid()) { + bits.pop_l1a_match_win = 3; //default value + bits.hmt_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); + } else { + bits.pop_l1a_match_win = 3; //default value + bits.hmt_match_win = 0; //no HMT case } } @@ -333,8 +337,8 @@ void CSCTMBHeader2020_CCLUT::print(std::ostream& os) const { << std::hex << (bits.activeCFEBs | (bits.activeCFEBs_2 << 5)) << ", readCFEBs = 0x" << std::hex << (bits.readCFEBs | (bits.readCFEBs_2 << 5)) << std::dec << "\n"; os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n"; - os << "ALCT location in CLCt window "<< bits.matchWin << " L1A location in TMB window "<< bits.pop_l1a_match_win - << " ALCT in cathde HMT window "<< bits.hmt_match_win << "\n"; + os << "ALCT location in CLCT window " << bits.matchWin << " L1A location in TMB window " << bits.pop_l1a_match_win + << " ALCT in cathde HMT window " << bits.hmt_match_win << "\n"; os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly << " clctOnly = " << bits.clctOnly << "\n"; os << "readoutCounter: " << std::dec << bits.readoutCounter << ", buf_q_ovf: " << bits.stackOvf @@ -378,5 +382,5 @@ void CSCTMBHeader2020_CCLUT::print(std::ostream& os) const { os << " clct_5bit_pattern_id = " << (bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4)) << " HMT = " << (bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1)) << ", alctHMT = " << bits.anode_hmt - << ", clctHMT = " << bits.cathode_hmt << " cathode nhits "<< hmt_nhits() <<"\n"; + << ", clctHMT = " << bits.cathode_hmt << " cathode nhits " << hmt_nhits() << "\n"; } diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_GEM.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_GEM.cc index 77ddaa9810309..f17e85c096ea4 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_GEM.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_GEM.cc @@ -165,19 +165,20 @@ std::vector CSCTMBHeader2020_GEM::CorrelatedLCTDigis(uint3 CSCShowerDigi CSCTMBHeader2020_GEM::showerDigi(uint32_t idlayer) const { unsigned hmt_bits = bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1); // HighMultiplicityTrigger bits - uint16_t cscid = bits.cscID; // ??? What is 4-bits CSC Id in CSshowerDigi + uint16_t cscid = bits.cscID; // ??? What is 4-bits CSC Id in CSshowerDigi //L1A_TMB_WINDOW is not included in below formula //correct version: CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win + L1A_TMB_WINDOW/2; // same for anode HMT and cathode HMT. offline analysis would take care of this - uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; + uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; //LCTshower with showerType = 3. comparatorNHits from hmt_nhits() and wireNHits is not available - CSCShowerDigi result(hmt_bits & 0x3, (hmt_bits >> 2) & 0x3, cscid, bx, 3, 0, hmt_nhits()); // 2-bits intime, 2-bits out of time + CSCShowerDigi result( + hmt_bits & 0x3, (hmt_bits >> 2) & 0x3, cscid, bx, 3, 0, hmt_nhits()); // 2-bits intime, 2-bits out of time return result; } CSCShowerDigi CSCTMBHeader2020_GEM::anodeShowerDigi(uint32_t idlayer) const { uint16_t cscid = bits.cscID; - uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; + uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; //ALCT shower with showerType = 1. wireNHits is not available from unpack data CSCShowerDigi result(bits.anode_hmt & 0x3, 0, cscid, bx, 1, 0, 0); // 2-bits intime, no out of time return result; @@ -185,7 +186,7 @@ CSCShowerDigi CSCTMBHeader2020_GEM::anodeShowerDigi(uint32_t idlayer) const { CSCShowerDigi CSCTMBHeader2020_GEM::cathodeShowerDigi(uint32_t idlayer) const { uint16_t cscid = bits.cscID; - uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win - bits.hmt_match_win + 3; + uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win - bits.hmt_match_win + 3; //CLCT shower with showerType = 2. comparatorNHits from hmt_nhits() CSCShowerDigi result(bits.cathode_hmt & 0x3, 0, cscid, bx, 2, 0, hmt_nhits()); // 2-bits intime, no out of time return result; @@ -286,42 +287,45 @@ void CSCTMBHeader2020_GEM::addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { void CSCTMBHeader2020_GEM::addShower(const CSCShowerDigi& digi) { uint16_t hmt_bits = (digi.bitsInTime() & 0x3) + ((digi.bitsOutOfTime() & 0x3) << 2); //not valid LCT shower, then in-time bits must be 0 - if (not digi.isValid()) hmt_bits = ((digi.bitsOutOfTime() & 0x3) << 2); + if (not digi.isValid()) + hmt_bits = ((digi.bitsOutOfTime() & 0x3) << 2); bits.MPC_Muon_HMT_bit0 = hmt_bits & 0x1; bits.MPC_Muon_HMT_high = (hmt_bits >> 1) & 0x7; - //to keep pop_l1a_match_win + //to keep pop_l1a_match_win if (digi.isValid()) - bits.pop_l1a_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); + bits.pop_l1a_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); else - bits.pop_l1a_match_win = 3;//default value + bits.pop_l1a_match_win = 3; //default value } void CSCTMBHeader2020_GEM::addAnodeShower(const CSCShowerDigi& digi) { uint16_t hmt_bits = digi.bitsInTime() & 0x3; - if (not digi.isValid()) hmt_bits = 0; + if (not digi.isValid()) + hmt_bits = 0; bits.anode_hmt = hmt_bits; if (not(bits.MPC_Muon_HMT_bit0 or bits.MPC_Muon_HMT_high) and digi.isValid()) - bits.pop_l1a_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); + bits.pop_l1a_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); else if (not(digi.isValid())) - bits.pop_l1a_match_win = 3;//default value + bits.pop_l1a_match_win = 3; //default value } void CSCTMBHeader2020_GEM::addCathodeShower(const CSCShowerDigi& digi) { uint16_t hmt_bits = digi.bitsInTime() & 0x3; - if (not digi.isValid()) hmt_bits = 0; + if (not digi.isValid()) + hmt_bits = 0; bits.cathode_hmt = hmt_bits; bits.hmt_nhits_bit0 = digi.getComparatorNHits() & 0x1; bits.hmt_nhits_bit1 = (digi.getComparatorNHits() >> 1) & 0x1; bits.hmt_nhits_bits_high = (digi.getComparatorNHits() >> 2) & 0x1F; - if (bits.MPC_Muon_HMT_bit0 or bits.MPC_Muon_HMT_high or bits.anode_hmt){ - //pop_l1a_match_win is assigned - bits.hmt_match_win = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win + 3 - digi.getBX(); - }else if (digi.isValid()){ - bits.pop_l1a_match_win = 3;//default value - bits.hmt_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); - }else { - bits.pop_l1a_match_win = 3;//default value - bits.hmt_match_win = 0; //no HMT case + if (bits.MPC_Muon_HMT_bit0 or bits.MPC_Muon_HMT_high or bits.anode_hmt) { + //pop_l1a_match_win is assigned + bits.hmt_match_win = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win + 3 - digi.getBX(); + } else if (digi.isValid()) { + bits.pop_l1a_match_win = 3; //default value + bits.hmt_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); + } else { + bits.pop_l1a_match_win = 3; //default value + bits.hmt_match_win = 0; //no HMT case } } @@ -338,8 +342,8 @@ void CSCTMBHeader2020_GEM::print(std::ostream& os) const { << ", activeCFEBs = 0x" << std::hex << (bits.activeCFEBs | (bits.activeCFEBs_2 << 5)) << ", readCFEBs = 0x" << std::hex << (bits.readCFEBs | (bits.readCFEBs_2 << 5)) << std::dec << "\n"; os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n"; - os << "ALCT location in CLCt window "<< bits.matchWin << " L1A location in TMB window "<< bits.pop_l1a_match_win - << " ALCT in cathde HMT window "<< bits.hmt_match_win << "\n"; + os << "ALCT location in CLCT window " << bits.matchWin << " L1A location in TMB window " << bits.pop_l1a_match_win + << " ALCT in cathde HMT window " << bits.hmt_match_win << "\n"; os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly << " clctOnly = " << bits.clctOnly << "\n"; os << "readoutCounter: " << std::dec << bits.readoutCounter << ", buf_q_ovf: " << bits.stackOvf @@ -384,7 +388,7 @@ void CSCTMBHeader2020_GEM::print(std::ostream& os) const { os << " clct_5bit_pattern_id = " << (bits.MPC_Muon_clct_pattern_low | (bits.MPC_Muon_clct_pattern_bit5 << 4)) << " HMT = " << (bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1)) << ", alctHMT = " << bits.anode_hmt - << ", clctHMT = " << bits.cathode_hmt << " cathode nhits "<< hmt_nhits() <<"\n"; + << ", clctHMT = " << bits.cathode_hmt << " cathode nhits " << hmt_nhits() << "\n"; // os << "..................CLCT....................." << "\n"; os << "GEM Data:\n" diff --git a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_TMB.cc b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_TMB.cc index 5ae3f6f5ecf57..7486051c8f24c 100644 --- a/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_TMB.cc +++ b/EventFilter/CSCRawToDigi/src/CSCTMBHeader2020_TMB.cc @@ -131,11 +131,11 @@ std::vector CSCTMBHeader2020_TMB::CorrelatedLCTDigis(uint3 CSCShowerDigi CSCTMBHeader2020_TMB::showerDigi(uint32_t idlayer) const { unsigned hmt_bits = bits.MPC_Muon_HMT_bit0 | (bits.MPC_Muon_HMT_high << 1); // HighMultiplicityTrigger bits - uint16_t cscid = bits.cscID; // ??? What is 4-bits CSC Id in CSshowerDigi + uint16_t cscid = bits.cscID; // ??? What is 4-bits CSC Id in CSshowerDigi //L1A_TMB_WINDOW is not included in below formula //correct version: CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win + L1A_TMB_WINDOW/2; // same for anode HMT and cathode HMT - uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; + uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; //LCTshower with showerType = 3. wireNHits is not avaiable //TMB LCT shower is copied from ALCT shower CSCShowerDigi result(hmt_bits & 0x3, (hmt_bits >> 2) & 0x3, cscid, bx, 3, 0, 0); // 2-bits intime, 2-bits out of time @@ -144,7 +144,7 @@ CSCShowerDigi CSCTMBHeader2020_TMB::showerDigi(uint32_t idlayer) const { CSCShowerDigi CSCTMBHeader2020_TMB::anodeShowerDigi(uint32_t idlayer) const { uint16_t cscid = bits.cscID; - uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; + uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; //ALCTshower with showerType = 1. wireNHits is not avaiable CSCShowerDigi result(bits.anode_hmt & 0x3, 0, cscid, bx, 1, 0, 0); // 2-bits intime, no out of time return result; @@ -152,7 +152,7 @@ CSCShowerDigi CSCTMBHeader2020_TMB::anodeShowerDigi(uint32_t idlayer) const { CSCShowerDigi CSCTMBHeader2020_TMB::cathodeShowerDigi(uint32_t idlayer) const { uint16_t cscid = bits.cscID; - uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; + uint16_t bx = CSCConstants::LCT_CENTRAL_BX - bits.pop_l1a_match_win; //CLCTshower with showerType = 2. comparatorNhits is not avaiable for TMB yet CSCShowerDigi result(bits.cathode_hmt & 0x3, 0, cscid, bx, 2, 0, 0); // 2-bits intime, no out of time return result; @@ -267,23 +267,25 @@ void CSCTMBHeader2020_TMB::addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { void CSCTMBHeader2020_TMB::addShower(const CSCShowerDigi& digi) { uint16_t hmt_bits = (digi.bitsInTime() & 0x3) + ((digi.bitsOutOfTime() & 0x3) << 2); //not valid LCT shower, then in-time bits must be 0 - if (not digi.isValid()) hmt_bits = ((digi.bitsOutOfTime() & 0x3) << 2); + if (not digi.isValid()) + hmt_bits = ((digi.bitsOutOfTime() & 0x3) << 2); bits.MPC_Muon_HMT_bit0 = hmt_bits & 0x1; bits.MPC_Muon_HMT_high = (hmt_bits >> 1) & 0x7; if (digi.isValid()) - bits.pop_l1a_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); + bits.pop_l1a_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); else - bits.pop_l1a_match_win = 3;//default value + bits.pop_l1a_match_win = 3; //default value } void CSCTMBHeader2020_TMB::addAnodeShower(const CSCShowerDigi& digi) { uint16_t hmt_bits = digi.bitsInTime() & 0x3; - if (not digi.isValid()) hmt_bits = 0; + if (not digi.isValid()) + hmt_bits = 0; bits.anode_hmt = hmt_bits; if (digi.isValid()) - bits.pop_l1a_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); + bits.pop_l1a_match_win = CSCConstants::LCT_CENTRAL_BX - digi.getBX(); else - bits.pop_l1a_match_win = 3;//default value + bits.pop_l1a_match_win = 3; //default value } void CSCTMBHeader2020_TMB::addCathodeShower(const CSCShowerDigi& digi) { @@ -306,7 +308,8 @@ void CSCTMBHeader2020_TMB::print(std::ostream& os) const { << (bits.activeCFEBs | (bits.activeCFEBs_2 << 5)) << ", readCFEBs = 0x" << std::hex << (bits.readCFEBs | (bits.readCFEBs_2 << 5)) << std::dec << "\n"; os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n"; - os << "ALCT location in CLCt window "<< bits.matchWin << " L1A location in TMB window "<< bits.pop_l1a_match_win << "\n"; + os << "ALCT location in CLCT window " << bits.matchWin << " L1A location in TMB window " << bits.pop_l1a_match_win + << "\n"; os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly << " clctOnly = " << bits.clctOnly << "\n"; os << "CLCT Words:\n" diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h index f29dd0e06f123..11f01af9278e2 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h @@ -88,7 +88,7 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { CSCALCTDigi getSecondALCT(int bx) const; /* get array of high multiplicity triggers */ - std::vector getAllShower() const; + std::vector getAllShower() const; /** Returns shower bits */ std::vector readoutShower() const; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h index 722c006e9f11a..fa93609ae8df1 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h @@ -90,7 +90,7 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { //unsigned getInTimeHMT() const { return inTimeHMT_; } //unsigned getOutTimeHMT() const { return outTimeHMT_; } /* get array of high multiplicity triggers */ - std::vector getAllShower() const; + std::vector getAllShower() const; /** Returns shower bits */ std::vector readoutShower() const; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h index afc8bcf33c33c..f2fb3df3ce39c 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h @@ -234,10 +234,9 @@ class CSCMotherboard : public CSCBaseboard { void dumpConfigParams() const; /* match cathode shower and anode shower with and/or logic */ - void matchShowers(CSCShowerDigi * anode_showers, CSCShowerDigi * cathode_showers, bool andlogic); + void matchShowers(CSCShowerDigi* anode_showers, CSCShowerDigi* cathode_showers, bool andlogic); /* encode high multiplicity bits for Run-3 exotic triggers */ void encodeHighMultiplicityBits(); - }; #endif diff --git a/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py b/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py index db0ac182ecad8..472b64cabac3c 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py +++ b/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py @@ -35,7 +35,7 @@ # If True, output collections will only be built for good chambers checkBadChambers = cms.bool(True), #selected chamebrs to process - selectedChambers = cms.vstring(""), + selectedChambers = cms.vstring(), # Anode-DAQ rate determined by pre-CLCTs keepCLCTPreTriggers = cms.bool(True), diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index 2aed3f8223aeb..2d13d2dafc533 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -178,7 +178,7 @@ void CSCAnodeLCTProcessor::clear() { for (int bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) { bestALCT[bx].clear(); secondALCT[bx].clear(); - anode_showers_[bx].clear();//? + anode_showers_[bx].clear(); //? } lct_list.clear(); } @@ -1278,29 +1278,31 @@ CSCALCTDigi CSCAnodeLCTProcessor::getBestALCT(int bx) const { return bestALCT[bx CSCALCTDigi CSCAnodeLCTProcessor::getSecondALCT(int bx) const { return secondALCT[bx]; } /** return vector of CSCShower digi **/ -std::vector CSCAnodeLCTProcessor::getAllShower() const { +std::vector CSCAnodeLCTProcessor::getAllShower() const { std::vector vshowers(anode_showers_, anode_showers_ + CSCConstants::MAX_ALCT_TBINS); - return vshowers; + return vshowers; }; - + /** Returns shower bits */ -std::vector CSCAnodeLCTProcessor::readoutShower() const { - unsigned minbx_readout = CSCConstants::LCT_CENTRAL_BX - l1a_window_width/2; - unsigned maxbx_readout = CSCConstants::LCT_CENTRAL_BX + l1a_window_width/2; - unsigned minBXdiff = 2*l1a_window_width;//impossible value +std::vector CSCAnodeLCTProcessor::readoutShower() const { + unsigned minbx_readout = CSCConstants::LCT_CENTRAL_BX - l1a_window_width / 2; + unsigned maxbx_readout = CSCConstants::LCT_CENTRAL_BX + l1a_window_width / 2; + unsigned minBXdiff = 2 * l1a_window_width; //impossible value unsigned minBX = 0; std::vector showerOut; - for (unsigned bx = minbx_readout; bx < maxbx_readout; bx++){ - unsigned bx_diff = (bx > bx-CSCConstants::LCT_CENTRAL_BX ) ? bx-CSCConstants::LCT_CENTRAL_BX : CSCConstants::LCT_CENTRAL_BX-bx; - if (anode_showers_[bx].isValid() and bx_diff < minBXdiff){ - minBXdiff = bx_diff; - minBX = bx; + for (unsigned bx = minbx_readout; bx < maxbx_readout; bx++) { + unsigned bx_diff = (bx > bx - CSCConstants::LCT_CENTRAL_BX) ? bx - CSCConstants::LCT_CENTRAL_BX + : CSCConstants::LCT_CENTRAL_BX - bx; + if (anode_showers_[bx].isValid() and bx_diff < minBXdiff) { + minBXdiff = bx_diff; + minBX = bx; } } - for (unsigned bx = minbx_readout; bx < maxbx_readout; bx++) - if (bx == minBX) showerOut.push_back(anode_showers_[bx]); - return showerOut; + for (unsigned bx = minbx_readout; bx < maxbx_readout; bx++) + if (bx == minBX) + showerOut.push_back(anode_showers_[bx]); + return showerOut; } //////////////////////////////////////////////////////////////////////// @@ -1360,30 +1362,29 @@ void CSCAnodeLCTProcessor::setWireContainer(CSCALCTDigi& alct, CSCALCTDigi::Wire alct.setHits(wireHits); } -void CSCAnodeLCTProcessor::encodeHighMultiplicityBits(){ - +void CSCAnodeLCTProcessor::encodeHighMultiplicityBits() { //numer of layer with hits and number of hits for 0-15 BXs - std::set layersWithHits [CSCConstants::MAX_ALCT_TBINS]; - unsigned hitsInTime [CSCConstants::MAX_ALCT_TBINS]; + std::set layersWithHits[CSCConstants::MAX_ALCT_TBINS]; + unsigned hitsInTime[CSCConstants::MAX_ALCT_TBINS]; // Calculate layers with hits - for (unsigned bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++){ + for (unsigned bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) { hitsInTime[bx] = 0; for (unsigned i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { bool atLeastOneWGHit = false; for (const auto& wd : digiV[i_layer]) { std::vector bx_times = wd.getTimeBinsOn(); // there is at least one wiregroup in this bx - if (std::find(bx_times.begin(), bx_times.end(), bx) != bx_times.end()){ - hitsInTime[bx] += 1; - atLeastOneWGHit = true; + if (std::find(bx_times.begin(), bx_times.end(), bx) != bx_times.end()) { + hitsInTime[bx] += 1; + atLeastOneWGHit = true; } } - // add this layer to the number of layers hit + // add this layer to the number of layers hit if (atLeastOneWGHit) { - layersWithHits[bx].insert(i_layer); + layersWithHits[bx].insert(i_layer); } } - }//end of full bx loop + } //end of full bx loop // convert station and ring number to index // index runs from 2 to 10, subtract 2 @@ -1393,18 +1394,19 @@ void CSCAnodeLCTProcessor::encodeHighMultiplicityBits(){ std::vector station_thresholds = { thresholds_[csc_idx * 3], thresholds_[csc_idx * 3 + 1], thresholds_[csc_idx * 3 + 2]}; - for (unsigned bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++){ - unsigned minbx = bx >= showerNumTBins_/2 ? bx-showerNumTBins_/2 : bx; - unsigned maxbx = bx < CSCConstants::MAX_ALCT_TBINS - showerNumTBins_/2 ? bx+showerNumTBins_/2 : CSCConstants::MAX_ALCT_TBINS - 1; + for (unsigned bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) { + unsigned minbx = bx >= showerNumTBins_ / 2 ? bx - showerNumTBins_ / 2 : bx; + unsigned maxbx = bx < CSCConstants::MAX_ALCT_TBINS - showerNumTBins_ / 2 ? bx + showerNumTBins_ / 2 + : CSCConstants::MAX_ALCT_TBINS - 1; unsigned this_hitsInTime = 0; - for (unsigned mbx = minbx; mbx <= maxbx; mbx++){ + for (unsigned mbx = minbx; mbx <= maxbx; mbx++) { this_hitsInTime += hitsInTime[mbx]; } unsigned this_inTimeHMT = 0; // require at least nLayersWithHits for the central time bin // do nothing if there are not enough layers with hits - if (layersWithHits[bx].size() >= minLayersCentralTBin_){ + if (layersWithHits[bx].size() >= minLayersCentralTBin_) { // assign the bits for (unsigned i = 0; i < station_thresholds.size(); i++) { if (this_hitsInTime >= station_thresholds[i]) { @@ -1413,6 +1415,6 @@ void CSCAnodeLCTProcessor::encodeHighMultiplicityBits(){ } } //ALCT shower construction with showerType_=1, comparatorhits_= 0; - anode_showers_[bx] = CSCShowerDigi(this_inTimeHMT, false, theTrigChamber, bx, 1, this_hitsInTime, 0); + anode_showers_[bx] = CSCShowerDigi(this_inTimeHMT, false, theTrigChamber, bx, 1, this_hitsInTime, 0); } } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc index 102e4d5995e48..5efc1f2bbbf47 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc @@ -97,7 +97,7 @@ CSCCathodeLCTProcessor::CSCCathodeLCTProcessor(unsigned endcap, thresholds_ = shower.getParameter>("showerThresholds"); showerNumTBins_ = shower.getParameter("showerNumTBins"); minLayersCentralTBin_ = shower.getParameter("minLayersCentralTBin"); - peakCheck_ = shower.getParameter("peakCheck"); + peakCheck_ = shower.getParameter("peakCheck"); thePreTriggerDigis.clear(); // quality control of stubs @@ -1200,46 +1200,47 @@ CSCCLCTDigi CSCCathodeLCTProcessor::getSecondCLCT(int bx) const { } /** return vector of CSCShower digi **/ -std::vector CSCCathodeLCTProcessor::getAllShower() const { +std::vector CSCCathodeLCTProcessor::getAllShower() const { std::vector vshowers(cathode_showers_, cathode_showers_ + CSCConstants::MAX_CLCT_TBINS); - return vshowers; + return vshowers; }; - + /** Returns shower bits */ -std::vector CSCCathodeLCTProcessor::readoutShower() const { - unsigned minbx_readout = CSCConstants::LCT_CENTRAL_BX - tmb_l1a_window_size/2; - unsigned maxbx_readout = CSCConstants::LCT_CENTRAL_BX + tmb_l1a_window_size/2; +std::vector CSCCathodeLCTProcessor::readoutShower() const { + unsigned minbx_readout = CSCConstants::LCT_CENTRAL_BX - tmb_l1a_window_size / 2; + unsigned maxbx_readout = CSCConstants::LCT_CENTRAL_BX + tmb_l1a_window_size / 2; std::vector showerOut; for (unsigned bx = minbx_readout; bx < maxbx_readout; bx++) - if (cathode_showers_[bx].isValid()) showerOut.push_back(cathode_showers_[bx]); - return showerOut; + if (cathode_showers_[bx].isValid()) + showerOut.push_back(cathode_showers_[bx]); + return showerOut; } -void CSCCathodeLCTProcessor::encodeHighMultiplicityBits(){ +void CSCCathodeLCTProcessor::encodeHighMultiplicityBits() { //inTimeHMT_ = 0; //numer of layer with hits and number of hits for 0-15 BXs - std::set layersWithHits [CSCConstants::MAX_CLCT_TBINS]; - unsigned hitsInTime [CSCConstants::MAX_CLCT_TBINS]; + std::set layersWithHits[CSCConstants::MAX_CLCT_TBINS]; + unsigned hitsInTime[CSCConstants::MAX_CLCT_TBINS]; // Calculate layers with hits - for (unsigned bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++){ + for (unsigned bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) { hitsInTime[bx] = 0; for (unsigned i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { bool atLeastOneCompHit = false; for (const auto& compdigi : digiV[i_layer]) { std::vector bx_times = compdigi.getTimeBinsOn(); // there is at least one comparator digi in this bx - if (std::find(bx_times.begin(), bx_times.end(), bx) != bx_times.end()){ - hitsInTime[bx] += 1; - atLeastOneCompHit = true; + if (std::find(bx_times.begin(), bx_times.end(), bx) != bx_times.end()) { + hitsInTime[bx] += 1; + atLeastOneCompHit = true; } } - // add this layer to the number of layers hit + // add this layer to the number of layers hit if (atLeastOneCompHit) { - layersWithHits[bx].insert(i_layer); + layersWithHits[bx].insert(i_layer); } } - }//end of full bx loop + } //end of full bx loop // convert station and ring number to index // index runs from 2 to 10, subtract 2 @@ -1249,48 +1250,50 @@ void CSCCathodeLCTProcessor::encodeHighMultiplicityBits(){ std::vector station_thresholds = { thresholds_[csc_idx * 3], thresholds_[csc_idx * 3 + 1], thresholds_[csc_idx * 3 + 2]}; - //hard coded dead time as 2Bx, since showerNumTBins = 3, like firmware + //hard coded dead time as 2Bx, since showerNumTBins = 3, like firmware // for example, nhits = 0 at bx7; = 100 at bx8; = 0 at bx9 //cathode HMT must be triggered at bx8, not bx7 and bx9 //meanwhile we forced 2BX dead time after active shower trigger - unsigned int deadtime = showerNumTBins_-1;// firmware hard coded dead time as 2Bx, since showerNumTBins = 3 in firmware + unsigned int deadtime = + showerNumTBins_ - 1; // firmware hard coded dead time as 2Bx, since showerNumTBins = 3 in firmware unsigned int dead_count = 0; bool dead_status = false; - for (unsigned bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++){ - unsigned minbx = bx >= showerNumTBins_/2 ? bx-showerNumTBins_/2 : bx; - unsigned maxbx = bx < CSCConstants::MAX_CLCT_TBINS - showerNumTBins_/2 ? bx+showerNumTBins_/2 : CSCConstants::MAX_CLCT_TBINS - 1; + for (unsigned bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) { + unsigned minbx = bx >= showerNumTBins_ / 2 ? bx - showerNumTBins_ / 2 : bx; + unsigned maxbx = bx < CSCConstants::MAX_CLCT_TBINS - showerNumTBins_ / 2 ? bx + showerNumTBins_ / 2 + : CSCConstants::MAX_CLCT_TBINS - 1; unsigned this_hitsInTime = 0; - bool isPeak = true;//check whether total hits in bx is peak of nhits over time bins + bool isPeak = true; //check whether total hits in bx is peak of nhits over time bins /*following is to count number of hits over [minbx, maxbx], showerNumTBins=3 =>[n-1, n+1]*/ - for (unsigned mbx = minbx; mbx <= maxbx; mbx++){ + for (unsigned mbx = minbx; mbx <= maxbx; mbx++) { this_hitsInTime += hitsInTime[mbx]; } - - if (peakCheck_ and bx < CSCConstants::MAX_CLCT_TBINS - showerNumTBins_/2 - 1){ - if (hitsInTime[minbx] < hitsInTime[maxbx+1] or (hitsInTime[minbx] == hitsInTime[maxbx+1] and hitsInTime[bx] < hitsInTime[bx+1])) - isPeak = false; //next bx would have more hits or in the center + + if (peakCheck_ and bx < CSCConstants::MAX_CLCT_TBINS - showerNumTBins_ / 2 - 1) { + if (hitsInTime[minbx] < hitsInTime[maxbx + 1] or + (hitsInTime[minbx] == hitsInTime[maxbx + 1] and hitsInTime[bx] < hitsInTime[bx + 1])) + isPeak = false; //next bx would have more hits or in the center } - if (dead_count > 0){ + if (dead_count > 0) { dead_count--; dead_status = true; - }else + } else dead_status = false; unsigned this_inTimeHMT = 0; // require at least nLayersWithHits for the central time bin // do nothing if there are not enough layers with hits - if (layersWithHits[bx].size() >= minLayersCentralTBin_ and !dead_status and isPeak){ + if (layersWithHits[bx].size() >= minLayersCentralTBin_ and !dead_status and isPeak) { // assign the bits for (unsigned i = 0; i < station_thresholds.size(); i++) { if (this_hitsInTime >= station_thresholds[i]) { this_inTimeHMT = i + 1; - dead_count = deadtime; + dead_count = deadtime; } } } //CLCTshower constructor with showerType_ = 2, wirehits = 0; cathode_showers_[bx] = CSCShowerDigi(this_inTimeHMT, false, theTrigChamber, bx, 2, 0, this_hitsInTime); } - } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc index 8bd8cfd5be3f9..cd2cdf95e2303 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc @@ -55,7 +55,7 @@ CSCMotherboard::CSCMotherboard(unsigned endcap, allLCTs_.setMatchTrigWindowSize(match_trig_window_size); // get the preferred CLCT BX match array - preferred_bx_match_ = tmbParams_.getParameter >("preferredBxMatch"); + preferred_bx_match_ = tmbParams_.getParameter>("preferredBxMatch"); // quality assignment qualityAssignment_ = std::make_unique(endcap, station, sector, subsector, chamber, conf); @@ -369,23 +369,25 @@ std::vector CSCMotherboard::readoutLCTs() const { return tmpV; } -std::vector CSCMotherboard::readoutShower() const { - unsigned minbx_readout = CSCConstants::LCT_CENTRAL_BX - tmb_l1a_window_size/2; - unsigned maxbx_readout = CSCConstants::LCT_CENTRAL_BX + tmb_l1a_window_size/2; - unsigned minBXdiff = 2*tmb_l1a_window_size;//impossible value +std::vector CSCMotherboard::readoutShower() const { + unsigned minbx_readout = CSCConstants::LCT_CENTRAL_BX - tmb_l1a_window_size / 2; + unsigned maxbx_readout = CSCConstants::LCT_CENTRAL_BX + tmb_l1a_window_size / 2; + unsigned minBXdiff = 2 * tmb_l1a_window_size; //impossible value unsigned minBX = 0; std::vector showerOut; - for (unsigned bx = minbx_readout; bx < maxbx_readout; bx++){ - unsigned bx_diff = (bx > bx-CSCConstants::LCT_CENTRAL_BX ) ? bx-CSCConstants::LCT_CENTRAL_BX : CSCConstants::LCT_CENTRAL_BX-bx; - if (showers_[bx].isValid() and bx_diff < minBXdiff){ - minBXdiff = bx_diff; - minBX = bx; + for (unsigned bx = minbx_readout; bx < maxbx_readout; bx++) { + unsigned bx_diff = (bx > bx - CSCConstants::LCT_CENTRAL_BX) ? bx - CSCConstants::LCT_CENTRAL_BX + : CSCConstants::LCT_CENTRAL_BX - bx; + if (showers_[bx].isValid() and bx_diff < minBXdiff) { + minBXdiff = bx_diff; + minBX = bx; } } - for (unsigned bx = minbx_readout; bx < maxbx_readout; bx++) - if (bx == minBX) showerOut.push_back(showers_[bx]); - return showerOut; + for (unsigned bx = minbx_readout; bx < maxbx_readout; bx++) + if (bx == minBX) + showerOut.push_back(showers_[bx]); + return showerOut; } void CSCMotherboard::correlateLCTs(const CSCALCTDigi& bALCT, @@ -599,14 +601,13 @@ CSCCLCTDigi CSCMotherboard::getBXShiftedCLCT(const CSCCLCTDigi& cLCT) const { return cLCT_shifted; } -void CSCMotherboard::matchShowers(CSCShowerDigi * anode_showers, CSCShowerDigi * cathode_showers, bool andlogic){ - +void CSCMotherboard::matchShowers(CSCShowerDigi* anode_showers, CSCShowerDigi* cathode_showers, bool andlogic) { CSCShowerDigi ashower, cshower; bool used_cshower_mask[CSCConstants::MAX_CLCT_TBINS] = {false}; - for (unsigned bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++){ + for (unsigned bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) { ashower = anode_showers[bx]; - cshower = CSCShowerDigi();//use empty shower digi to initialize cshower - if (ashower.isValid()){ + cshower = CSCShowerDigi(); //use empty shower digi to initialize cshower + if (ashower.isValid()) { for (unsigned mbx = 0; mbx < match_trig_window_size; mbx++) { int cbx = bx + preferred_bx_match_[mbx] - CSCConstants::ALCT_CLCT_OFFSET; //check bx range [0, CSCConstants::MAX_LCT_TBINS] @@ -614,33 +615,41 @@ void CSCMotherboard::matchShowers(CSCShowerDigi * anode_showers, CSCShowerDigi * continue; if (cathode_showers[cbx].isValid() and not used_cshower_mask[cbx]) { cshower = cathode_showers[cbx]; - used_cshower_mask[cbx] = true; + used_cshower_mask[cbx] = true; break; - } + } } - }else cshower = cathode_showers[bx];//if anode shower is not valid, use the cshower from this bx - - //matched HMT, with and/or logic + } else + cshower = cathode_showers[bx]; //if anode shower is not valid, use the cshower from this bx + + //matched HMT, with and/or logic unsigned matchHMT = 0; if (andlogic) { - if (ashower.isTightInTime() and cshower.isTightInTime()) matchHMT = 3; - else if (ashower.isNominalInTime() and cshower.isNominalInTime()) matchHMT = 2; - else if (ashower.isLooseInTime() and cshower.isLooseInTime()) matchHMT = 1; - }else{ - if (ashower.isTightInTime() or cshower.isTightInTime()) matchHMT = 3; - else if (ashower.isNominalInTime() or cshower.isNominalInTime()) matchHMT = 2; - else if (ashower.isLooseInTime() or cshower.isLooseInTime()) matchHMT = 1; + if (ashower.isTightInTime() and cshower.isTightInTime()) + matchHMT = 3; + else if (ashower.isNominalInTime() and cshower.isNominalInTime()) + matchHMT = 2; + else if (ashower.isLooseInTime() and cshower.isLooseInTime()) + matchHMT = 1; + } else { + if (ashower.isTightInTime() or cshower.isTightInTime()) + matchHMT = 3; + else if (ashower.isNominalInTime() or cshower.isNominalInTime()) + matchHMT = 2; + else if (ashower.isLooseInTime() or cshower.isLooseInTime()) + matchHMT = 1; } //LCTShower with showerType = 3 - showers_[bx] = CSCShowerDigi(matchHMT&3, false, ashower.getCSCID(), bx, 3, ashower.getWireNHits(), cshower.getComparatorNHits()); + showers_[bx] = CSCShowerDigi( + matchHMT & 3, false, ashower.getCSCID(), bx, 3, ashower.getWireNHits(), cshower.getComparatorNHits()); } } void CSCMotherboard::encodeHighMultiplicityBits() { // get the high multiplicity // for anode this reflects what is already in the anode CSCShowerDigi object - CSCShowerDigi cathode_showers [CSCConstants::MAX_CLCT_TBINS]; - CSCShowerDigi anode_showers [CSCConstants::MAX_ALCT_TBINS]; + CSCShowerDigi cathode_showers[CSCConstants::MAX_CLCT_TBINS]; + CSCShowerDigi anode_showers[CSCConstants::MAX_ALCT_TBINS]; auto cshowers_v = clctProc->getAllShower(); auto ashowers_v = alctProc->getAllShower(); @@ -665,5 +674,4 @@ void CSCMotherboard::encodeHighMultiplicityBits() { std::copy(std::begin(anode_showers), std::end(anode_showers), std::begin(showers_)); break; }; - } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc index 1fd5eef2bce21..e8b54327aec2c 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc @@ -192,13 +192,13 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, if (checkBadChambers_ && badChambers->isInBadChamber(detid)) continue; - //only process the selected chambers when selectedChambers is not empty - if (!selectedChambers_.empty()) { - if (std::find(selectedChambers_.begin(), selectedChambers_.end(), detid.chamberName()) == - selectedChambers_.end()) { - continue; - } - } + //only process the selected chambers when selectedChambers is not empty + if (!selectedChambers_.empty()) { + if (std::find(selectedChambers_.begin(), selectedChambers_.end(), detid.chamberName()) == + selectedChambers_.end()) { + continue; + } + } const bool upgrade = runPhase2_ and ring == 1; const bool upgradeGE11 = upgrade and stat == 1 and runME11Up_ and runME11ILT_; const bool upgradeGE21 = upgrade and stat == 2 and runME21Up_ and runME21ILT_; @@ -247,9 +247,9 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(pretriggerV, oc_pretrigger, detid, tmb->getCSCName() + " CLCT pre-trigger digi"); put(alctpretriggerV, oc_alctpretrigger, detid, tmb->getCSCName() + " ALCT pre-trigger digi"); - put(shower, oc_shower, detid, tmb->getCSCName()+"TMB shower"); - put(anodeShower, oc_shower_anode, detid, tmb->getCSCName()+"Anode shower"); - put(cathodeShower, oc_shower_cathode, detid, tmb->getCSCName()+"Cathode shower"); + put(shower, oc_shower, detid, tmb->getCSCName() + "TMB shower"); + put(anodeShower, oc_shower_anode, detid, tmb->getCSCName() + "Anode shower"); + put(cathodeShower, oc_shower_cathode, detid, tmb->getCSCName() + "Cathode shower"); //if (shower.isValid()) // oc_shower.insertDigi(detid, shower); //if (anodeShower.isValid())