diff --git a/k4Gen/src/components/GenEventFilter.cpp b/k4Gen/src/components/GenEventFilter.cpp index 0458f56..c0ddc70 100644 --- a/k4Gen/src/components/GenEventFilter.cpp +++ b/k4Gen/src/components/GenEventFilter.cpp @@ -16,18 +16,17 @@ #include "TInterpreter.h" #include "TGlobal.h" -DECLARE_COMPONENT(GenEventFilter) GenEventFilter::GenEventFilter( const std::string& name, - ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { + ISvcLocator* svcLoc) : Gaudi::Algorithm(name, svcLoc) { declareProperty("particles", m_inColl, "Generated particles to decide on (input)"); } StatusCode GenEventFilter::initialize() { { - StatusCode sc = GaudiAlgorithm::initialize(); + StatusCode sc = Gaudi::Algorithm::initialize(); if (sc.isFailure()) { return sc; } @@ -141,7 +140,7 @@ StatusCode GenEventFilter::initialize() { return StatusCode::SUCCESS; } -StatusCode GenEventFilter::execute() { +StatusCode GenEventFilter::execute(const EventContext& evtCtx) const { const edm4hep::MCParticleCollection* inParticles = m_inColl.get(); m_nEventsSeen++; @@ -180,5 +179,7 @@ StatusCode GenEventFilter::execute() { StatusCode GenEventFilter::finalize() { debug() << "Number of events seen: " << m_nEventsSeen << endmsg; - return GaudiAlgorithm::finalize(); + return Gaudi::Algorithm::finalize(); } + +DECLARE_COMPONENT(GenEventFilter) diff --git a/k4Gen/src/components/GenEventFilter.h b/k4Gen/src/components/GenEventFilter.h index a1a4719..7db6e34 100644 --- a/k4Gen/src/components/GenEventFilter.h +++ b/k4Gen/src/components/GenEventFilter.h @@ -2,7 +2,7 @@ #define GENERATION_GENEVENTFILTER_H // Gaudi -#include "GaudiAlg/GaudiAlgorithm.h" +#include "GaudiKernel/Algorithm.h" class IProperty; class IIncidentSvc; class IEventProcessor; @@ -23,7 +23,7 @@ namespace edm4hep { * @author J. Smiesko */ -class GenEventFilter : public GaudiAlgorithm { +class GenEventFilter : public Gaudi::Algorithm { public: /// Constructor @@ -31,13 +31,13 @@ class GenEventFilter : public GaudiAlgorithm { /// Initialize virtual StatusCode initialize(); /// Execute: Applies the filter - virtual StatusCode execute(); + virtual StatusCode execute(const EventContext& evtCtx) const; /// Finalize virtual StatusCode finalize(); private: /// Handle for the MCParticle collection to be read - DataHandle m_inColl{ + mutable DataHandle m_inColl{ "particles", Gaudi::DataHandle::Reader, this}; /// Rule to filter the events with @@ -49,11 +49,11 @@ class GenEventFilter : public GaudiAlgorithm { this, "filterRulePath", "", "Path to the filter rule file"}; /// Targeted number of events. - size_t m_nEventsTarget; + mutable std::atomic m_nEventsTarget; /// Keep track of how many events were already accepted. - size_t m_nEventsAccepted; + mutable std::atomic m_nEventsAccepted; /// Keep track of how many events we went through. - size_t m_nEventsSeen; + mutable std::atomic m_nEventsSeen; /// Pointer to the property. SmartIF m_property; /// Pointer to the incident service.