From ddd3ff32aec0e56e8e9b9d774dc417386a87d352 Mon Sep 17 00:00:00 2001
From: Mateusz Jakub Fila <37295697+m-fila@users.noreply.github.com>
Date: Mon, 2 Sep 2024 19:26:38 +0200
Subject: [PATCH] fix virtual specifiers, remove redundant methods, unclutter
 (#228)

---
 k4FWCore/components/CollectionMerger.cpp            |  2 +-
 k4FWCore/components/EventHeaderCreator.cpp          | 12 ------------
 k4FWCore/components/EventHeaderCreator.h            |  4 +---
 k4FWCore/components/FCCDataSvc.cpp                  |  3 ---
 k4FWCore/components/FCCDataSvc.h                    |  3 ---
 k4FWCore/components/IOSvc.h                         |  2 --
 k4FWCore/components/MetadataSvc.cpp                 |  6 ++++--
 k4FWCore/components/MetadataSvc.h                   |  2 --
 k4FWCore/components/PodioOutput.h                   |  6 +++---
 k4FWCore/components/Reader.cpp                      |  2 +-
 k4FWCore/components/k4DataSvc.cpp                   |  3 ---
 k4FWCore/components/k4DataSvc.h                     |  3 ---
 k4FWCore/include/k4FWCore/Consumer.h                |  2 +-
 k4FWCore/include/k4FWCore/DataHandle.h              |  7 ++-----
 k4FWCore/include/k4FWCore/DataWrapper.h             | 11 +++++------
 k4FWCore/include/k4FWCore/IMetadataSvc.h            |  4 +++-
 k4FWCore/include/k4FWCore/KeepDropSwitch.h          |  4 ++--
 k4FWCore/include/k4FWCore/MetaDataHandle.h          |  3 ---
 k4FWCore/include/k4FWCore/PodioDataSvc.h            |  6 +-----
 k4FWCore/include/k4FWCore/Transformer.h             |  4 ++--
 k4FWCore/src/KeepDropSwitch.cpp                     |  9 ++++-----
 k4FWCore/src/PodioDataSvc.cpp                       | 13 +++++--------
 k4Interface/include/k4Interface/IGeoSvc.h           |  1 -
 k4Interface/include/k4Interface/ITowerTool.h        |  2 --
 .../include/k4Interface/ITowerToolThetaModule.h     |  2 --
 .../src/components/ExampleEventHeaderConsumer.cpp   |  2 +-
 .../src/components/TestUniqueIDGenSvc.cpp           |  4 ----
 .../src/components/TestUniqueIDGenSvc.h             |  9 ++-------
 .../components/k4FWCoreTest_AlgorithmWithTFile.cpp  |  2 --
 .../components/k4FWCoreTest_AlgorithmWithTFile.h    |  7 +++----
 .../k4FWCoreTest_CheckExampleEventData.cpp          |  4 ----
 .../components/k4FWCoreTest_CheckExampleEventData.h | 10 +---------
 .../k4FWCoreTest_CreateExampleEventData.cpp         | 11 -----------
 .../k4FWCoreTest_CreateExampleEventData.h           | 11 +----------
 .../src/components/k4FWCoreTest_HelloWorldAlg.cpp   | 11 -----------
 .../src/components/k4FWCoreTest_HelloWorldAlg.h     | 11 +----------
 .../src/components/k4FWCoreTest_cellID_reader.cpp   | 11 -----------
 .../src/components/k4FWCoreTest_cellID_reader.h     | 11 +----------
 .../src/components/k4FWCoreTest_cellID_writer.cpp   |  4 ----
 .../src/components/k4FWCoreTest_cellID_writer.h     |  9 ++-------
 40 files changed, 47 insertions(+), 186 deletions(-)

diff --git a/k4FWCore/components/CollectionMerger.cpp b/k4FWCore/components/CollectionMerger.cpp
index 5909100a..af4da585 100644
--- a/k4FWCore/components/CollectionMerger.cpp
+++ b/k4FWCore/components/CollectionMerger.cpp
@@ -121,7 +121,7 @@ struct CollectionMerger final : k4FWCore::Transformer<std::shared_ptr<podio::Col
   void mergeCollections(const std::shared_ptr<podio::CollectionBase>& source,
                         std::shared_ptr<podio::CollectionBase>&       ret) const {
     if (!ret) {
-      ret.reset(new T());
+      ret = std::make_shared<T>();
       if (!m_copy) {
         ret->setSubsetCollection();
       }
diff --git a/k4FWCore/components/EventHeaderCreator.cpp b/k4FWCore/components/EventHeaderCreator.cpp
index 7e84c6b3..1326e62a 100644
--- a/k4FWCore/components/EventHeaderCreator.cpp
+++ b/k4FWCore/components/EventHeaderCreator.cpp
@@ -26,12 +26,6 @@ EventHeaderCreator::EventHeaderCreator(const std::string& name, ISvcLocator* svc
                   "Name of the EventHeaderCollection that will be stored in the output root file.");
 }
 
-StatusCode EventHeaderCreator::initialize() {
-  if (Gaudi::Algorithm::initialize().isFailure())
-    return StatusCode::FAILURE;
-  return StatusCode::SUCCESS;
-}
-
 StatusCode EventHeaderCreator::execute(const EventContext&) const {
   static int eventNumber = 0;
   debug() << "Filling EventHeader with runNumber " << int(m_runNumber) << " and eventNumber "
@@ -42,9 +36,3 @@ StatusCode EventHeaderCreator::execute(const EventContext&) const {
   header.setEventNumber(eventNumber++ + m_eventNumberOffset);
   return StatusCode::SUCCESS;
 }
-
-StatusCode EventHeaderCreator::finalize() {
-  if (Gaudi::Algorithm::finalize().isFailure())
-    return StatusCode::FAILURE;
-  return StatusCode::SUCCESS;
-}
diff --git a/k4FWCore/components/EventHeaderCreator.h b/k4FWCore/components/EventHeaderCreator.h
index ccebe12e..a3b4dc40 100644
--- a/k4FWCore/components/EventHeaderCreator.h
+++ b/k4FWCore/components/EventHeaderCreator.h
@@ -34,9 +34,7 @@ class EventHeaderCreator : public Gaudi::Algorithm {
 public:
   EventHeaderCreator(const std::string& name, ISvcLocator* svcLoc);
 
-  StatusCode initialize();
-  StatusCode execute(const EventContext&) const;
-  StatusCode finalize();
+  StatusCode execute(const EventContext&) const override;
 
 private:
   // Run number value (fixed for the entire job, to be set by the job submitter)
diff --git a/k4FWCore/components/FCCDataSvc.cpp b/k4FWCore/components/FCCDataSvc.cpp
index c7d46fd9..088bd07e 100644
--- a/k4FWCore/components/FCCDataSvc.cpp
+++ b/k4FWCore/components/FCCDataSvc.cpp
@@ -28,6 +28,3 @@ FCCDataSvc::FCCDataSvc(const std::string& name, ISvcLocator* svc) : PodioDataSvc
   declareProperty("inputs", m_filenames = {}, "Names of the files to read");
   declareProperty("input", m_filename = "", "Name of the file to read");
 }
-
-/// Standard Destructor
-FCCDataSvc::~FCCDataSvc() {}
diff --git a/k4FWCore/components/FCCDataSvc.h b/k4FWCore/components/FCCDataSvc.h
index ba7557d5..f1fc46ab 100644
--- a/k4FWCore/components/FCCDataSvc.h
+++ b/k4FWCore/components/FCCDataSvc.h
@@ -27,8 +27,5 @@ class FCCDataSvc : public PodioDataSvc {
 public:
   /// Standard Constructor
   FCCDataSvc(const std::string& name, ISvcLocator* svc);
-
-  /// Standard Destructor
-  virtual ~FCCDataSvc();
 };
 #endif
diff --git a/k4FWCore/components/IOSvc.h b/k4FWCore/components/IOSvc.h
index fe23352e..25890c84 100644
--- a/k4FWCore/components/IOSvc.h
+++ b/k4FWCore/components/IOSvc.h
@@ -40,8 +40,6 @@ class IOSvc : public extends<Service, IIOSvc, IIncidentListener> {
   using extends::extends;
 
 public:
-  ~IOSvc() override = default;
-
   StatusCode initialize() override;
   StatusCode finalize() override;
 
diff --git a/k4FWCore/components/MetadataSvc.cpp b/k4FWCore/components/MetadataSvc.cpp
index 9c0b82f5..a0da7928 100644
--- a/k4FWCore/components/MetadataSvc.cpp
+++ b/k4FWCore/components/MetadataSvc.cpp
@@ -25,6 +25,8 @@
 #include <GaudiKernel/IDataProviderSvc.h>
 #include <GaudiKernel/Service.h>
 
+#include <memory>
+
 StatusCode MetadataSvc::initialize() {
   StatusCode sc = Service::initialize();
   if (sc.isFailure()) {
@@ -37,13 +39,13 @@ StatusCode MetadataSvc::initialize() {
     return StatusCode::FAILURE;
   }
 
-  m_frame.reset(new podio::Frame());
+  m_frame = std::make_unique<podio::Frame>();
 
   return StatusCode::SUCCESS;
 }
 
 StatusCode MetadataSvc::finalize() { return Service::finalize(); }
 
-void MetadataSvc::setFrame(podio::Frame&& fr) { m_frame.reset(new podio::Frame(std::move(fr))); }
+void MetadataSvc::setFrame(podio::Frame&& fr) { m_frame = std::make_unique<podio::Frame>(std::move(fr)); }
 
 DECLARE_COMPONENT(MetadataSvc)
diff --git a/k4FWCore/components/MetadataSvc.h b/k4FWCore/components/MetadataSvc.h
index 97fa5e92..42cc281b 100644
--- a/k4FWCore/components/MetadataSvc.h
+++ b/k4FWCore/components/MetadataSvc.h
@@ -30,8 +30,6 @@ class MetadataSvc : public extends<Service, IMetadataSvc> {
   using extends::extends;
 
 public:
-  ~MetadataSvc() override = default;
-
   StatusCode initialize() override;
   StatusCode finalize() override;
 
diff --git a/k4FWCore/components/PodioOutput.h b/k4FWCore/components/PodioOutput.h
index c8c304e4..b1f6f76f 100644
--- a/k4FWCore/components/PodioOutput.h
+++ b/k4FWCore/components/PodioOutput.h
@@ -34,12 +34,12 @@ class PodioOutput : public Gaudi::Algorithm {
   PodioOutput(const std::string& name, ISvcLocator* svcLoc);
 
   /// Initialization of PodioOutput. Acquires the data service, creates trees and root file.
-  StatusCode initialize();
+  StatusCode initialize() override;
   /// Execute. For the first event creates branches for all collections known to PodioDataSvc and prepares them for
   /// writing. For the following events it reconnects the branches with collections and prepares them for write.
-  StatusCode execute(const EventContext&) const;
+  StatusCode execute(const EventContext&) const override;
   /// Finalize. Writes the meta data tree; writes file and cleans up all ROOT-pointers.
-  StatusCode finalize();
+  StatusCode finalize() override;
 
 private:
   /// First event or not
diff --git a/k4FWCore/components/Reader.cpp b/k4FWCore/components/Reader.cpp
index c9938c2c..6e5511a6 100644
--- a/k4FWCore/components/Reader.cpp
+++ b/k4FWCore/components/Reader.cpp
@@ -69,7 +69,7 @@ class CollectionPusher : public Gaudi::Functional::details::BaseClass_t<Gaudi::F
                            Gaudi::Details::Property::ImmediatelyInvokeHandler{true}} {}
 
   // derived classes can NOT implement execute
-  StatusCode execute(const EventContext&) const override final {
+  StatusCode execute(const EventContext&) const final {
     try {
       auto out = (*this)();
 
diff --git a/k4FWCore/components/k4DataSvc.cpp b/k4FWCore/components/k4DataSvc.cpp
index e7c7bf0d..d5d0e490 100644
--- a/k4FWCore/components/k4DataSvc.cpp
+++ b/k4FWCore/components/k4DataSvc.cpp
@@ -29,6 +29,3 @@ k4DataSvc::k4DataSvc(const std::string& name, ISvcLocator* svc) : PodioDataSvc(n
   declareProperty("input", m_filename = "", "Name of the file to read");
   declareProperty("FirstEventEntry", m_1stEvtEntry = 0, "First event to read");
 }
-
-/// Standard Destructor
-k4DataSvc::~k4DataSvc() {}
diff --git a/k4FWCore/components/k4DataSvc.h b/k4FWCore/components/k4DataSvc.h
index b8f89943..5c4bf83c 100644
--- a/k4FWCore/components/k4DataSvc.h
+++ b/k4FWCore/components/k4DataSvc.h
@@ -26,8 +26,5 @@ class k4DataSvc : public PodioDataSvc {
 public:
   /// Standard Constructor
   k4DataSvc(const std::string& name, ISvcLocator* svc);
-
-  /// Standard Destructor
-  virtual ~k4DataSvc();
 };
 #endif
diff --git a/k4FWCore/include/k4FWCore/Consumer.h b/k4FWCore/include/k4FWCore/Consumer.h
index 493cc1b2..8077645e 100644
--- a/k4FWCore/include/k4FWCore/Consumer.h
+++ b/k4FWCore/include/k4FWCore/Consumer.h
@@ -80,7 +80,7 @@ namespace k4FWCore {
           : Consumer(std::move(name), locator, inputs, std::index_sequence_for<In...>{}) {}
 
       // derived classes are NOT allowed to implement execute ...
-      StatusCode execute(const EventContext& ctx) const override final {
+      StatusCode execute(const EventContext& ctx) const final {
         try {
           filter_evtcontext_tt<In...>::apply(*this, ctx, m_inputs);
           return Gaudi::Functional::FilterDecision::PASSED;
diff --git a/k4FWCore/include/k4FWCore/DataHandle.h b/k4FWCore/include/k4FWCore/DataHandle.h
index 599a4a78..8d5e8689 100644
--- a/k4FWCore/include/k4FWCore/DataHandle.h
+++ b/k4FWCore/include/k4FWCore/DataHandle.h
@@ -118,7 +118,7 @@ template <typename T> const T* DataHandle<T>::get() {
       // only do this once (if both are false after this, we throw exception)
       m_isGoodType = nullptr != dynamic_cast<DataWrapper<T>*>(dataObjectp);
       if (!m_isGoodType) {
-        auto tmp = dynamic_cast<DataWrapper<podio::CollectionBase>*>(dataObjectp);
+        auto* tmp = dynamic_cast<DataWrapper<podio::CollectionBase>*>(dataObjectp);
         if (tmp != nullptr) {
           m_isCollection = nullptr != dynamic_cast<T*>(tmp->collectionBase());
         }
@@ -129,7 +129,7 @@ template <typename T> const T* DataHandle<T>::get() {
     } else if (m_isCollection) {
       // The reader does not know the specific type of the collection. So we need a reinterpret_cast if the handle was
       // created by the reader.
-      DataWrapper<podio::CollectionBase>* tmp = static_cast<DataWrapper<podio::CollectionBase>*>(dataObjectp);
+      auto* tmp = static_cast<DataWrapper<podio::CollectionBase>*>(dataObjectp);
       return reinterpret_cast<const T*>(tmp->collectionBase());
     } else {
       // When a functional has pushed a std::shared_ptr<podio::CollectionBase> into the store
@@ -183,9 +183,6 @@ namespace Gaudi {
   template <class T> class Property<::DataHandle<T>&> : public ::DataHandleProperty {
   public:
     Property(const std::string& name, ::DataHandle<T>& value) : ::DataHandleProperty(name, value) {}
-
-    /// virtual Destructor
-    virtual ~Property() {}
   };
 }  // namespace Gaudi
 
diff --git a/k4FWCore/include/k4FWCore/DataWrapper.h b/k4FWCore/include/k4FWCore/DataWrapper.h
index f86d60e4..5bfc22f9 100644
--- a/k4FWCore/include/k4FWCore/DataWrapper.h
+++ b/k4FWCore/include/k4FWCore/DataWrapper.h
@@ -33,8 +33,7 @@ class GAUDI_API DataWrapperBase : public DataObject {
   // ugly hack to circumvent the usage of boost::any yet
   // DataSvc would need a templated register method
   virtual podio::CollectionBase* collectionBase() = 0;
-  virtual ~DataWrapperBase(){};
-  virtual void resetData() = 0;
+  virtual void                   resetData()      = 0;
 };
 
 template <class T> class GAUDI_API DataWrapper : public DataWrapperBase {
@@ -53,15 +52,15 @@ template <class T> class GAUDI_API DataWrapper : public DataWrapperBase {
   };
   virtual ~DataWrapper();
 
-  const T*     getData() const { return m_data; }
-  void         setData(const T* data) { m_data = data; }
-  virtual void resetData() { m_data = nullptr; }
+  const T* getData() const { return m_data; }
+  void     setData(const T* data) { m_data = data; }
+  void     resetData() override { m_data = nullptr; }
 
   operator const T&() const& { return *m_data; }
 
 private:
   /// try to cast to collectionBase; may return nullptr;
-  virtual podio::CollectionBase* collectionBase();
+  podio::CollectionBase* collectionBase() override;
 
 private:
   const T* m_data;
diff --git a/k4FWCore/include/k4FWCore/IMetadataSvc.h b/k4FWCore/include/k4FWCore/IMetadataSvc.h
index ac12dce1..0144608e 100644
--- a/k4FWCore/include/k4FWCore/IMetadataSvc.h
+++ b/k4FWCore/include/k4FWCore/IMetadataSvc.h
@@ -19,6 +19,8 @@
 #ifndef FWCORE_IMETADATASERVICE_H
 #define FWCORE_IMETADATASERVICE_H
 
+#include <memory>
+
 #include "GaudiKernel/IInterface.h"
 
 #include "podio/Frame.h"
@@ -32,7 +34,7 @@ class IMetadataSvc : virtual public IInterface {
   virtual void               setFrame(podio::Frame&& fr) = 0;
   template <typename T> void put(const std::string& name, const T& obj) {
     if (!m_frame) {
-      m_frame.reset(new podio::Frame());
+      m_frame = std::make_unique<podio::Frame>();
     }
     m_frame->putParameter(name, obj);
   }
diff --git a/k4FWCore/include/k4FWCore/KeepDropSwitch.h b/k4FWCore/include/k4FWCore/KeepDropSwitch.h
index 81603ddd..5126a0cb 100644
--- a/k4FWCore/include/k4FWCore/KeepDropSwitch.h
+++ b/k4FWCore/include/k4FWCore/KeepDropSwitch.h
@@ -31,13 +31,13 @@ class KeepDropSwitch {
 public:
   enum Cmd { KEEP, DROP, UNKNOWN };
   typedef std::vector<std::string> CommandLines;
-  KeepDropSwitch() {}
+  KeepDropSwitch() = default;
   explicit KeepDropSwitch(const CommandLines& cmds) { m_commandlines = cmds; }
   bool isOn(const std::string& astring) const;
 
 private:
   bool                                getFlag(const std::string& astring) const;
-  Cmd                                 extractCommand(const std::string cmdLine) const;
+  Cmd                                 extractCommand(const std::string& cmdLine) const;
   CommandLines                        m_commandlines;
   mutable std::map<std::string, bool> m_cache;
 };
diff --git a/k4FWCore/include/k4FWCore/MetaDataHandle.h b/k4FWCore/include/k4FWCore/MetaDataHandle.h
index fa5881c2..c923b785 100644
--- a/k4FWCore/include/k4FWCore/MetaDataHandle.h
+++ b/k4FWCore/include/k4FWCore/MetaDataHandle.h
@@ -29,7 +29,6 @@ template <typename T> class MetaDataHandle {
   MetaDataHandle();
   MetaDataHandle(const std::string& descriptor, Gaudi::DataHandle::Mode a);
   MetaDataHandle(const Gaudi::DataHandle& handle, const std::string& descriptor, Gaudi::DataHandle::Mode a);
-  ~MetaDataHandle();
 
   /// Get the value that is stored in this MetaDataHandle
   ///
@@ -69,8 +68,6 @@ template <typename T> class MetaDataHandle {
   Gaudi::DataHandle::Mode         m_mode;
 };
 
-template <typename T> MetaDataHandle<T>::~MetaDataHandle() {}
-
 //---------------------------------------------------------------------------
 template <typename T>
 MetaDataHandle<T>::MetaDataHandle(const std::string& descriptor, Gaudi::DataHandle::Mode a)
diff --git a/k4FWCore/include/k4FWCore/PodioDataSvc.h b/k4FWCore/include/k4FWCore/PodioDataSvc.h
index 9084cc21..2df82929 100644
--- a/k4FWCore/include/k4FWCore/PodioDataSvc.h
+++ b/k4FWCore/include/k4FWCore/PodioDataSvc.h
@@ -57,15 +57,11 @@ class PodioDataSvc : public DataSvc {
   /// Standard Constructor
   PodioDataSvc(const std::string& name, ISvcLocator* svc);
 
-  /// Standard Destructor
-  virtual ~PodioDataSvc();
-
   // Use DataSvc functionality except where we override
   using DataSvc::registerObject;
   /// Overriding standard behaviour of evt service
   /// Register object with the data store.
-  virtual StatusCode registerObject(std::string_view parentPath, std::string_view fullPath,
-                                    DataObject* pObject) override final;
+  StatusCode registerObject(std::string_view parentPath, std::string_view fullPath, DataObject* pObject) final;
 
   const std::string_view getCollectionType(const std::string& collName);
 
diff --git a/k4FWCore/include/k4FWCore/Transformer.h b/k4FWCore/include/k4FWCore/Transformer.h
index ea0c70ae..2bbde54c 100644
--- a/k4FWCore/include/k4FWCore/Transformer.h
+++ b/k4FWCore/include/k4FWCore/Transformer.h
@@ -109,7 +109,7 @@ namespace k4FWCore {
                         std::index_sequence_for<Out>{}) {}
 
       // derived classes are NOT allowed to implement execute ...
-      StatusCode execute(const EventContext& ctx) const override final {
+      StatusCode execute(const EventContext& ctx) const final {
         try {
           if constexpr (isVectorLike<Out>::value) {
             std::tuple<Out> tmp = filter_evtcontext_tt<In...>::apply(*this, ctx, this->m_inputs);
@@ -245,7 +245,7 @@ namespace k4FWCore {
                              std::index_sequence_for<Out...>{}) {}
 
       // derived classes are NOT allowed to implement execute ...
-      StatusCode execute(const EventContext& ctx) const override final {
+      StatusCode execute(const EventContext& ctx) const final {
         try {
           auto tmp = filter_evtcontext_tt<In...>::apply(*this, ctx, this->m_inputs);
           putVectorOutputs<0, Out...>(std::move(tmp), m_outputs, this);
diff --git a/k4FWCore/src/KeepDropSwitch.cpp b/k4FWCore/src/KeepDropSwitch.cpp
index 365ca4f5..94daa9b6 100644
--- a/k4FWCore/src/KeepDropSwitch.cpp
+++ b/k4FWCore/src/KeepDropSwitch.cpp
@@ -58,15 +58,14 @@ std::vector<std::string> split(const std::string& s, char delim) {
   std::stringstream        ss(s);
   std::string              item;
   while (std::getline(ss, item, delim)) {
-    if (item != "")
+    if (!item.empty())
       elems.push_back(item);
   }
   return elems;
 }
 
 bool KeepDropSwitch::isOn(const std::string& astring) const {
-  typedef std::map<std::string, bool>::const_iterator MIter;
-  MIter                                               im = m_cache.find(astring);
+  auto im = m_cache.find(astring);
   if (im != m_cache.end())
     return im->second;
   else {
@@ -110,8 +109,8 @@ bool KeepDropSwitch::getFlag(const std::string& astring) const {
   return flag;
 }
 
-KeepDropSwitch::Cmd KeepDropSwitch::extractCommand(const std::string cmdline) const {
-  std::vector<std::string> words = split(cmdline, ' ');
+KeepDropSwitch::Cmd KeepDropSwitch::extractCommand(const std::string& cmdline) const {
+  auto words = split(cmdline, ' ');
   for (auto& word : words)
     std::cout << "'" << word << "' ";
   std::cout << std::endl;
diff --git a/k4FWCore/src/PodioDataSvc.cpp b/k4FWCore/src/PodioDataSvc.cpp
index f80a0371..d0372d3a 100644
--- a/k4FWCore/src/PodioDataSvc.cpp
+++ b/k4FWCore/src/PodioDataSvc.cpp
@@ -35,12 +35,12 @@ StatusCode PodioDataSvc::initialize() {
   m_cnvSvc = svc_loc->service("EventPersistencySvc");
   status   = setDataLoader(m_cnvSvc);
 
-  if (m_filename != "") {
+  if (!m_filename.empty()) {
     m_filenames.push_back(m_filename);
   }
 
-  if (m_filenames.size() > 0) {
-    if (m_filenames[0] != "") {
+  if (!m_filenames.empty()) {
+    if (!m_filenames[0].empty()) {
       m_reading_from_file = true;
       m_reader.openFiles(m_filenames);
       m_numAvailableEvents = m_reader.getEntries("events");
@@ -84,7 +84,7 @@ StatusCode PodioDataSvc::reinitialize() {
 }
 /// Service finalization
 StatusCode PodioDataSvc::finalize() {
-  m_cnvSvc = 0;  // release
+  m_cnvSvc = nullptr;  // release
   DataSvc::finalize().ignore();
   return StatusCode::SUCCESS;
 }
@@ -143,9 +143,6 @@ void PodioDataSvc::endOfRead() {
 /// Standard Constructor
 PodioDataSvc::PodioDataSvc(const std::string& name, ISvcLocator* svc) : DataSvc(name, svc) {}
 
-/// Standard Destructor
-PodioDataSvc::~PodioDataSvc() {}
-
 const std::string_view PodioDataSvc::getCollectionType(const std::string& collName) {
   const auto coll = m_eventframe.get(collName);
   if (coll == nullptr) {
@@ -156,7 +153,7 @@ const std::string_view PodioDataSvc::getCollectionType(const std::string& collNa
 }
 
 StatusCode PodioDataSvc::registerObject(std::string_view parentPath, std::string_view fullPath, DataObject* pObject) {
-  DataWrapperBase* wrapper = dynamic_cast<DataWrapperBase*>(pObject);
+  auto* wrapper = dynamic_cast<DataWrapperBase*>(pObject);
   if (wrapper != nullptr) {
     podio::CollectionBase* coll = wrapper->collectionBase();
     if (coll != nullptr) {
diff --git a/k4Interface/include/k4Interface/IGeoSvc.h b/k4Interface/include/k4Interface/IGeoSvc.h
index 24f6105f..97796ae6 100644
--- a/k4Interface/include/k4Interface/IGeoSvc.h
+++ b/k4Interface/include/k4Interface/IGeoSvc.h
@@ -36,7 +36,6 @@ class GAUDI_API IGeoSvc : virtual public IService {
   virtual dd4hep::Detector*            getDetector()                             = 0;
   virtual G4VUserDetectorConstruction* getGeant4Geo()                            = 0;
   virtual std::string                  constantAsString(std::string const& name) = 0;
-  virtual ~IGeoSvc() {}
 };
 
 #endif  // IGEOSVC_H
diff --git a/k4Interface/include/k4Interface/ITowerTool.h b/k4Interface/include/k4Interface/ITowerTool.h
index a20c7c1a..4cff08e6 100644
--- a/k4Interface/include/k4Interface/ITowerTool.h
+++ b/k4Interface/include/k4Interface/ITowerTool.h
@@ -85,8 +85,6 @@ class ITowerTool : virtual public IAlgTool {
   virtual void attachCells(float aEta, float aPhi, uint aHalfEtaFinal, uint aHalfPhiFinal,
                            edm4hep::MutableCluster& aEdmCluster, edm4hep::CalorimeterHitCollection* aEdmClusterCells,
                            bool aEllipse) = 0;
-
-  virtual ~ITowerTool() {}
 };
 
 #endif /* RECINTERFACE_ITOWERTOOL_H */
diff --git a/k4Interface/include/k4Interface/ITowerToolThetaModule.h b/k4Interface/include/k4Interface/ITowerToolThetaModule.h
index fd6a91bc..44787955 100644
--- a/k4Interface/include/k4Interface/ITowerToolThetaModule.h
+++ b/k4Interface/include/k4Interface/ITowerToolThetaModule.h
@@ -85,8 +85,6 @@ class ITowerToolThetaModule : virtual public IAlgTool {
   virtual void attachCells(float aTheta, float aPhi, uint aHalfThetaFinal, uint aHalfPhiFinal,
                            edm4hep::MutableCluster& aEdmCluster, edm4hep::CalorimeterHitCollection* aEdmClusterCells,
                            bool aEllipse) = 0;
-
-  virtual ~ITowerToolThetaModule() {}
 };
 
 #endif /* RECINTERFACE_ITOWERTOOLTHETAMODULE_H */
diff --git a/test/k4FWCoreTest/src/components/ExampleEventHeaderConsumer.cpp b/test/k4FWCoreTest/src/components/ExampleEventHeaderConsumer.cpp
index cb8d81a5..48593f9f 100644
--- a/test/k4FWCoreTest/src/components/ExampleEventHeaderConsumer.cpp
+++ b/test/k4FWCoreTest/src/components/ExampleEventHeaderConsumer.cpp
@@ -34,7 +34,7 @@ struct ExampleEventHeaderConsumer final : k4FWCore::Consumer<void(const edm4hep:
   ExampleEventHeaderConsumer(const std::string& name, ISvcLocator* svcLoc)
       : Consumer(name, svcLoc, {KeyValues("EventHeaderName", {edm4hep::labels::EventHeader})}) {}
 
-  void operator()(const edm4hep::EventHeaderCollection& evtHeaderColl) const {
+  void operator()(const edm4hep::EventHeaderCollection& evtHeaderColl) const override {
     if (evtHeaderColl.empty()) {
       throw std::runtime_error("EventHeader collection is empty");
     }
diff --git a/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.cpp b/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.cpp
index 00d5b677..fb3c6add 100644
--- a/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.cpp
+++ b/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.cpp
@@ -23,8 +23,6 @@ DECLARE_COMPONENT(TestUniqueIDGenSvc)
 TestUniqueIDGenSvc::TestUniqueIDGenSvc(const std::string& aName, ISvcLocator* aSvcLoc)
     : Gaudi::Algorithm(aName, aSvcLoc) {}
 
-TestUniqueIDGenSvc::~TestUniqueIDGenSvc() {}
-
 StatusCode TestUniqueIDGenSvc::initialize() {
   if (Gaudi::Algorithm::initialize().isFailure()) {
     return StatusCode::FAILURE;
@@ -49,5 +47,3 @@ StatusCode TestUniqueIDGenSvc::execute(const EventContext&) const {
 
   return StatusCode::SUCCESS;
 }
-
-StatusCode TestUniqueIDGenSvc::finalize() { return Gaudi::Algorithm::finalize(); }
diff --git a/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.h b/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.h
index df56c683..b0bfa656 100644
--- a/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.h
+++ b/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.h
@@ -27,19 +27,14 @@
 class TestUniqueIDGenSvc : public Gaudi::Algorithm {
 public:
   explicit TestUniqueIDGenSvc(const std::string&, ISvcLocator*);
-  virtual ~TestUniqueIDGenSvc();
   /**  Initialize.
    *   @return status code
    */
-  virtual StatusCode initialize() final;
+  StatusCode initialize() final;
   /**  Execute.
    *   @return status code
    */
-  virtual StatusCode execute(const EventContext&) const final;
-  /**  Finalize.
-   *   @return status code
-   */
-  virtual StatusCode finalize() final;
+  StatusCode execute(const EventContext&) const final;
 
 private:
   SmartIF<IUniqueIDGenSvc> m_service;
diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.cpp
index aa586a88..16d47fb7 100644
--- a/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.cpp
+++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.cpp
@@ -32,8 +32,6 @@ k4FWCoreTest_AlgorithmWithTFile::k4FWCoreTest_AlgorithmWithTFile(const std::stri
   setProperty("Cardinality", 1).ignore();
 }
 
-k4FWCoreTest_AlgorithmWithTFile::~k4FWCoreTest_AlgorithmWithTFile() {}
-
 StatusCode k4FWCoreTest_AlgorithmWithTFile::initialize() {
   if (Gaudi::Algorithm::initialize().isFailure()) {
     return StatusCode::FAILURE;
diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.h
index 753ac0a6..ef8b3a78 100644
--- a/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.h
+++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.h
@@ -44,19 +44,18 @@ namespace edm4hep {
 class k4FWCoreTest_AlgorithmWithTFile : public Gaudi::Algorithm {
 public:
   explicit k4FWCoreTest_AlgorithmWithTFile(const std::string&, ISvcLocator*);
-  virtual ~k4FWCoreTest_AlgorithmWithTFile();
   /**  Initialize.
    *   @return status code
    */
-  virtual StatusCode initialize() final;
+  StatusCode initialize() final;
   /**  Execute.
    *   @return status code
    */
-  virtual StatusCode execute(const EventContext&) const final;
+  StatusCode execute(const EventContext&) const final;
   /**  Finalize.
    *   @return status code
    */
-  virtual StatusCode finalize() final;
+  StatusCode finalize() final;
 
 private:
   /// integer to add to the dummy values written to the edm
diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp
index afb26804..44befcf4 100644
--- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp
+++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp
@@ -32,8 +32,6 @@ k4FWCoreTest_CheckExampleEventData::k4FWCoreTest_CheckExampleEventData(const std
   setProperty("Cardinality", 1).ignore();
 }
 
-StatusCode k4FWCoreTest_CheckExampleEventData::initialize() { return Gaudi::Algorithm::initialize(); }
-
 StatusCode k4FWCoreTest_CheckExampleEventData::execute(const EventContext&) const {
   auto floatVector = m_vectorFloatHandle.get();
   if (floatVector->size() != 3 || (*floatVector)[2] != m_event) {
@@ -59,5 +57,3 @@ StatusCode k4FWCoreTest_CheckExampleEventData::execute(const EventContext&) cons
   }
   return StatusCode::SUCCESS;
 }
-
-StatusCode k4FWCoreTest_CheckExampleEventData::finalize() { return Gaudi::Algorithm::finalize(); }
diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.h
index 7e5a5970..368889ff 100644
--- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.h
+++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.h
@@ -35,18 +35,10 @@ class k4FWCoreTest_CheckExampleEventData : public Gaudi::Algorithm {
 public:
   explicit k4FWCoreTest_CheckExampleEventData(const std::string&, ISvcLocator*);
   ~k4FWCoreTest_CheckExampleEventData() = default;
-  /**  Initialize.
-   *   @return status code
-   */
-  virtual StatusCode initialize() final;
   /**  Execute.
    *   @return status code
    */
-  virtual StatusCode execute(const EventContext&) const final;
-  /**  Finalize.
-   *   @return status code
-   */
-  virtual StatusCode finalize() final;
+  StatusCode execute(const EventContext&) const final;
 
 private:
   /// integer to add to the dummy values written to the edm
diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp
index 54950bac..7dedd26e 100644
--- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp
+++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp
@@ -46,15 +46,6 @@ k4FWCoreTest_CreateExampleEventData::k4FWCoreTest_CreateExampleEventData(const s
   setProperty("Cardinality", 1).ignore();
 }
 
-k4FWCoreTest_CreateExampleEventData::~k4FWCoreTest_CreateExampleEventData() {}
-
-StatusCode k4FWCoreTest_CreateExampleEventData::initialize() {
-  if (Gaudi::Algorithm::initialize().isFailure()) {
-    return StatusCode::FAILURE;
-  }
-  return StatusCode::SUCCESS;
-}
-
 StatusCode k4FWCoreTest_CreateExampleEventData::execute(const EventContext&) const {
   auto* floatVector = m_vectorFloatHandle.createAndPut();
   floatVector->push_back(125.);
@@ -106,5 +97,3 @@ StatusCode k4FWCoreTest_CreateExampleEventData::execute(const EventContext&) con
 
   return StatusCode::SUCCESS;
 }
-
-StatusCode k4FWCoreTest_CreateExampleEventData::finalize() { return Gaudi::Algorithm::finalize(); }
diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h
index 2caed1aa..7e316a1b 100644
--- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h
+++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h
@@ -56,19 +56,10 @@ namespace edm4hep {
 class k4FWCoreTest_CreateExampleEventData : public Gaudi::Algorithm {
 public:
   explicit k4FWCoreTest_CreateExampleEventData(const std::string&, ISvcLocator*);
-  virtual ~k4FWCoreTest_CreateExampleEventData();
-  /**  Initialize.
-   *   @return status code
-   */
-  virtual StatusCode initialize() final;
   /**  Execute.
    *   @return status code
    */
-  virtual StatusCode execute(const EventContext&) const final;
-  /**  Finalize.
-   *   @return status code
-   */
-  virtual StatusCode finalize() final;
+  StatusCode execute(const EventContext&) const final;
 
 private:
   /// integer to add to the dummy values written to the edm
diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.cpp
index a576a298..79b39db4 100644
--- a/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.cpp
+++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.cpp
@@ -27,15 +27,6 @@ k4FWCoreTest_HelloWorldAlg::k4FWCoreTest_HelloWorldAlg(const std::string& aName,
   setProperty("Cardinality", 1).ignore();
 }
 
-k4FWCoreTest_HelloWorldAlg::~k4FWCoreTest_HelloWorldAlg() {}
-
-StatusCode k4FWCoreTest_HelloWorldAlg::initialize() {
-  if (Gaudi::Algorithm::initialize().isFailure()) {
-    return StatusCode::FAILURE;
-  }
-  return StatusCode::SUCCESS;
-}
-
 StatusCode k4FWCoreTest_HelloWorldAlg::execute(const EventContext&) const {
   info() << endmsg;
   info() << endmsg;
@@ -44,5 +35,3 @@ StatusCode k4FWCoreTest_HelloWorldAlg::execute(const EventContext&) const {
   info() << endmsg;
   return StatusCode::SUCCESS;
 }
-
-StatusCode k4FWCoreTest_HelloWorldAlg::finalize() { return Gaudi::Algorithm::finalize(); }
diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.h
index 4a39f4fc..2e6088bc 100644
--- a/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.h
+++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.h
@@ -26,19 +26,10 @@
 class k4FWCoreTest_HelloWorldAlg : public Gaudi::Algorithm {
 public:
   explicit k4FWCoreTest_HelloWorldAlg(const std::string&, ISvcLocator*);
-  virtual ~k4FWCoreTest_HelloWorldAlg();
-  /**  Initialize.
-   *   @return status code
-   */
-  virtual StatusCode initialize() final;
   /**  Execute.
    *   @return status code
    */
-  virtual StatusCode execute(const EventContext&) const final;
-  /**  Finalize.
-   *   @return status code
-   */
-  virtual StatusCode finalize() final;
+  StatusCode execute(const EventContext&) const final;
 
 private:
   // member variable
diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.cpp
index b8e4e99a..dcc37779 100644
--- a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.cpp
+++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.cpp
@@ -29,15 +29,6 @@ k4FWCoreTest_cellID_reader::k4FWCoreTest_cellID_reader(const std::string& aName,
   setProperty("Cardinality", 1).ignore();
 }
 
-k4FWCoreTest_cellID_reader::~k4FWCoreTest_cellID_reader() {}
-
-StatusCode k4FWCoreTest_cellID_reader::initialize() {
-  if (Gaudi::Algorithm::initialize().isFailure()) {
-    return StatusCode::FAILURE;
-  }
-  return StatusCode::SUCCESS;
-}
-
 StatusCode k4FWCoreTest_cellID_reader::execute(const EventContext&) const {
   [[maybe_unused]] const auto simtrackerhits_coll = m_simTrackerHitReaderHandle.get();
 
@@ -50,5 +41,3 @@ StatusCode k4FWCoreTest_cellID_reader::execute(const EventContext&) const {
 
   return StatusCode::SUCCESS;
 }
-
-StatusCode k4FWCoreTest_cellID_reader::finalize() { return Gaudi::Algorithm::finalize(); }
diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.h
index 6e01ec78..72afbdac 100644
--- a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.h
+++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.h
@@ -36,19 +36,10 @@
 class k4FWCoreTest_cellID_reader : public Gaudi::Algorithm {
 public:
   explicit k4FWCoreTest_cellID_reader(const std::string&, ISvcLocator*);
-  virtual ~k4FWCoreTest_cellID_reader();
-  /**  Initialize.
-   *   @return status code
-   */
-  virtual StatusCode initialize() final;
   /**  Execute.
    *   @return status code
    */
-  virtual StatusCode execute(const EventContext&) const final;
-  /**  Finalize.
-   *   @return status code
-   */
-  virtual StatusCode finalize() final;
+  StatusCode execute(const EventContext&) const final;
 
 private:
   /// Handle for the SimTrackerHits to be read
diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.cpp
index ea83fd5a..a3787e78 100644
--- a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.cpp
+++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.cpp
@@ -28,8 +28,6 @@ k4FWCoreTest_cellID_writer::k4FWCoreTest_cellID_writer(const std::string& aName,
   setProperty("Cardinality", 1).ignore();
 }
 
-k4FWCoreTest_cellID_writer::~k4FWCoreTest_cellID_writer() {}
-
 StatusCode k4FWCoreTest_cellID_writer::initialize() {
   if (Gaudi::Algorithm::initialize().isFailure()) {
     return StatusCode::FAILURE;
@@ -46,5 +44,3 @@ StatusCode k4FWCoreTest_cellID_writer::execute(const EventContext&) const {
 
   return StatusCode::SUCCESS;
 }
-
-StatusCode k4FWCoreTest_cellID_writer::finalize() { return Gaudi::Algorithm::finalize(); }
diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.h
index 49848722..dd042186 100644
--- a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.h
+++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.h
@@ -39,19 +39,14 @@ const std::string cellIDtest = "M:3,S-1:3,I:9,J:9,K-1:6";
 class k4FWCoreTest_cellID_writer : public Gaudi::Algorithm {
 public:
   explicit k4FWCoreTest_cellID_writer(const std::string&, ISvcLocator*);
-  virtual ~k4FWCoreTest_cellID_writer();
   /**  Initialize.
    *   @return status code
    */
-  virtual StatusCode initialize() final;
+  StatusCode initialize() final;
   /**  Execute.
    *   @return status code
    */
-  virtual StatusCode execute(const EventContext&) const final;
-  /**  Finalize.
-   *   @return status code
-   */
-  virtual StatusCode finalize() final;
+  StatusCode execute(const EventContext&) const final;
 
 private:
   /// Handle for the SimTrackerHits to be written