From 46af66c42e7dd5b913665dcbc93fde6bc6118b6f Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:24:16 +0200 Subject: [PATCH] Do not use GaudiAlg, use Gaudi::Algorithm instead (#126) --- framework/k4SimDelphes/CMakeLists.txt | 1 - .../k4SimDelphes/src/k4SimDelphesAlg.cpp | 4 ++-- framework/k4SimDelphes/src/k4SimDelphesAlg.h | 24 +++++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/framework/k4SimDelphes/CMakeLists.txt b/framework/k4SimDelphes/CMakeLists.txt index 3b1c25f..8b36f74 100644 --- a/framework/k4SimDelphes/CMakeLists.txt +++ b/framework/k4SimDelphes/CMakeLists.txt @@ -8,7 +8,6 @@ gaudi_add_module(k4SimDelphesPlugins LINK k4FWCore::k4FWCore k4FWCore::k4Interface DelphesEDM4HepConverter - Gaudi::GaudiAlgLib Gaudi::GaudiKernel EDM4HEP::edm4hep ROOT::Core diff --git a/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp b/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp index 80039ed..38a94eb 100644 --- a/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp +++ b/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp @@ -11,7 +11,7 @@ DECLARE_COMPONENT(k4SimDelphesAlg) using namespace k4SimDelphes; k4SimDelphesAlg::k4SimDelphesAlg(const std::string& name, ISvcLocator* svcLoc) - : GaudiAlgorithm(name, svcLoc), m_eventDataSvc("EventDataSvc", "k4SimDelphesAlg") { + : Gaudi::Algorithm(name, svcLoc), m_eventDataSvc("EventDataSvc", "k4SimDelphesAlg") { declareProperty("GenParticles", m_InputMCParticles, "(Input) Collection of generated particles"); } @@ -46,7 +46,7 @@ StatusCode k4SimDelphesAlg::initialize() { return StatusCode::SUCCESS; } -StatusCode k4SimDelphesAlg::execute() { +StatusCode k4SimDelphesAlg::execute(const EventContext&) const { verbose() << "Execute k4SimDelphesAlg... " << endmsg; m_allParticleOutputArray->Clear(); m_stableParticleOutputArray->Clear(); diff --git a/framework/k4SimDelphes/src/k4SimDelphesAlg.h b/framework/k4SimDelphes/src/k4SimDelphesAlg.h index e0344f6..fa0b456 100644 --- a/framework/k4SimDelphes/src/k4SimDelphesAlg.h +++ b/framework/k4SimDelphes/src/k4SimDelphesAlg.h @@ -11,7 +11,7 @@ #include "k4FWCore/DataWrapper.h" #include "k4FWCore/PodioDataSvc.h" -#include "GaudiAlg/GaudiAlgorithm.h" +#include "Gaudi/Algorithm.h" #include "modules/Delphes.h" @@ -26,20 +26,20 @@ namespace edm4hep { * Main Algorithm to run Delphes, getting MCParticle input, producing * ReconstructedParticle output. */ -class k4SimDelphesAlg : public GaudiAlgorithm { +class k4SimDelphesAlg : public Gaudi::Algorithm { public: k4SimDelphesAlg(const std::string& name, ISvcLocator* svcLoc); virtual StatusCode initialize(); - virtual StatusCode execute(); + virtual StatusCode execute(const EventContext&) const; virtual StatusCode finalize(); private: /// Input from Generator - DataHandle m_InputMCParticles{"GenParticles", Gaudi::DataHandle::Reader, this}; + mutable DataHandle m_InputMCParticles{"GenParticles", Gaudi::DataHandle::Reader, this}; /// Output from Delphes - DataHandle m_OutputRecParticles{"RecParticlesDelphes", - Gaudi::DataHandle::Writer, this}; + mutable DataHandle m_OutputRecParticles{"RecParticlesDelphes", + Gaudi::DataHandle::Writer, this}; // Delphes detector card to be read in /// Name of Delphes tcl config file with detector and simulation parameters @@ -51,17 +51,17 @@ class k4SimDelphesAlg : public GaudiAlgorithm { std::unique_ptr m_Delphes{nullptr}; std::unique_ptr m_confReader{nullptr}; std::unique_ptr m_edm4hepConverter{nullptr}; - TObjArray* m_allParticleOutputArray{nullptr}; - TObjArray* m_stableParticleOutputArray{nullptr}; - TObjArray* m_partonOutputArray{nullptr}; + mutable TObjArray* m_allParticleOutputArray{nullptr}; + mutable TObjArray* m_stableParticleOutputArray{nullptr}; + mutable TObjArray* m_partonOutputArray{nullptr}; - ExRootTreeWriter* m_treeWriter{nullptr}; - TTree* m_converterTree{nullptr}; + mutable ExRootTreeWriter* m_treeWriter{nullptr}; + TTree* m_converterTree{nullptr}; // since branch names are taken from delphes config // and not declared as data handles, // need podiodatasvc directly - PodioDataSvc* m_podioDataSvc; + mutable PodioDataSvc* m_podioDataSvc; ServiceHandle m_eventDataSvc; };