From 9242ad7061a13db856681d61e1426ff928220610 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Mon, 29 Jul 2024 17:15:21 +0200 Subject: [PATCH 1/4] Do not use GaudiAlg, use Gaudi::Algorithm instead --- framework/k4SimDelphes/CMakeLists.txt | 1 - .../k4SimDelphes/src/k4SimDelphesAlg.cpp | 2 +- framework/k4SimDelphes/src/k4SimDelphesAlg.h | 20 +++++++++---------- 3 files changed, 11 insertions(+), 12 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..a54074a 100644 --- a/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp +++ b/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp @@ -46,7 +46,7 @@ StatusCode k4SimDelphesAlg::initialize() { return StatusCode::SUCCESS; } -StatusCode k4SimDelphesAlg::execute() { +StatusCode k4SimDelphesAlg::execute(const EventContext&) { 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..731aa88 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,19 +26,19 @@ 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&); 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", + mutable DataHandle m_OutputRecParticles{"RecParticlesDelphes", Gaudi::DataHandle::Writer, this}; // Delphes detector card to be read in @@ -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}; + 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; }; From 809b166882ed0323677443089d014215a282b570 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Mon, 29 Jul 2024 17:18:48 +0200 Subject: [PATCH 2/4] Change GaudiAlgorithm to Gaudi::Algorithm in all places --- framework/k4SimDelphes/src/k4SimDelphesAlg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp b/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp index a54074a..b69f905 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"); } From 6c2b88e488d327f50f3e9a63e973d7c498d919f8 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Mon, 29 Jul 2024 17:21:06 +0200 Subject: [PATCH 3/4] Add missing const --- framework/k4SimDelphes/src/k4SimDelphesAlg.cpp | 2 +- framework/k4SimDelphes/src/k4SimDelphesAlg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp b/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp index b69f905..63f98ac 100644 --- a/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp +++ b/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp @@ -46,7 +46,7 @@ StatusCode k4SimDelphesAlg::initialize() { return StatusCode::SUCCESS; } -StatusCode k4SimDelphesAlg::execute(const EventContext&) { +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 731aa88..1485fb9 100644 --- a/framework/k4SimDelphes/src/k4SimDelphesAlg.h +++ b/framework/k4SimDelphes/src/k4SimDelphesAlg.h @@ -31,7 +31,7 @@ class k4SimDelphesAlg : public Gaudi::Algorithm { k4SimDelphesAlg(const std::string& name, ISvcLocator* svcLoc); virtual StatusCode initialize(); - virtual StatusCode execute(const EventContext&); + virtual StatusCode execute(const EventContext&) const; virtual StatusCode finalize(); private: From 9d2c6ea85f7e1033fd5567018c2a3eef7e38b92a Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Mon, 29 Jul 2024 17:28:09 +0200 Subject: [PATCH 4/4] Fix pre-commit --- framework/k4SimDelphes/src/k4SimDelphesAlg.cpp | 2 +- framework/k4SimDelphes/src/k4SimDelphesAlg.h | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp b/framework/k4SimDelphes/src/k4SimDelphesAlg.cpp index 63f98ac..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) - : Gaudi::Algorithm(name, svcLoc), m_eventDataSvc("EventDataSvc", "k4SimDelphesAlg") { + : Gaudi::Algorithm(name, svcLoc), m_eventDataSvc("EventDataSvc", "k4SimDelphesAlg") { declareProperty("GenParticles", m_InputMCParticles, "(Input) Collection of generated particles"); } diff --git a/framework/k4SimDelphes/src/k4SimDelphesAlg.h b/framework/k4SimDelphes/src/k4SimDelphesAlg.h index 1485fb9..fa0b456 100644 --- a/framework/k4SimDelphes/src/k4SimDelphesAlg.h +++ b/framework/k4SimDelphes/src/k4SimDelphesAlg.h @@ -39,7 +39,7 @@ class k4SimDelphesAlg : public Gaudi::Algorithm { mutable DataHandle m_InputMCParticles{"GenParticles", Gaudi::DataHandle::Reader, this}; /// Output from Delphes mutable DataHandle m_OutputRecParticles{"RecParticlesDelphes", - Gaudi::DataHandle::Writer, this}; + 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 Gaudi::Algorithm { std::unique_ptr m_Delphes{nullptr}; std::unique_ptr m_confReader{nullptr}; std::unique_ptr m_edm4hepConverter{nullptr}; - mutable TObjArray* m_allParticleOutputArray{nullptr}; - mutable TObjArray* m_stableParticleOutputArray{nullptr}; - mutable TObjArray* m_partonOutputArray{nullptr}; + mutable TObjArray* m_allParticleOutputArray{nullptr}; + mutable TObjArray* m_stableParticleOutputArray{nullptr}; + mutable TObjArray* m_partonOutputArray{nullptr}; mutable ExRootTreeWriter* m_treeWriter{nullptr}; - TTree* m_converterTree{nullptr}; + TTree* m_converterTree{nullptr}; // since branch names are taken from delphes config // and not declared as data handles, // need podiodatasvc directly - mutable PodioDataSvc* m_podioDataSvc; + mutable PodioDataSvc* m_podioDataSvc; ServiceHandle m_eventDataSvc; };