From c9cdec538bb9821f27430d90bddf6276b416180d Mon Sep 17 00:00:00 2001 From: Giovanni Marchiori Date: Thu, 29 Aug 2024 10:05:00 +0200 Subject: [PATCH] simplify code --- .../src/components/CalibrateCaloClusters.cpp | 15 +++++---------- .../src/components/PhotonIDTool.cpp | 14 ++++---------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/RecFCCeeCalorimeter/src/components/CalibrateCaloClusters.cpp b/RecFCCeeCalorimeter/src/components/CalibrateCaloClusters.cpp index 6ca93ff..d48ba83 100644 --- a/RecFCCeeCalorimeter/src/components/CalibrateCaloClusters.cpp +++ b/RecFCCeeCalorimeter/src/components/CalibrateCaloClusters.cpp @@ -173,23 +173,18 @@ StatusCode CalibrateCaloClusters::finalize() if (m_ortEnv) delete m_ortEnv; - for (std::size_t i = 0; i < m_input_names.size(); i++) { - if (m_input_names.at(i)) { - delete m_input_names.at(i); - } + for (auto& name : m_input_names) { + delete name; } - m_input_names.resize(0); - for (std::size_t i = 0; i < m_output_names.size(); i++) { - if (m_output_names.at(i)) { - delete m_output_names.at(i); - } + for (auto& name : m_output_names) { + delete name; } - m_output_names.resize(0); return Gaudi::Algorithm::finalize(); } + edm4hep::ClusterCollection *CalibrateCaloClusters::initializeOutputClusters( const edm4hep::ClusterCollection *inClusters) const { diff --git a/RecFCCeeCalorimeter/src/components/PhotonIDTool.cpp b/RecFCCeeCalorimeter/src/components/PhotonIDTool.cpp index 6473708..8a713cc 100644 --- a/RecFCCeeCalorimeter/src/components/PhotonIDTool.cpp +++ b/RecFCCeeCalorimeter/src/components/PhotonIDTool.cpp @@ -138,19 +138,13 @@ StatusCode PhotonIDTool::finalize() if (m_ortEnv) delete m_ortEnv; - for (std::size_t i = 0; i < m_input_names.size(); i++) { - if (m_input_names.at(i)) { - delete m_input_names.at(i); - } + for (auto& name : m_input_names) { + delete name; } - m_input_names.resize(0); - for (std::size_t i = 0; i < m_output_names.size(); i++) { - if (m_output_names.at(i)) { - delete m_output_names.at(i); - } + for (auto& name : m_output_names) { + delete name; } - m_output_names.resize(0); return Gaudi::Algorithm::finalize(); }