From 32ba966cc03a823367a2e3f31901b620c5ececd2 Mon Sep 17 00:00:00 2001 From: Bernhard Arnold Date: Fri, 31 Mar 2023 13:12:43 +0200 Subject: [PATCH 1/2] added muon index --- .../L1TGlobal/interface/ConditionEvaluation.h | 21 ++++++++++++++++ L1Trigger/L1TGlobal/interface/MuonTemplate.h | 7 ++++++ .../L1TGlobal/plugins/TriggerMenuParser.cc | 24 +++++++++++++++++++ L1Trigger/L1TGlobal/src/MuCondition.cc | 6 +++++ 4 files changed, 58 insertions(+) diff --git a/L1Trigger/L1TGlobal/interface/ConditionEvaluation.h b/L1Trigger/L1TGlobal/interface/ConditionEvaluation.h index 0d41adebb6eb5..014ddd276ce49 100644 --- a/L1Trigger/L1TGlobal/interface/ConditionEvaluation.h +++ b/L1Trigger/L1TGlobal/interface/ConditionEvaluation.h @@ -142,6 +142,11 @@ namespace l1t { const Type1& lowerR, const Type1& upperR) const; + /// check if a value is in a given range + template + const bool checkRangeTfMuonIndex(const unsigned int bitNumber, + const std::vector& windows) const; + protected: /// maximum number of objects received for the evaluation of the condition /// usually retrieved from event setup @@ -504,5 +509,21 @@ namespace l1t { } } + template + const bool ConditionEvaluation::checkRangeTfMuonIndex(const unsigned int value, + const std::vector& windows) const { + if (windows.empty()) { + return true; + } + + for (const auto& window : windows) { + if ((window.lower <= value) and (value <= window.upper)) { + return true; + } + } + + return false; + } + } // namespace l1t #endif diff --git a/L1Trigger/L1TGlobal/interface/MuonTemplate.h b/L1Trigger/L1TGlobal/interface/MuonTemplate.h index 4b04285f4d8d1..7708675993b4f 100644 --- a/L1Trigger/L1TGlobal/interface/MuonTemplate.h +++ b/L1Trigger/L1TGlobal/interface/MuonTemplate.h @@ -51,6 +51,11 @@ class MuonTemplate : public GlobalCondition { MuonTemplate& operator=(const MuonTemplate&); public: + struct Window { + unsigned int lower; + unsigned int upper; + }; + // typedef for a single object template struct ObjectParameter { unsigned int unconstrainedPtHigh; @@ -82,6 +87,8 @@ class MuonTemplate : public GlobalCondition { unsigned int phiWindow1Upper; unsigned int phiWindow2Lower; unsigned int phiWindow2Upper; + + std::vector tfMuonIndexWindows; }; // typedef for correlation parameters diff --git a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc index 8412723763e98..c08d57240e36b 100644 --- a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc +++ b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc @@ -1146,6 +1146,8 @@ bool l1t::TriggerMenuParser::parseMuon(L1TUtmCondition condMu, unsigned int chip int charge = -1; //default value is to ignore unless specified int qualityLUT = 0xFFFF; //default is to ignore unless specified. + std::vector tfMuonIndexWindows; + const std::vector& cuts = object.getCuts(); for (size_t kk = 0; kk < cuts.size(); kk++) { const L1TUtmCut& cut = cuts.at(kk); @@ -1221,6 +1223,14 @@ bool l1t::TriggerMenuParser::parseMuon(L1TUtmCondition condMu, unsigned int chip isolationLUT = l1tstr2int(cut.getData()); } break; + + case esCutType::Index: { + tfMuonIndexWindows.push_back({ + cut.getMinimum().index, + cut.getMaximum().index + }); + } break; + default: break; } //end switch @@ -1259,6 +1269,8 @@ bool l1t::TriggerMenuParser::parseMuon(L1TUtmCondition condMu, unsigned int chip objParameter[cnt].qualityLUT = qualityLUT; objParameter[cnt].isolationLUT = isolationLUT; + objParameter[cnt].tfMuonIndexWindows = tfMuonIndexWindows; + cnt++; } //end loop over objects @@ -1378,6 +1390,8 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const L1TUtmObject* corrMu, unsigned int charge = -1; //defaut is to ignore unless specified int qualityLUT = 0xFFFF; //default is to ignore unless specified. + std::vector tfMuonIndexWindows; + const std::vector& cuts = corrMu->getCuts(); for (size_t kk = 0; kk < cuts.size(); kk++) { const L1TUtmCut& cut = cuts.at(kk); @@ -1453,6 +1467,14 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const L1TUtmObject* corrMu, unsigned isolationLUT = l1tstr2int(cut.getData()); } break; + + case esCutType::Index: { + tfMuonIndexWindows.push_back({ + cut.getMinimum().index, + cut.getMaximum().index + }); + } break; + default: break; } //end switch @@ -1491,6 +1513,8 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const L1TUtmObject* corrMu, unsigned objParameter[0].qualityLUT = qualityLUT; objParameter[0].isolationLUT = isolationLUT; + objParameter[0].tfMuonIndexWindows = tfMuonIndexWindows; + // object types - all muons std::vector objType(nrObj, gtMu); diff --git a/L1Trigger/L1TGlobal/src/MuCondition.cc b/L1Trigger/L1TGlobal/src/MuCondition.cc index 1a7803fa77e8c..7590185093dc2 100644 --- a/L1Trigger/L1TGlobal/src/MuCondition.cc +++ b/L1Trigger/L1TGlobal/src/MuCondition.cc @@ -487,6 +487,12 @@ const bool l1t::MuCondition::checkObjectParameter(const int iCondition, return false; } + // check muon TF index + if (!checkRangeTfMuonIndex(cand.tfMuonIndex(), objPar.tfMuonIndexWindows)) { + LogDebug("L1TGlobal") << "\t\t l1t::Candidate failed checkRange(tfMuonIndex)" << std::endl; + return false; + } + // A number of values is required to trigger (at least one). // "Don't care" means that all values are allowed. // Qual = 000 means then NO MUON (GTL module) From 9a77855b39c5b765c0d707d54d24b9487e7d685d Mon Sep 17 00:00:00 2001 From: Bernhard Arnold Date: Thu, 6 Apr 2023 10:40:03 +0200 Subject: [PATCH 2/2] updated record dump --- L1Trigger/L1TGlobal/plugins/GtRecordDump.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/L1Trigger/L1TGlobal/plugins/GtRecordDump.cc b/L1Trigger/L1TGlobal/plugins/GtRecordDump.cc index abe73285169d6..219e729884c2e 100644 --- a/L1Trigger/L1TGlobal/plugins/GtRecordDump.cc +++ b/L1Trigger/L1TGlobal/plugins/GtRecordDump.cc @@ -861,6 +861,7 @@ namespace l1t { packedVal |= ((cms_uint64_t)(mu->hwCharge() & 0x1) << 34); // & 0x1) <<29); packedVal |= ((cms_uint64_t)(mu->hwQual() & 0xf) << 19); // & 0xf) <<30); packedVal |= ((cms_uint64_t)(mu->hwIso() & 0x3) << 32); // & 0x3) <<34); + packedVal |= ((cms_uint64_t)(mu->tfMuonIndex() & 0x7f) << 36); // if (false) { // for debugging purposes // std::cout << "----------------------" << std::endl;