From 5d57693e289e2a6f2e4fc29efe00940c6a56ae6f Mon Sep 17 00:00:00 2001 From: Elisa Fontanesi Date: Fri, 31 Mar 2023 18:06:25 +0200 Subject: [PATCH] Adding 2Loose HMT showers in the GT emulator --- .../L1TGlobal/interface/MuonShowerTemplate.h | 1 + .../L1TGlobal/plugins/TriggerMenuParser.cc | 3 + L1Trigger/L1TGlobal/src/GlobalBoard.cc | 82 +++++++++++-------- .../L1TGlobal/src/MuonShowerCondition.cc | 17 +++- L1Trigger/L1TGlobal/src/MuonShowerTemplate.cc | 1 + 5 files changed, 65 insertions(+), 39 deletions(-) diff --git a/L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h b/L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h index fbaacc6ffa2c7..cf397d43746c0 100644 --- a/L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h +++ b/L1Trigger/L1TGlobal/interface/MuonShowerTemplate.h @@ -47,6 +47,7 @@ class MuonShowerTemplate : public GlobalCondition { struct ObjectParameter { bool MuonShower0; bool MuonShower1; + bool MuonShower2; bool MuonShowerOutOfTime0; bool MuonShowerOutOfTime1; }; diff --git a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc index 596ec01b3a292..2cbe76a101dec 100644 --- a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc +++ b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc @@ -312,6 +312,7 @@ void l1t::TriggerMenuParser::parseCondFormats(const L1TUtmTriggerMenu* utmMenu) } else if (condition.getType() == esConditionType::MuonShower0 || condition.getType() == esConditionType::MuonShower1 || + condition.getType() == esConditionType::MuonShower2 || condition.getType() == esConditionType::MuonShowerOutOfTime0 || condition.getType() == esConditionType::MuonShowerOutOfTime1) { parseMuonShower(condition, chipNr, false); @@ -1577,6 +1578,8 @@ bool l1t::TriggerMenuParser::parseMuonShower(tmeventsetup::esCondition condMu, objParameter[0].MuonShower0 = true; } else if (condMu.getType() == esConditionType::MuonShower1) { objParameter[0].MuonShower1 = true; + } else if (condMu.getType() == esConditionType::MuonShower2) { + objParameter[0].MuonShower2 = true; } else if (condMu.getType() == esConditionType::MuonShowerOutOfTime0) { objParameter[0].MuonShowerOutOfTime0 = true; } else if (condMu.getType() == esConditionType::MuonShowerOutOfTime1) { diff --git a/L1Trigger/L1TGlobal/src/GlobalBoard.cc b/L1Trigger/L1TGlobal/src/GlobalBoard.cc index 6939665a56ba4..8d413783b8d61 100644 --- a/L1Trigger/L1TGlobal/src/GlobalBoard.cc +++ b/L1Trigger/L1TGlobal/src/GlobalBoard.cc @@ -14,7 +14,8 @@ * \author: E. Fontanesi - extended for three-body correlation conditions * * \author: E. Fontanesi, E. Yigitbasi, A. Loeliger (original implementation by S. Dildick, 2021) - * - fix for the muon shower triggers + * - fix for the muon shower triggers and check on all BXs + * \author: E. Fontanesi - added 2Loose HMT for 2023 Run 3 * * $Date$ * $Revision$ @@ -379,41 +380,52 @@ void l1t::GlobalBoard::receiveMuonShowerObjectData(const edm::Event& iEvent, << "\nrequested in configuration, but not found in the event.\n"; } } else { - // Loop over Muon Showers in this bx - int nObj = 0; - for (auto mu = muonData->begin(0); mu != muonData->end(0); ++mu) { - if (nObj < nrL1MuShower) { - /* NOTE: here the single object is split up into 4 separate MuonShower objects - similarly to the description in the UTM library, where the conditions are four different objects. - */ - - std::shared_ptr musOneNominalInTime = - std::make_shared(false, false, false, false, false, false); - std::shared_ptr musOneTightInTime = - std::make_shared(false, false, false, false, false, false); - std::shared_ptr musOutOfTime0 = - std::make_shared(false, false, false, false, false, false); - std::shared_ptr musOutOfTime1 = - std::make_shared(false, false, false, false, false, false); - - musOneNominalInTime->setOneNominalInTime(mu->isOneNominalInTime()); - musOneTightInTime->setOneTightInTime(mu->isOneTightInTime()); - musOutOfTime0->setMusOutOfTime0(mu->musOutOfTime0()); - musOutOfTime1->setMusOutOfTime1(mu->musOutOfTime1()); - - (*m_candL1MuShower).push_back(0, musOneNominalInTime); - (*m_candL1MuShower).push_back(0, musOneTightInTime); - (*m_candL1MuShower).push_back(0, musOutOfTime0); - (*m_candL1MuShower).push_back(0, musOutOfTime1); + // Loop over bx in muon data + for (int i = muonData->getFirstBX(); i <= muonData->getLastBX(); ++i) { + // Prevent from pushing back bx that is outside of allowed range + if (i < m_bxFirst_ || i > m_bxLast_) + continue; - } else { - edm::LogWarning("L1TGlobal") << " Too many Muon Showers (" << nObj - << ") for uGT Configuration maxMuShower =" << nrL1MuShower; - } - nObj++; - } //end loop over muon showers in bx - } //end if over valid muon shower data - } //end if ReceiveMuonShower data + // Loop over Muon Showers in this bx + int nObj = 0; + for (std::vector::const_iterator mu = muonData->begin(i); mu != muonData->end(i); ++mu) { + if (nObj < nrL1MuShower) { + /* NOTE: here the single object is split up into 5 separate MuonShower objects + similarly to the description in the UTM library, where the conditions are four different objects. + */ + + std::shared_ptr musOneNominalInTime = + std::make_shared(false, false, false, false, false, false); + std::shared_ptr musOneTightInTime = + std::make_shared(false, false, false, false, false, false); + std::shared_ptr musTwoLooseDiffSectorsInTime = + std::make_shared(false, false, false, false, false, false); + std::shared_ptr musOutOfTime0 = + std::make_shared(false, false, false, false, false, false); + std::shared_ptr musOutOfTime1 = + std::make_shared(false, false, false, false, false, false); + + musOneNominalInTime->setOneNominalInTime(mu->isOneNominalInTime()); + musOneTightInTime->setOneTightInTime(mu->isOneTightInTime()); + musTwoLooseDiffSectorsInTime->setTwoLooseDiffSectorsInTime(mu->isTwoLooseDiffSectorsInTime()); + musOutOfTime0->setMusOutOfTime0(mu->musOutOfTime0()); + musOutOfTime1->setMusOutOfTime1(mu->musOutOfTime1()); + + (*m_candL1MuShower).push_back(i, musOneNominalInTime); + (*m_candL1MuShower).push_back(i, musOneTightInTime); + (*m_candL1MuShower).push_back(i, musTwoLooseDiffSectorsInTime); + (*m_candL1MuShower).push_back(i, musOutOfTime0); + (*m_candL1MuShower).push_back(i, musOutOfTime1); + + } else { + edm::LogWarning("L1TGlobal") << " Too many Muon Showers (" << nObj + << ") for uGT Configuration maxMuShower =" << nrL1MuShower; + } + nObj++; + } //end loop over muon showers in bx + } //end loop over bx + } //end if over valid muon shower data + } //end if ReceiveMuonShower data } // receive data from Global External Conditions diff --git a/L1Trigger/L1TGlobal/src/MuonShowerCondition.cc b/L1Trigger/L1TGlobal/src/MuonShowerCondition.cc index 7c906c3661c90..26ae269e344d2 100644 --- a/L1Trigger/L1TGlobal/src/MuonShowerCondition.cc +++ b/L1Trigger/L1TGlobal/src/MuonShowerCondition.cc @@ -7,14 +7,16 @@ * Implementation: * This condition class checks for the presente of a valid muon shower in the event. * If present, according to the condition parsed by the xml menu - * (four possibilities for the first Run 3 implementation: MuonShower0, MuonShower1, MuonShowerOutOfTime0, MuonShowerOutOfTime1) - * the corresponding boolean flag is checked (isOneNominalInTime, isOneTightInTime, musOutOfTime0, musOutOfTime1). + * (five possibilities for the 2023 Run 3 implementation: MuonShower0, MuonShower1, MuonShower2, MuonShowerOutOfTime0, MuonShowerOutOfTime1) + * the corresponding boolean flag is checked (isOneNominalInTime, isOneTightInTime, isTwoLooseDiffSectorsInTime, musOutOfTime0, musOutOfTime1). * If it is set to 1, the condition is satisfied and the object is saved. - * Note that for the start of Run 3 only two cases are considered in the menu: Nominal and Tight muon showers. + * Note that for the start of Run 3 only two cases were considered in the menu: Nominal and Tight muon showers, + * an additional case is added for the 2023 data-taking: TwoLooseDiffSectors muon showers. * * \author: S. Dildick (2021) - Rice University * * \fixes by: E. Fontanesi, E. Yigitbasi, A. Loeliger (2023) + * \adding TwoLooseDiffSectors HMT: E. Fontanesi * */ @@ -177,12 +179,14 @@ const bool l1t::MuonShowerCondition::checkObjectParameter(const int iCondition, LogDebug("L1TGlobal") << "\n MuonShowerTemplate::ObjectParameter (utm objects, checking which condition is parsed): " << std::hex << "\n\t MuonShower0 = 0x " << objPar.MuonShower0 << "\n\t MuonShower1 = 0x " - << objPar.MuonShower1 << "\n\t MuonShowerOutOfTime0 = 0x " << objPar.MuonShowerOutOfTime0 + << objPar.MuonShower1 << "\n\t MuonShower2 = 0x " << objPar.MuonShower2 + << "\n\t MuonShowerOutOfTime0 = 0x " << objPar.MuonShowerOutOfTime0 << "\n\t MuonShowerOutOfTime1 = 0x " << objPar.MuonShowerOutOfTime1 << std::endl; LogDebug("L1TGlobal") << "\n l1t::MuonShower (uGT emulator bits): " << "\n\t MuonShower0: isOneNominalInTime() = " << cand.isOneNominalInTime() << "\n\t MuonShower1: isOneTightInTime() = " << cand.isOneTightInTime() + << "\n\t MuonShower2: isTwoLooseDiffSectorsInTime() = " << cand.isTwoLooseDiffSectorsInTime() << "\n\t MuonShowerOutOfTime0: musOutOfTime0() = " << cand.musOutOfTime0() << "\n\t MuonShowerOutOfTime1: musOutOfTime1() = " << cand.musOutOfTime1() << std::endl; @@ -196,6 +200,11 @@ const bool l1t::MuonShowerCondition::checkObjectParameter(const int iCondition, LogDebug("L1TGlobal") << "\t\t MuonShower failed MuonShower1 requirement" << std::endl; return false; } + // Check twoLooseInTime + if (cand.isTwoLooseDiffSectorsInTime() != objPar.MuonShower2) { + LogDebug("L1TGlobal") << "\t\t MuonShower failed MuonShower2 requirement" << std::endl; + return false; + } if (cand.musOutOfTime0() != objPar.MuonShowerOutOfTime0) { LogDebug("L1TGlobal") << "\t\t MuonShower failed MuonShowerOutOfTime0 requirement" << std::endl; return false; diff --git a/L1Trigger/L1TGlobal/src/MuonShowerTemplate.cc b/L1Trigger/L1TGlobal/src/MuonShowerTemplate.cc index 11c323d81e0ee..9314ba7f39b64 100644 --- a/L1Trigger/L1TGlobal/src/MuonShowerTemplate.cc +++ b/L1Trigger/L1TGlobal/src/MuonShowerTemplate.cc @@ -54,6 +54,7 @@ void MuonShowerTemplate::print(std::ostream& myCout) const { myCout << " Template for object " << i << " [ hex ]" << std::endl; myCout << " MuonShower0 = " << std::hex << m_objectParameter[i].MuonShower0 << std::endl; myCout << " MuonShower1 = " << std::hex << m_objectParameter[i].MuonShower1 << std::endl; + myCout << " MuonShower2 = " << std::hex << m_objectParameter[i].MuonShower2 << std::endl; myCout << " MuonShowerOutOfTime0 = " << std::hex << m_objectParameter[i].MuonShowerOutOfTime0 << std::endl; myCout << " MuonShowerOutOfTime1 = " << std::hex << m_objectParameter[i].MuonShowerOutOfTime1 << std::endl; }