From a65dfdc0dda87a1f6d4e24c48be4e36780584a93 Mon Sep 17 00:00:00 2001 From: Aleksandra Poreba <aleksandra.poreba@cern.ch> Date: Fri, 26 Mar 2021 11:12:51 +0000 Subject: [PATCH] TrigCost: reduce EDM size and fix container retrieval --- .../TrigCostAnalysis/src/TrigCostAnalysis.cxx | 3 +- .../Root/AlgToChainTool.cxx | 47 ++++++++++++++----- .../TrigCompositeUtils/AlgToChainTool.h | 10 ++-- .../TrigEDMConfig/python/TriggerEDMRun3.py | 8 +++- 4 files changed, 50 insertions(+), 18 deletions(-) diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.cxx index 1f3e1277a62..ed9506173ff 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.cxx @@ -166,7 +166,8 @@ StatusCode TrigCostAnalysis::execute() { // Save indexes of algorithm in costDataHandle std::map<std::string, std::set<size_t>> chainToAlgIdx; - std::map<std::string, std::vector<TrigConf::Chain>> algToChain = m_algToChainTool->getChainsForAllAlgs(context); + std::map<std::string, std::vector<TrigConf::Chain>> algToChain; + ATH_CHECK( m_algToChainTool->getChainsForAllAlgs(context, algToChain) ); for (const xAOD::TrigComposite* tc : *costDataHandle) { const uint32_t nameHash = tc->getDetail<TrigConf::HLTHash>("alg"); const std::string name = TrigConf::HLTUtils::hash2string(nameHash, "ALG"); diff --git a/Trigger/TrigSteer/TrigCompositeUtils/Root/AlgToChainTool.cxx b/Trigger/TrigSteer/TrigCompositeUtils/Root/AlgToChainTool.cxx index 48bb66a3da2..26c5bcf205c 100644 --- a/Trigger/TrigSteer/TrigCompositeUtils/Root/AlgToChainTool.cxx +++ b/Trigger/TrigSteer/TrigCompositeUtils/Root/AlgToChainTool.cxx @@ -38,6 +38,9 @@ StatusCode TrigCompositeUtils::AlgToChainTool::start() { for ( const auto& sequencer : hltMenuHandle->sequencers() ) { for ( const std::string& algorithm : sequencer.second ) { + // PassFilter is for empty steps - will never be associated with a chain + if (algorithm.find("PassFilter") == 0) continue; + // Save just second part of algorithm ex. RoRSeqFilter/FFastCaloElectron -> FFastCaloElectron m_algToSequencersMap[algorithm.substr(algorithm.find('/') + 1)] .push_back(sequencer.first); @@ -75,14 +78,19 @@ std::vector<TrigConf::Chain> TrigCompositeUtils::AlgToChainTool::getChainsForAlg try { for ( const std::string& sequencer : m_algToSequencersMap.at(algorithmName) ) { - result.insert( - result.end(), - m_sequencerToChainMap.at(sequencer).begin(), - m_sequencerToChainMap.at(sequencer).end() - ); + try { + result.insert( + result.end(), + m_sequencerToChainMap.at(sequencer).begin(), + m_sequencerToChainMap.at(sequencer).end() + ); + } + catch ( const std::out_of_range & ex ) { + ATH_MSG_DEBUG ( "Sequence " << sequencer << " is not part of the menu!" ); + } } } catch ( const std::out_of_range & ex ) { - ATH_MSG_DEBUG ( algorithmName << " is not part of the menu!" ); + ATH_MSG_DEBUG ( "Algorithm " << algorithmName << " is not part of the menu!" ); } return result; @@ -125,10 +133,11 @@ std::set<TrigCompositeUtils::DecisionID> TrigCompositeUtils::AlgToChainTool::ret for ( const std::string& key : keys ) { // Look for given collection - if ( !collectionName.empty() && key.find(collectionName) != 0 ){ + if ( !collectionName.empty() && (key.find(collectionName) != 0) ){ continue; } + // Get data from any nav collection if( collectionName.empty() && (key.find("HLTNav") != 0 || key == "HLTNav_Summary") ) { continue; } @@ -146,14 +155,29 @@ std::set<TrigCompositeUtils::DecisionID> TrigCompositeUtils::AlgToChainTool::ret } -std::map<std::string, std::vector<TrigConf::Chain>> TrigCompositeUtils::AlgToChainTool::getChainsForAllAlgs(const EventContext& context) const { - std::map<std::string, std::vector<TrigConf::Chain>> algToChain; + StatusCode TrigCompositeUtils::AlgToChainTool::getChainsForAllAlgs(const EventContext& context, std::map<std::string, std::vector<TrigConf::Chain>>& algToChain) const { + + SG::ReadHandle<TrigConf::HLTMenu> hltMenuHandle = SG::makeHandle(m_HLTMenuKey, context); + ATH_CHECK(hltMenuHandle.isValid()); + std::map<std::string, std::vector<std::string>> sequencers = hltMenuHandle->sequencers(); // Look for chains which were active for any of the algorithms of the sequence // Name of collection for given sequencer consist sequence's filter's name std::map<std::string, std::set<TrigCompositeUtils::DecisionID>> seqToActiveChains; for (const auto& sequence : m_sequencerToChainMap) { - seqToActiveChains[sequence.first] = retrieveActiveChains(context, "HLTNav_F" + sequence.first + "_"); + // Look for associated filters names with the sequence + const std::vector<std::string>& algorithms = sequencers.at(sequence.first); + for ( const std::string& algorithm : algorithms ) { + if (algorithm.find("FStep") == std::string::npos) continue; + + std::string filterName = "HLTNav_" + algorithm.substr(algorithm.find('/') + 1) + "__"; + // For example RoRSeqFilter/FStep18_Step13_1FSLRTTrigger -> HLTNav_FStep18_Step13_1FSLRTger + if (filterName.find("Trig") != std::string::npos){ + filterName.replace(filterName.find("Trig"), 4, ""); + } + seqToActiveChains[sequence.first] = retrieveActiveChains(context, filterName); + + } } for (const auto& algSeqPair : m_algToSequencersMap){ @@ -173,7 +197,8 @@ std::map<std::string, std::vector<TrigConf::Chain>> TrigCompositeUtils::AlgToCha algToChain[algSeqPair.first] = chainsPerAlg; } - return algToChain; + + return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/TrigCompositeUtils/TrigCompositeUtils/AlgToChainTool.h b/Trigger/TrigSteer/TrigCompositeUtils/TrigCompositeUtils/AlgToChainTool.h index 796f19576e6..08f75cc9304 100644 --- a/Trigger/TrigSteer/TrigCompositeUtils/TrigCompositeUtils/AlgToChainTool.h +++ b/Trigger/TrigSteer/TrigCompositeUtils/TrigCompositeUtils/AlgToChainTool.h @@ -41,22 +41,22 @@ namespace TrigCompositeUtils { virtual StatusCode start() override; - /// Request set of chains' names for given algorithm - static lookup + /// Request set of chains' names for given algorithm - static lookup (menu) std::set<std::string> getChainsNamesForAlg(const std::string& algorithmName) const; - /// Request set of chains for given algorithm - static lookup + /// Request set of chains for given algorithm - static lookup (menu) std::vector<TrigConf::Chain> getChainsForAlg(const std::string& algorithmName) const; - /// Request set of active chains for given algorithm - dynamic lookup + /// Request set of active chains for given algorithm - dynamic lookup (navigation) std::set<std::string> getActiveChainsForAlg(const std::string& algorithmName, const EventContext& context) const; /// Request set of chains for all algorithms in the menu - std::map<std::string, std::vector<TrigConf::Chain>> getChainsForAllAlgs(const EventContext& context) const; + StatusCode getChainsForAllAlgs(const EventContext& context, std::map<std::string, std::vector<TrigConf::Chain>>& algToChain) const; /// Request set of chains from given navigation collection std::set<TrigCompositeUtils::DecisionID> retrieveActiveChains(const EventContext& context, const std::string& collectionName = "") const; - /// Request all chains + /// Request all chains from the menu StatusCode getAllChains(std::vector<TrigConf::Chain>&) const; /// Retrieve chain information for gived chain id diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py index 0a69fe4096e..587f1c42d48 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py @@ -605,7 +605,7 @@ TriggerHLTListRun3 = [ ] # HLTNav_* object list is built dynamically during job configuration, here we only define its output targets -HLTNavEDMTargets = 'BS CostMonDS ESD AODFULL AODSLIM' +HLTNavEDMTargets = 'BS ESD AODFULL AODSLIM' #------------------------------------------------------------------------------- # EDM details list to store the transient-persistent version @@ -665,6 +665,12 @@ def addHLTNavigationToEDMList(edmList, allDecisions, hypoDecisions): (typeName, HLTNavEDMTargets, 'Steer'), (typeNameAux, HLTNavEDMTargets, 'Steer')]) + # Cost stream requires only filters and L1 seeded chains + if decisionCollection.startswith("HLTNav_FStep") or decisionCollection == "HLTNav_Summary" or decisionCollection.startswith("HLTNav_L1"): + edmList.extend([ + (typeName, 'CostMonDS', 'Steer'), + (typeNameAux, 'CostMonDS', 'Steer')]) + def addExtraCollectionsToEDMList(edmList, extraList): """ Extend edmList with extraList, keeping track whether a completely new -- GitLab