From 8993969dd5c6e136fc13514900c9cc6cfc8d6577 Mon Sep 17 00:00:00 2001 From: Jannik Geisen <jannik.geisen@cern.ch> Date: Thu, 7 Jan 2021 11:22:02 +0100 Subject: [PATCH] simplifying loops over variables to select on --- .../Jet/JetMonitoring/Root/JetEventSelector.cxx | 15 ++++++--------- .../JetMonitoring/Root/JetSelectorAttribute.cxx | 15 ++++++--------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/Reconstruction/Jet/JetMonitoring/Root/JetEventSelector.cxx b/Reconstruction/Jet/JetMonitoring/Root/JetEventSelector.cxx index d469fcd1d149..a0583cfc9d27 100644 --- a/Reconstruction/Jet/JetMonitoring/Root/JetEventSelector.cxx +++ b/Reconstruction/Jet/JetMonitoring/Root/JetEventSelector.cxx @@ -20,21 +20,18 @@ JetEventSelector:: ~JetEventSelector(){ StatusCode JetEventSelector::initialize() { - unsigned int it=0; - for (auto var : m_var) { - ATH_CHECK(var.retrieve() ); - ATH_MSG_INFO( "Selecting on var ("<< var->varName() << ") in ["<< m_min.at(it) << " , "<< m_max.at(it)<< "]"); - it++; + for (unsigned int it = 0; it < m_var.size(); it++) { + ATH_CHECK(m_var[it].retrieve()); + ATH_MSG_INFO( "Selecting on var ("<< m_var[it]->varName() << ") in ["<< m_min.at(it) << " , "<< m_max.at(it)<< "]"); } return StatusCode::SUCCESS; } int JetEventSelector::keep(const xAOD::EventInfo& e, const xAOD::JetContainer & jets) const { - unsigned int it=0; - for (auto var : m_var) { - float v = var->value(e, jets); + + for (unsigned int it = 0; it < m_var.size(); it++) { + float v = m_var[it]->value(e,jets); if ((m_min.at(it) > v) || (m_max.at(it) < v)) return false; - it++; } return true; } diff --git a/Reconstruction/Jet/JetMonitoring/Root/JetSelectorAttribute.cxx b/Reconstruction/Jet/JetMonitoring/Root/JetSelectorAttribute.cxx index 1105e85f8238..26ca1057e550 100644 --- a/Reconstruction/Jet/JetMonitoring/Root/JetSelectorAttribute.cxx +++ b/Reconstruction/Jet/JetMonitoring/Root/JetSelectorAttribute.cxx @@ -20,21 +20,18 @@ JetSelectorAttribute:: ~JetSelectorAttribute(){ StatusCode JetSelectorAttribute::initialize() { - unsigned int it=0; - for (auto var : m_var) { - ATH_CHECK(var.retrieve() ); - ATH_MSG_INFO( "Selecting on var ("<< var->describe() << ") in ["<< m_min.at(it) << " , "<< m_max.at(it)<< "]"); - it++; + for (unsigned int it = 0; it < m_var.size(); it++) { + ATH_CHECK(m_var[it].retrieve()); + ATH_MSG_INFO( "Selecting on var ("<< m_var[it]->describe() << ") in ["<< m_min.at(it) << " , "<< m_max.at(it)<< "]"); } return StatusCode::SUCCESS; } int JetSelectorAttribute::keep(const xAOD::Jet& jet) const { - unsigned int it=0; - for (auto var : m_var) { - float v = var->value(jet); + + for (unsigned int it = 0; it < m_var.size(); it++) { + float v = m_var[it]->value(jet); if ((m_min.at(it) > v) || (m_max.at(it) < v)) return false; - it++; } return true; } -- GitLab