From a40eda1fa6b3c6d09a8a122f4f724c2c930e4327 Mon Sep 17 00:00:00 2001 From: Marino Missiroli Date: Tue, 29 Aug 2023 11:57:56 +0200 Subject: [PATCH] add support for L1T EtSums of type kZDC{P,M} as trigger objects at HLT --- .../HLTReco/interface/TriggerTypeDefs.h | 3 + HLTrigger/HLTfilters/plugins/HLTL1TSeed.cc | 87 +++++++++++++++++++ HLTrigger/HLTfilters/plugins/HLTL1TSeed.h | 11 ++- 3 files changed, 98 insertions(+), 3 deletions(-) diff --git a/DataFormats/HLTReco/interface/TriggerTypeDefs.h b/DataFormats/HLTReco/interface/TriggerTypeDefs.h index 3059315177583..8d45088ddebab 100644 --- a/DataFormats/HLTReco/interface/TriggerTypeDefs.h +++ b/DataFormats/HLTReco/interface/TriggerTypeDefs.h @@ -74,6 +74,9 @@ namespace trigger { TriggerL1Vertex = -124, // Phase-1: MuonShower TriggerL1MuShower = -125, // stage2 (introduced in Run 3) + // Phase-1: ZDC+ and ZDC- + TriggerL1ZDCP = -126, // stage2 (introduced in 2023 during Run 3) + TriggerL1ZDCM = -127, // stage2 (introduced in 2023 during Run 3) /// HLT TriggerPhoton = +81, diff --git a/HLTrigger/HLTfilters/plugins/HLTL1TSeed.cc b/HLTrigger/HLTfilters/plugins/HLTL1TSeed.cc index 5c8a894c39da9..699a170d60dd6 100644 --- a/HLTrigger/HLTfilters/plugins/HLTL1TSeed.cc +++ b/HLTrigger/HLTfilters/plugins/HLTL1TSeed.cc @@ -56,6 +56,9 @@ HLTL1TSeed::HLTL1TSeed(const edm::ParameterSet& parSet) m_l1EtSumCollectionsTag(parSet.getParameter("L1EtSumInputTag")), // FIX WHEN UNPACKERS ADDED m_l1EtSumTag(m_l1EtSumCollectionsTag), m_l1EtSumToken(consumes(m_l1EtSumTag)), + m_l1EtSumZdcCollectionsTag(parSet.getParameter("L1EtSumZdcInputTag")), // FIX WHEN UNPACKERS ADDED + m_l1EtSumZdcTag(m_l1EtSumZdcCollectionsTag), + m_l1EtSumZdcToken(consumes(m_l1EtSumZdcTag)), m_l1GlobalDecision(false), m_isDebugEnabled(edm::isDebugEnabled()) { if (m_l1SeedsLogicalExpression.empty()) { @@ -104,6 +107,7 @@ void HLTL1TSeed::fillDescriptions(edm::ConfigurationDescriptions& descriptions) desc.add("L1JetInputTag", edm::InputTag("hltGtStage2Digis:Jet")); desc.add("L1TauInputTag", edm::InputTag("hltGtStage2Digis:Tau")); desc.add("L1EtSumInputTag", edm::InputTag("hltGtStage2Digis:EtSum")); + desc.add("L1EtSumZdcInputTag", edm::InputTag("hltGtStage2Digis:EtSumZDC")); descriptions.add("hltL1TSeed", desc); } @@ -131,6 +135,9 @@ bool HLTL1TSeed::hltFilter(edm::Event& iEvent, // etsum filterproduct.addCollectionTag(m_l1EtSumTag); + + // etsum (ZDC) + filterproduct.addCollectionTag(m_l1EtSumZdcTag); } // Get all the seeding from iEvent (i.e. L1TriggerObjectMapRecord) @@ -423,6 +430,36 @@ void HLTL1TSeed::dumpTriggerFilterObjectWithRefs(trigger::TriggerFilterObjectWit LogTrace("HLTL1TSeed") << "\tL1EtSum AsymHtHF: hwPt = " << obj->hwPt(); } + vector seedsL1EtSumZDCP; + filterproduct.getObjects(trigger::TriggerL1ZDCP, seedsL1EtSumZDCP); + const size_t sizeSeedsL1EtSumZDCP = seedsL1EtSumZDCP.size(); + LogTrace("HLTL1TSeed") << "\n L1EtSum ZDCP seeds: " << sizeSeedsL1EtSumZDCP << endl << endl; + + for (size_t i = 0; i != sizeSeedsL1EtSumZDCP; i++) { + l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumZDCP[i]); + + LogTrace("HLTL1TSeed") << "\tL1EtSum ZDCP" + << "\t" + << "pt = " << obj->pt() << "\t" + << "eta = " << obj->eta() << "\t" + << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx(); + } + + vector seedsL1EtSumZDCM; + filterproduct.getObjects(trigger::TriggerL1ZDCM, seedsL1EtSumZDCM); + const size_t sizeSeedsL1EtSumZDCM = seedsL1EtSumZDCM.size(); + LogTrace("HLTL1TSeed") << "\n L1EtSum ZDCM seeds: " << sizeSeedsL1EtSumZDCM << endl << endl; + + for (size_t i = 0; i != sizeSeedsL1EtSumZDCM; i++) { + l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumZDCM[i]); + + LogTrace("HLTL1TSeed") << "\tL1EtSum ZDCM" + << "\t" + << "pt = " << obj->pt() << "\t" + << "eta = " << obj->eta() << "\t" + << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx(); + } + LogTrace("HLTL1TSeed") << " \n\n" << endl; } @@ -463,6 +500,8 @@ bool HLTL1TSeed::seedsL1TriggerObjectMaps(edm::Event& iEvent, trigger::TriggerFi std::list listAsymHt; std::list listAsymEtHF; std::list listAsymHtHF; + std::list listZDCP; + std::list listZDCM; // get handle to unpacked GT edm::Handle uGtAlgoBlocks; @@ -780,6 +819,12 @@ bool HLTL1TSeed::seedsL1TriggerObjectMaps(edm::Event& iEvent, trigger::TriggerFi case l1t::gtAsymmetryHtHF: { listAsymHtHF.push_back(*itObject); } break; + case l1t::gtZDCP: { + listZDCP.push_back(*itObject); + } break; + case l1t::gtZDCM: { + listZDCM.push_back(*itObject); + } break; case l1t::gtCentrality0: case l1t::gtCentrality1: case l1t::gtCentrality2: @@ -885,6 +930,12 @@ bool HLTL1TSeed::seedsL1TriggerObjectMaps(edm::Event& iEvent, trigger::TriggerFi listAsymHtHF.sort(); listAsymHtHF.unique(); + listZDCP.sort(); + listZDCP.unique(); + + listZDCM.sort(); + listZDCM.unique(); + // record the L1 physics objects in the HLT filterproduct // ////////////////////////////////////////////////////// @@ -1075,6 +1126,42 @@ bool HLTL1TSeed::seedsL1TriggerObjectMaps(edm::Event& iEvent, trigger::TriggerFi } // end else + // ZDCP, ZDCM + edm::Handle etsumzdcs; + iEvent.getByToken(m_l1EtSumZdcToken, etsumzdcs); + if (!etsumzdcs.isValid()) { + //!! FIXME: replace LogDebug with edm::LogWarning once unpacker of ZDC inputs to L1-uGT becomes available + //!! https://github.com/cms-sw/cmssw/pull/42634#issuecomment-1698132805 + //!! https://github.com/cms-sw/cmssw/blob/bece38936ef0ba111f4b5f4502e819595560afa6/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GTSetup.cc#L76 + LogDebug("HLTL1TSeed") << "\nWarning: L1EtSumBxCollection with input tag " << m_l1EtSumZdcTag + << "\nrequested in configuration, but not found in the event." + << "\nNo etsums (ZDC) added to filterproduct."; + } else { + l1t::EtSumBxCollection::const_iterator iter; + + for (iter = etsumzdcs->begin(0); iter != etsumzdcs->end(0); ++iter) { + l1t::EtSumRef myref(etsumzdcs, etsumzdcs->key(iter)); + + switch (iter->getType()) { + case l1t::EtSum::kZDCP: + if (!listZDCP.empty()) + filterproduct.addObject(trigger::TriggerL1ZDCP, myref); + break; + case l1t::EtSum::kZDCM: + if (!listZDCM.empty()) + filterproduct.addObject(trigger::TriggerL1ZDCM, myref); + break; + default: + LogTrace("HLTL1TSeed") + << " L1EtSum (ZDC) seed of currently unsuported HLT TriggerType. l1t::EtSum type: " + << iter->getType() << "\n"; + + } // end switch + + } // end for + + } // end else + // TODO FIXME uncomment if block when JetCounts implemented // // jet counts diff --git a/HLTrigger/HLTfilters/plugins/HLTL1TSeed.h b/HLTrigger/HLTfilters/plugins/HLTL1TSeed.h index 6bfbce673254a..e4a3788566c87 100644 --- a/HLTrigger/HLTfilters/plugins/HLTL1TSeed.h +++ b/HLTrigger/HLTfilters/plugins/HLTL1TSeed.h @@ -120,21 +120,26 @@ class HLTL1TSeed : public HLTStreamFilter { edm::InputTag m_l1EGammaTag; edm::EDGetTokenT m_l1EGammaToken; - /// Meta InputTag for L1 Egamma collection + /// Meta InputTag for L1 Jet collection edm::InputTag m_l1JetCollectionsTag; edm::InputTag m_l1JetTag; edm::EDGetTokenT m_l1JetToken; - /// Meta InputTag for L1 Egamma collection + /// Meta InputTag for L1 Tau collection edm::InputTag m_l1TauCollectionsTag; edm::InputTag m_l1TauTag; edm::EDGetTokenT m_l1TauToken; - /// Meta InputTag for L1 Egamma collection + /// Meta InputTag for L1 EtSum collection edm::InputTag m_l1EtSumCollectionsTag; edm::InputTag m_l1EtSumTag; edm::EDGetTokenT m_l1EtSumToken; + /// Meta InputTag for L1 EtSum (ZDC) collection + edm::InputTag m_l1EtSumZdcCollectionsTag; + edm::InputTag m_l1EtSumZdcTag; + edm::EDGetTokenT m_l1EtSumZdcToken; + /// flag to pass if L1TGlobal accept bool m_l1GlobalDecision;