Skip to content

Commit

Permalink
Do not use GaudiAlg, use Gaudi::Algorithm instead (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell authored Jul 30, 2024
1 parent c729d90 commit 46af66c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
1 change: 0 additions & 1 deletion framework/k4SimDelphes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ gaudi_add_module(k4SimDelphesPlugins
LINK k4FWCore::k4FWCore
k4FWCore::k4Interface
DelphesEDM4HepConverter
Gaudi::GaudiAlgLib
Gaudi::GaudiKernel
EDM4HEP::edm4hep
ROOT::Core
Expand Down
4 changes: 2 additions & 2 deletions framework/k4SimDelphes/src/k4SimDelphesAlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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();
Expand Down
24 changes: 12 additions & 12 deletions framework/k4SimDelphes/src/k4SimDelphesAlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "k4FWCore/DataWrapper.h"
#include "k4FWCore/PodioDataSvc.h"

#include "GaudiAlg/GaudiAlgorithm.h"
#include "Gaudi/Algorithm.h"

#include "modules/Delphes.h"

Expand All @@ -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<edm4hep::MCParticleCollection> m_InputMCParticles{"GenParticles", Gaudi::DataHandle::Reader, this};
mutable DataHandle<edm4hep::MCParticleCollection> m_InputMCParticles{"GenParticles", Gaudi::DataHandle::Reader, this};
/// Output from Delphes
DataHandle<edm4hep::ReconstructedParticleCollection> m_OutputRecParticles{"RecParticlesDelphes",
Gaudi::DataHandle::Writer, this};
mutable DataHandle<edm4hep::ReconstructedParticleCollection> 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
Expand All @@ -51,17 +51,17 @@ class k4SimDelphesAlg : public GaudiAlgorithm {
std::unique_ptr<Delphes> m_Delphes{nullptr};
std::unique_ptr<ExRootConfReader> m_confReader{nullptr};
std::unique_ptr<k4SimDelphes::DelphesEDM4HepConverter> 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<IDataProviderSvc> m_eventDataSvc;
};

Expand Down

0 comments on commit 46af66c

Please sign in to comment.