From b27cbe21d528d6e1610f98c58c93b76ec3cbab3b Mon Sep 17 00:00:00 2001 From: Tomasz Bold <tomasz.bold@gmail.com> Date: Sun, 2 Oct 2022 20:30:23 +0200 Subject: [PATCH] Enable conversion checking together wiht the conversion Enable conversion checking together wiht the conversion --- .../TrigNavTools/python/NavConverterConfig.py | 16 +++++-- .../TrigNavTools/src/NavigationTesterAlg.cxx | 46 +++++++++++-------- .../TrigNavTools/src/NavigationTesterAlg.h | 8 ++-- 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/Trigger/TrigEvent/TrigNavTools/python/NavConverterConfig.py b/Trigger/TrigEvent/TrigNavTools/python/NavConverterConfig.py index 196567c8f57c..04388b89f49c 100644 --- a/Trigger/TrigEvent/TrigNavTools/python/NavConverterConfig.py +++ b/Trigger/TrigEvent/TrigNavTools/python/NavConverterConfig.py @@ -12,9 +12,7 @@ def NavConverterCfg(flags): """Configures Run 1/2 to Run 3 navigation conversion algorithm for all triggers""" acc = ComponentAccumulator() from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg - tdt_ca = TrigDecisionToolCfg(flags) - tdt = tdt_ca.getPrimary() - acc.merge(tdt_ca) + tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags)) cnvAlg = CompFactory.Run2ToRun3TrigNavConverterV2("TrigRun2ToRun3NavConverter") cnvAlg.TrigDecisionTool = tdt @@ -39,6 +37,18 @@ def NavConverterCfg(flags): cnvAlg.doCompression = True acc.addEventAlgo(cnvAlg) + checker = CompFactory.Trig.NavigationTesterAlg() + checker.RetrievalToolRun2Nav = CompFactory.Trig.IParticleRetrievalTool() + # in conversion job Run2 TDT is setup as default, we need to setup an alternative to access Run 3 format + + run3tdt = CompFactory.Trig.TrigDecisionTool("Run3TrigDecisionTool", + HLTSummary = "HLTNav_R2ToR3Summary", + NavigationFormat = 'TrigComposite', + AcceptMultipleInstance=True) + acc.addPublicTool(run3tdt) + checker.RetrievalToolRun3Nav = CompFactory.Trig.R3IParticleRetrievalTool(TrigDecisionTool = run3tdt) + checker.Chains=['HLT_e26_lhtight_nod0_e15_etcut_L1EM7_Zee', 'HLT_mu4'] #TODO automate this + acc.addEventAlgo(checker) return acc diff --git a/Trigger/TrigEvent/TrigNavTools/src/NavigationTesterAlg.cxx b/Trigger/TrigEvent/TrigNavTools/src/NavigationTesterAlg.cxx index 4801efbbedad..13e1e6dd6f4c 100644 --- a/Trigger/TrigEvent/TrigNavTools/src/NavigationTesterAlg.cxx +++ b/Trigger/TrigEvent/TrigNavTools/src/NavigationTesterAlg.cxx @@ -54,9 +54,8 @@ namespace Trig { StatusCode NavigationTesterAlg::initialize() { - ATH_CHECK(m_tool1.retrieve()); - /*** TODO ***/ - // ATH_CHECK(m_tool2.retrieve()); + ATH_CHECK(m_toolRun2.retrieve()); + ATH_CHECK(m_toolRun3.retrieve()); if (m_chains.size() == 0) ATH_MSG_WARNING("No chains provided, algorithm will be no-op"); return StatusCode::SUCCESS; @@ -76,30 +75,37 @@ namespace Trig { // We don't care about the order of the combinations, or the order within the // combinations, we just care that they are the same. Therefore, we can convert the // vectors to sets and just look at the differences between them - std::vector<std::vector<const xAOD::IParticle *>> vecCombinations1; - /*** TODO ***/ - //std::vector<std::vector<const xAOD::IParticle *>> vecCombinations2; - ATH_MSG_DEBUG("###### CHAIN name " << chain); - ATH_CHECK(m_tool1->retrieveParticles(vecCombinations1, chain)); - auto combs1 = vectorToSet(vecCombinations1); - ATH_MSG_DEBUG("combs1 size " << combs1.size()); - for (auto& c : combs1 ) { + std::vector<std::vector<const xAOD::IParticle *>> vecCombinationsRun2; + ATH_MSG_DEBUG("###### checking features of CHAIN " << chain); + ATH_CHECK(m_toolRun2->retrieveParticles(vecCombinationsRun2, chain)); + auto combsRun2 = vectorToSet(vecCombinationsRun2); + ATH_MSG_DEBUG("Run 2 size " << combsRun2.size()); + for (auto& c : combsRun2 ) { ATH_MSG_DEBUG(c); } - /*** TODO ***/ - // ATH_CHECK(m_tool2->retrieveParticles(vecCombinations2, chain)); - // auto combs2 = vectorToSet(vecCombinations2); - // for (auto& c : combs2 ) { - // ATH_MSG_DEBUG(c); - // } + std::vector<std::vector<const xAOD::IParticle *>> vecCombinationsRun3; + ATH_CHECK(m_toolRun3->retrieveParticles(vecCombinationsRun3, chain)); + auto combsRun3 = vectorToSet(vecCombinationsRun3); + ATH_MSG_DEBUG("Run 3 size " << combsRun3.size()); + for (auto& c : combsRun3 ) { + ATH_MSG_DEBUG(c); + } + if ( combsRun2.size() != combsRun3.size()) { + if ( m_failOnDifference ) { + ATH_MSG_ERROR("Different count of feature accessed from chain " << chain + << " using Run 2 navigation " << combsRun2.size() + << " Run 3 navigation " << combsRun3.size() ); + return StatusCode::FAILURE; + } + } } /*** TODO ***/ - // ATH_CHECK(m_tool2->retrieveParticles(vecCombinations2, chain)); - // std::set<std::set<const xAOD::IParticle *>> combos1 = vectorToSet(vecCombinations1); - // std::set<std::set<const xAOD::IParticle *>> combos2 = vectorToSet(vecCombinations2); + // ATH_CHECK(m_toolRun3->retrieveParticles(vecCombinationsRun3, chain)); + // std::set<std::set<const xAOD::IParticle *>> combos1 = vectorToSet(vecCombinationsRun2); + // std::set<std::set<const xAOD::IParticle *>> combos2 = vectorToSet(vecCombinationsRun3); // ATH_MSG_DEBUG("Tool 1 retrieved " << combos1.size() << " combinations, tool 2 retrieved " << combos2.size()); // std::vector<std::set<const xAOD::IParticle *>> onlyIn1; // std::vector<std::set<const xAOD::IParticle *>> onlyIn2; diff --git a/Trigger/TrigEvent/TrigNavTools/src/NavigationTesterAlg.h b/Trigger/TrigEvent/TrigNavTools/src/NavigationTesterAlg.h index 747953ba2f1a..74790ce280ca 100644 --- a/Trigger/TrigEvent/TrigNavTools/src/NavigationTesterAlg.h +++ b/Trigger/TrigEvent/TrigNavTools/src/NavigationTesterAlg.h @@ -20,10 +20,10 @@ namespace Trig { StatusCode execute() override; private: - ToolHandle<Trig::IIParticleRetrievalTool> m_tool1{ - this, "RetrievalTool1", "", "The first retrieval tool to test"}; - ToolHandle<Trig::IIParticleRetrievalTool> m_tool2{ - this, "RetrievalTool2", "", "The second retrieval tool to test"}; + ToolHandle<Trig::IIParticleRetrievalTool> m_toolRun2{ + this, "RetrievalToolRun2Nav", "", "The tool configured to use Run 2 format"}; + ToolHandle<Trig::IIParticleRetrievalTool> m_toolRun3{ + this, "RetrievalToolRun3Nav", "", "The tool configured for fetching RUn 3 format"}; Gaudi::Property<std::vector<std::string>> m_chains{ this, "Chains", {}, "The chains to test"}; Gaudi::Property<bool> m_failOnDifference{ -- GitLab