From 5f80200fd73fd1e4b81dcc2d0baed4a62d5c1e91 Mon Sep 17 00:00:00 2001 From: Tim Martin <tim.martin@cern.ch> Date: Wed, 26 Oct 2022 09:30:11 +0200 Subject: [PATCH 1/4] Downgrade missing L1 muon ROIs in MuonCluster to WARNING. Small tidy up of Hypo --- .../src/MuonCluster.cxx | 45 ++++++++---------- .../src/MuonClusterHypoAlg.cxx | 46 +++++++++++++------ 2 files changed, 52 insertions(+), 39 deletions(-) diff --git a/Trigger/TrigAlgorithms/TrigLongLivedParticles/src/MuonCluster.cxx b/Trigger/TrigAlgorithms/TrigLongLivedParticles/src/MuonCluster.cxx index 685cb21d9ece..a07f77247d41 100644 --- a/Trigger/TrigAlgorithms/TrigLongLivedParticles/src/MuonCluster.cxx +++ b/Trigger/TrigAlgorithms/TrigLongLivedParticles/src/MuonCluster.cxx @@ -128,36 +128,31 @@ StatusCode MuonCluster::execute(const EventContext& ctx) const auto roiCollectionHdl = SG::makeHandle(m_roiCollectionKey, ctx); auto roiCollection = roiCollectionHdl.get(); - if ( (roiCollection->size() < 1) ){ //should be the L1 Muon RoI container - ATH_MSG_ERROR("Input TrigRoiDescriptorCollection isn't the correct size! Aborting chain."); - return StatusCode::FAILURE; + if (roiCollection->size() < 2){ //should be the L1 Muon RoI container + ATH_MSG_WARNING("Input TrigRoiDescriptorCollection isn't the correct size! Potential L1 menu inconsitency. Got " << roiCollection->size() << " RoIs"); + return StatusCode::SUCCESS; } ATH_MSG_DEBUG("begin loop on TrigRoiDescriptors and get muon RoIs"); - if(roiCollection->size()==0) { - ATH_MSG_WARNING("Can't get any TrigRoiDescriptor from m_roiCollectionKey!"); - return StatusCode::FAILURE; - } else { - nL1RoIs = roiCollection->size(); - nRoIinClusters = 0; - for (const TrigRoiDescriptor *roi : *roiCollection) - { - if(iter_cl>= kMAX_ROI) { - ATH_MSG_WARNING("Too many L1 Muon RoIs: bailing out"); - break; - } - - RoiEta_mon.push_back(roi->eta()); - RoiPhi_mon.push_back(roi->phi()); - lvl1_muclu_roi my_lvl1_clu_roi; - my_lvl1_clu_roi.eta = roi->eta(); - my_lvl1_clu_roi.phi = roi->phi(); - my_lvl1_clu_roi.nroi = 0; - muonClu[iter_cl] = my_lvl1_clu_roi; - muonClu0[iter_cl] = my_lvl1_clu_roi; - ++iter_cl; + nL1RoIs = roiCollection->size(); + nRoIinClusters = 0; + for (const TrigRoiDescriptor *roi : *roiCollection) + { + if(iter_cl>= kMAX_ROI) { + ATH_MSG_WARNING("Too many L1 Muon RoIs: bailing out"); + break; } + + RoiEta_mon.push_back(roi->eta()); + RoiPhi_mon.push_back(roi->phi()); + lvl1_muclu_roi my_lvl1_clu_roi; + my_lvl1_clu_roi.eta = roi->eta(); + my_lvl1_clu_roi.phi = roi->phi(); + my_lvl1_clu_roi.nroi = 0; + muonClu[iter_cl] = my_lvl1_clu_roi; + muonClu0[iter_cl] = my_lvl1_clu_roi; + ++iter_cl; } int n_cl = iter_cl; diff --git a/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx b/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx index 1d79de3ed4b5..94bd2723a5c8 100644 --- a/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx +++ b/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx @@ -79,6 +79,8 @@ StatusCode MuonClusterHypoAlg::execute(const EventContext& ctx) const auto t1 = Monitored::Timer("TIME_HypoAlg"); auto t2 = Monitored::Timer("TIME_HypoAlg_DecisionLoop"); + t1.start(); + auto mon = Monitored::Group(m_monTool, acceptAll, nRoIEndCap, nRoIBarrel, etaMax, etaMid, CluNum, isPass, t1, t2); if(acceptAll) { @@ -88,46 +90,62 @@ StatusCode MuonClusterHypoAlg::execute(const EventContext& ctx) const ATH_MSG_DEBUG("and endcap muon RoI clusters with |eta| > : " << etaMid << "and >= " <<nRoIEndCap << " RoIs"); } - // I think this imports previous trigger chain decisions, which we'll append to? + // Obtain incoming Decision Objects (one per L1 muon ROI) auto previousDecisionsHandle = SG::makeHandle( decisionInput(), ctx ); ATH_CHECK( previousDecisionsHandle.isValid() ); ATH_MSG_DEBUG( "Running with "<< previousDecisionsHandle->size() <<" previous decisions"); - // New trigger decisions - SG::WriteHandle<DecisionContainer> outputHandle = createAndStore(decisionOutput(), ctx); // Creating a decision output for our HypoTool + // New output trigger decisions container + SG::WriteHandle<DecisionContainer> outputHandle = createAndStore(decisionOutput(), ctx); auto decisions = outputHandle.ptr(); - // Getting previous Decision - const Decision *previousDecision = previousDecisionsHandle->at(0); + if (previousDecisionsHandle->size() == 0) { + ATH_MSG_DEBUG( "No incoming decsion objects, nothing to do"); + return StatusCode::SUCCESS; + } // Get the TrigCompositeContainer linked to the ReadHandleKey // it contains the Muon RoI Cluster information auto compContHdl = SG::makeHandle(m_outputCompositesKey, ctx); auto compCont = compContHdl.get(); + if (compCont->size() == 0) { + ATH_MSG_DEBUG( "No reconstructed muon-roi-cluster summary object, nothing to do"); + return StatusCode::SUCCESS; + } else if (compCont->size() > 1) { + ATH_MSG_ERROR( "This HypoAlg is only expecting exactly one reconstructed muon cluster object, but MuonCluster reconstruction has output " << compCont->size() << ". Cannot currently deal with this."); + return StatusCode::FAILURE; + } + // Creating a DecisionIDContainer to hold all active chain IDs DecisionIDContainer prev; - decisionIDs(previousDecision, prev); - // Create new decisions and link to previous decision - Decision* d = newDecisionIn(decisions, previousDecision, hypoAlgNodeName(), ctx); - linkToPrevious(d, previousDecision, ctx); - decisionIDs(d, prev); // This adds the active chain ID to prev + // Create new output decision object + // as we have only one output physics object ("muCluster") and many inputs (L1 muon ROI) we link multiple parents + Decision* d = newDecisionIn(decisions, hypoAlgNodeName()); + + // Link our physics object ("muCluster") d->setObjectLink( featureString(), ElementLink<xAOD::TrigCompositeContainer>(*compCont, 0, ctx) ); + // Link our parentes (L1 muon ROI) + for (cost Decision* previousDecision : previousDecisionsHandle) { + linkToPrevious(d, previousDecision, ctx); + decisionIDs(previousDecision, prev); // Collate active chains on this L1 ROI (previousDecision) into prev + } + // Creating the DecisionInfo struct to pass to the HypoTool MuonClusterHypoTool::DecisionInfo tool_info{d, compCont, prev}; + t2.start(); for ( auto& tool: m_hypoTools ){ ATH_CHECK( tool->decide(tool_info) ); } + t2.stop(); - ATH_CHECK(hypoBaseOutputProcessing(outputHandle)); - - t2.start(); // We only have 1 decision. If more decisions are needed in the future, wrap 'if' in a loop over the decision container. if (!allFailed(d)) {isPass = 1;} // allFailed returns true is d is empty, else returns false. - t2.stop(); + + ATH_CHECK(hypoBaseOutputProcessing(outputHandle)); return StatusCode::SUCCESS; -- GitLab From 72ee03b6d6e08e72425eb9a1efa389fbfe5a81dc Mon Sep 17 00:00:00 2001 From: Tim Martin <Tim.Martin@cern.ch> Date: Wed, 26 Oct 2022 09:48:53 +0200 Subject: [PATCH 2/4] missing deref --- .../TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx b/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx index 94bd2723a5c8..1526d240a71a 100644 --- a/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx +++ b/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx @@ -128,7 +128,7 @@ StatusCode MuonClusterHypoAlg::execute(const EventContext& ctx) const d->setObjectLink( featureString(), ElementLink<xAOD::TrigCompositeContainer>(*compCont, 0, ctx) ); // Link our parentes (L1 muon ROI) - for (cost Decision* previousDecision : previousDecisionsHandle) { + for (cost Decision* previousDecision : *previousDecisionsHandle) { linkToPrevious(d, previousDecision, ctx); decisionIDs(previousDecision, prev); // Collate active chains on this L1 ROI (previousDecision) into prev } -- GitLab From a8db6ed500dfff4f48a3761b92f08c22440e096b Mon Sep 17 00:00:00 2001 From: Tim Martin <Tim.Martin@cern.ch> Date: Wed, 26 Oct 2022 10:16:13 +0200 Subject: [PATCH 3/4] typo in const --- .../TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx b/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx index 1526d240a71a..47690496028a 100644 --- a/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx +++ b/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx @@ -128,7 +128,7 @@ StatusCode MuonClusterHypoAlg::execute(const EventContext& ctx) const d->setObjectLink( featureString(), ElementLink<xAOD::TrigCompositeContainer>(*compCont, 0, ctx) ); // Link our parentes (L1 muon ROI) - for (cost Decision* previousDecision : *previousDecisionsHandle) { + for (const Decision* previousDecision : *previousDecisionsHandle) { linkToPrevious(d, previousDecision, ctx); decisionIDs(previousDecision, prev); // Collate active chains on this L1 ROI (previousDecision) into prev } -- GitLab From 10dc263105d4b732320fc599bb7a98963fe10441 Mon Sep 17 00:00:00 2001 From: Tim Martin <Tim.Martin@cern.ch> Date: Wed, 26 Oct 2022 17:38:03 +0200 Subject: [PATCH 4/4] Typos --- .../TrigAlgorithms/TrigLongLivedParticles/src/MuonCluster.cxx | 2 +- .../TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Trigger/TrigAlgorithms/TrigLongLivedParticles/src/MuonCluster.cxx b/Trigger/TrigAlgorithms/TrigLongLivedParticles/src/MuonCluster.cxx index a07f77247d41..96c095a7c7de 100644 --- a/Trigger/TrigAlgorithms/TrigLongLivedParticles/src/MuonCluster.cxx +++ b/Trigger/TrigAlgorithms/TrigLongLivedParticles/src/MuonCluster.cxx @@ -129,7 +129,7 @@ StatusCode MuonCluster::execute(const EventContext& ctx) const auto roiCollection = roiCollectionHdl.get(); if (roiCollection->size() < 2){ //should be the L1 Muon RoI container - ATH_MSG_WARNING("Input TrigRoiDescriptorCollection isn't the correct size! Potential L1 menu inconsitency. Got " << roiCollection->size() << " RoIs"); + ATH_MSG_WARNING("Input TrigRoiDescriptorCollection isn't the correct size! Potential L1 menu inconsistency. Got " << roiCollection->size() << " RoIs"); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx b/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx index 47690496028a..07b1e8545280 100644 --- a/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx +++ b/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/MuonClusterHypoAlg.cxx @@ -100,7 +100,7 @@ StatusCode MuonClusterHypoAlg::execute(const EventContext& ctx) const auto decisions = outputHandle.ptr(); if (previousDecisionsHandle->size() == 0) { - ATH_MSG_DEBUG( "No incoming decsion objects, nothing to do"); + ATH_MSG_DEBUG( "No incoming decision objects, nothing to do"); return StatusCode::SUCCESS; } @@ -127,7 +127,7 @@ StatusCode MuonClusterHypoAlg::execute(const EventContext& ctx) const // Link our physics object ("muCluster") d->setObjectLink( featureString(), ElementLink<xAOD::TrigCompositeContainer>(*compCont, 0, ctx) ); - // Link our parentes (L1 muon ROI) + // Link our parents (L1 muon ROI) for (const Decision* previousDecision : *previousDecisionsHandle) { linkToPrevious(d, previousDecision, ctx); decisionIDs(previousDecision, prev); // Collate active chains on this L1 ROI (previousDecision) into prev -- GitLab