From 017cba22678a270bc2936b013c909e987ef53138 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Fri, 15 Mar 2024 10:52:14 +0100 Subject: [PATCH] Don't use GaudiAlg (#172) --- doc/uniqueIDGen.md | 2 +- k4FWCore/CMakeLists.txt | 4 +- k4FWCore/components/EventHeaderCreator.cpp | 8 +-- k4FWCore/components/EventHeaderCreator.h | 12 ++-- k4FWCore/components/PodioInput.cpp | 2 +- k4FWCore/components/PodioInput.h | 2 +- k4FWCore/components/PodioOutput.cpp | 8 +-- k4FWCore/components/PodioOutput.h | 14 ++--- k4FWCore/include/k4FWCore/BaseClass.h | 2 +- k4FWCore/include/k4FWCore/MetaDataHandle.h | 2 +- test/k4FWCoreTest/CMakeLists.txt | 3 +- .../options/TestDataHandleUniquePtr.py | 43 -------------- .../components/ExampleEventHeaderConsumer.cpp | 2 +- .../components/TestDataHandleUniquePtr.cpp | 56 ------------------- .../src/components/TestDataHandleUniquePtr.h | 54 ------------------ .../src/components/TestUniqueIDGenSvc.cpp | 8 +-- .../src/components/TestUniqueIDGenSvc.h | 6 +- .../k4FWCoreTest_AlgorithmWithTFile.cpp | 10 ++-- .../k4FWCoreTest_AlgorithmWithTFile.h | 20 ++++--- .../k4FWCoreTest_CheckExampleEventData.cpp | 12 ++-- .../k4FWCoreTest_CheckExampleEventData.h | 13 +++-- .../k4FWCoreTest_CreateExampleEventData.cpp | 10 ++-- .../k4FWCoreTest_CreateExampleEventData.h | 21 ++++--- .../components/k4FWCoreTest_HelloWorldAlg.cpp | 11 ++-- .../components/k4FWCoreTest_HelloWorldAlg.h | 6 +- .../components/k4FWCoreTest_cellID_reader.cpp | 10 ++-- .../components/k4FWCoreTest_cellID_reader.h | 14 ++--- .../components/k4FWCoreTest_cellID_writer.cpp | 10 ++-- .../components/k4FWCoreTest_cellID_writer.h | 12 ++-- 29 files changed, 121 insertions(+), 256 deletions(-) delete mode 100644 test/k4FWCoreTest/options/TestDataHandleUniquePtr.py delete mode 100644 test/k4FWCoreTest/src/components/TestDataHandleUniquePtr.cpp delete mode 100644 test/k4FWCoreTest/src/components/TestDataHandleUniquePtr.h diff --git a/doc/uniqueIDGen.md b/doc/uniqueIDGen.md index eb30c785..c4dd6688 100644 --- a/doc/uniqueIDGen.md +++ b/doc/uniqueIDGen.md @@ -47,7 +47,7 @@ StatusCode SomeGaudiAlgorithm::initialize() { Then use the service during execution: ```cpp -StatusCode MarlinProcessorWrapper::execute() { +StatusCode MarlinProcessorWrapper::execute(const EventContext&) const { m_service->getUniqueID(1, 2, name()); } ``` diff --git a/k4FWCore/CMakeLists.txt b/k4FWCore/CMakeLists.txt index 8b6bb8af..14ce0d11 100644 --- a/k4FWCore/CMakeLists.txt +++ b/k4FWCore/CMakeLists.txt @@ -31,7 +31,7 @@ gaudi_install(PYTHON) gaudi_add_library(k4FWCore SOURCES src/PodioDataSvc.cpp src/KeepDropSwitch.cpp - LINK Gaudi::GaudiAlgLib Gaudi::GaudiKernel podio::podioRootIO ROOT::Core ROOT::RIO ROOT::Tree + LINK Gaudi::GaudiKernel podio::podioRootIO ROOT::Core ROOT::RIO ROOT::Tree ) target_include_directories(k4FWCore PUBLIC $ @@ -40,7 +40,7 @@ target_include_directories(k4FWCore PUBLIC file(GLOB k4fwcore_plugin_sources components/*.cpp) gaudi_add_module(k4FWCorePlugins SOURCES ${k4fwcore_plugin_sources} - LINK Gaudi::GaudiAlgLib Gaudi::GaudiKernel k4FWCore k4FWCore::k4Interface ROOT::Core ROOT::RIO ROOT::Tree EDM4HEP::edm4hep) + LINK Gaudi::GaudiKernel k4FWCore k4FWCore::k4Interface ROOT::Core ROOT::RIO ROOT::Tree EDM4HEP::edm4hep) target_include_directories(k4FWCorePlugins PUBLIC $ $) diff --git a/k4FWCore/components/EventHeaderCreator.cpp b/k4FWCore/components/EventHeaderCreator.cpp index dc1c7d25..7e84c6b3 100644 --- a/k4FWCore/components/EventHeaderCreator.cpp +++ b/k4FWCore/components/EventHeaderCreator.cpp @@ -21,18 +21,18 @@ DECLARE_COMPONENT(EventHeaderCreator) -EventHeaderCreator::EventHeaderCreator(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { +EventHeaderCreator::EventHeaderCreator(const std::string& name, ISvcLocator* svcLoc) : Gaudi::Algorithm(name, svcLoc) { declareProperty("EventHeaderCollection", m_headerCol, "Name of the EventHeaderCollection that will be stored in the output root file."); } StatusCode EventHeaderCreator::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) + if (Gaudi::Algorithm::initialize().isFailure()) return StatusCode::FAILURE; return StatusCode::SUCCESS; } -StatusCode EventHeaderCreator::execute() { +StatusCode EventHeaderCreator::execute(const EventContext&) const { static int eventNumber = 0; debug() << "Filling EventHeader with runNumber " << int(m_runNumber) << " and eventNumber " << eventNumber + m_eventNumberOffset << endmsg; @@ -44,7 +44,7 @@ StatusCode EventHeaderCreator::execute() { } StatusCode EventHeaderCreator::finalize() { - if (GaudiAlgorithm::finalize().isFailure()) + if (Gaudi::Algorithm::finalize().isFailure()) return StatusCode::FAILURE; return StatusCode::SUCCESS; } diff --git a/k4FWCore/components/EventHeaderCreator.h b/k4FWCore/components/EventHeaderCreator.h index 86298b29..a2d08a81 100644 --- a/k4FWCore/components/EventHeaderCreator.h +++ b/k4FWCore/components/EventHeaderCreator.h @@ -19,7 +19,7 @@ #ifndef K4FWCORE_EVENTHEADERCREATOR #define K4FWCORE_EVENTHEADERCREATOR -#include "GaudiAlg/GaudiAlgorithm.h" +#include "Gaudi/Algorithm.h" #include "k4FWCore/DataHandle.h" /*** @@ -30,13 +30,13 @@ namespace edm4hep { class EventHeaderCollection; } -class EventHeaderCreator : public GaudiAlgorithm { +class EventHeaderCreator : public Gaudi::Algorithm { public: EventHeaderCreator(const std::string& name, ISvcLocator* svcLoc); - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); + StatusCode initialize(); + StatusCode execute(const EventContext&) const; + StatusCode finalize(); private: // Run number value (fixed for the entire job, to be set by the job submitter) @@ -46,7 +46,7 @@ class EventHeaderCreator : public GaudiAlgorithm { this, "eventNumberOffset", 0, "Event number offset, eventNumber will be filled with 'event_index + eventNumberOffset'"}; // datahandle for the EventHeader - DataHandle m_headerCol{"EventHeader", Gaudi::DataHandle::Writer, this}; + mutable DataHandle m_headerCol{"EventHeader", Gaudi::DataHandle::Writer, this}; }; #endif diff --git a/k4FWCore/components/PodioInput.cpp b/k4FWCore/components/PodioInput.cpp index dd0c6d18..168a3d75 100644 --- a/k4FWCore/components/PodioInput.cpp +++ b/k4FWCore/components/PodioInput.cpp @@ -17,7 +17,7 @@ * limitations under the License. */ #include "PodioInput.h" -#include "GaudiAlg/Consumer.h" +#include "Gaudi/Functional/Consumer.h" #include "k4FWCore/PodioDataSvc.h" diff --git a/k4FWCore/components/PodioInput.h b/k4FWCore/components/PodioInput.h index 8a72f2fe..db70b69f 100644 --- a/k4FWCore/components/PodioInput.h +++ b/k4FWCore/components/PodioInput.h @@ -19,8 +19,8 @@ #ifndef FWCORE_PODIOINPUT_H #define FWCORE_PODIOINPUT_H // Gaudi +#include "Gaudi/Functional/Consumer.h" #include "Gaudi/Property.h" -#include "GaudiAlg/Consumer.h" // STL #include diff --git a/k4FWCore/components/PodioOutput.cpp b/k4FWCore/components/PodioOutput.cpp index ea11fa68..038693ad 100644 --- a/k4FWCore/components/PodioOutput.cpp +++ b/k4FWCore/components/PodioOutput.cpp @@ -25,10 +25,10 @@ DECLARE_COMPONENT(PodioOutput) PodioOutput::PodioOutput(const std::string& name, ISvcLocator* svcLoc) - : GaudiAlgorithm(name, svcLoc), m_firstEvent(true) {} + : Gaudi::Algorithm(name, svcLoc), m_firstEvent(true) {} StatusCode PodioOutput::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) + if (Gaudi::Algorithm::initialize().isFailure()) return StatusCode::FAILURE; // check whether we have the PodioEvtSvc active @@ -44,7 +44,7 @@ StatusCode PodioOutput::initialize() { return StatusCode::SUCCESS; } -StatusCode PodioOutput::execute() { +StatusCode PodioOutput::execute(const EventContext&) const { auto& frame = m_podioDataSvc->getEventFrame(); // register for writing @@ -89,7 +89,7 @@ StatusCode PodioOutput::execute() { * */ StatusCode PodioOutput::finalize() { - if (GaudiAlgorithm::finalize().isFailure()) + if (Gaudi::Algorithm::finalize().isFailure()) return StatusCode::FAILURE; //// prepare job options metadata /////////////////////// // retrieve the configuration of the job diff --git a/k4FWCore/components/PodioOutput.h b/k4FWCore/components/PodioOutput.h index 16066004..510ef297 100644 --- a/k4FWCore/components/PodioOutput.h +++ b/k4FWCore/components/PodioOutput.h @@ -19,7 +19,7 @@ #ifndef FWCORE_PODIOOUTPUT_H #define FWCORE_PODIOOUTPUT_H -#include "GaudiAlg/GaudiAlgorithm.h" +#include "Gaudi/Algorithm.h" #include "k4FWCore/KeepDropSwitch.h" #include "podio/CollectionBase.h" #include "podio/podioVersion.h" @@ -37,22 +37,22 @@ namespace podio { // forward declarations class PodioDataSvc; -class PodioOutput : public GaudiAlgorithm { +class PodioOutput : public Gaudi::Algorithm { public: /// Constructor. PodioOutput(const std::string& name, ISvcLocator* svcLoc); /// Initialization of PodioOutput. Acquires the data service, creates trees and root file. - virtual StatusCode initialize(); + StatusCode initialize(); /// 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. - virtual StatusCode execute(); + StatusCode execute(const EventContext&) const; /// Finalize. Writes the meta data tree; writes file and cleans up all ROOT-pointers. - virtual StatusCode finalize(); + StatusCode finalize(); private: /// First event or not - bool m_firstEvent; + mutable bool m_firstEvent; /// Root file name the output is written to Gaudi::Property m_filename{this, "filename", "output.root", "Name of the file to create"}; /// Commands which output is to be kept @@ -68,7 +68,7 @@ class PodioOutput : public GaudiAlgorithm { /// The stored collections std::vector m_storedCollections; /// The collections to write out - std::vector m_collection_names_to_write; + mutable std::vector m_collection_names_to_write; }; #endif diff --git a/k4FWCore/include/k4FWCore/BaseClass.h b/k4FWCore/include/k4FWCore/BaseClass.h index d7721121..4d58f8d3 100644 --- a/k4FWCore/include/k4FWCore/BaseClass.h +++ b/k4FWCore/include/k4FWCore/BaseClass.h @@ -20,7 +20,7 @@ #ifndef K4FWCORE_FUNCTIONALUTILS_H #define K4FWCORE_FUNCTIONALUTILS_H -#include "GaudiAlg/GaudiAlgorithm.h" +#include "Gaudi/Algorithm.h" #include "GaudiKernel/DataObjectHandle.h" #include "k4FWCore/DataWrapper.h" diff --git a/k4FWCore/include/k4FWCore/MetaDataHandle.h b/k4FWCore/include/k4FWCore/MetaDataHandle.h index 17aa1e87..20b917c6 100644 --- a/k4FWCore/include/k4FWCore/MetaDataHandle.h +++ b/k4FWCore/include/k4FWCore/MetaDataHandle.h @@ -20,7 +20,7 @@ #define K4FWCORE_METADATAHANDLE_H // GAUDI -#include "GaudiAlg/GaudiAlgorithm.h" +#include "Gaudi/Algorithm.h" #include "k4FWCore/PodioDataSvc.h" #include "podio/GenericParameters.h" diff --git a/test/k4FWCoreTest/CMakeLists.txt b/test/k4FWCoreTest/CMakeLists.txt index b5feadad..cf973449 100644 --- a/test/k4FWCoreTest/CMakeLists.txt +++ b/test/k4FWCoreTest/CMakeLists.txt @@ -21,7 +21,7 @@ file(GLOB k4fwcoretest_plugin_sources src/components/*.cpp) gaudi_add_module(k4FWCoreTestPlugins SOURCES ${k4fwcoretest_plugin_sources} - LINK Gaudi::GaudiAlgLib Gaudi::GaudiKernel k4FWCore k4FWCore::k4Interface ROOT::Core ROOT::RIO ROOT::Tree EDM4HEP::edm4hepDict EDM4HEP::edm4hep) + LINK Gaudi::GaudiKernel k4FWCore k4FWCore::k4Interface ROOT::Core ROOT::RIO ROOT::Tree EDM4HEP::edm4hepDict EDM4HEP::edm4hep) include(CTest) @@ -92,7 +92,6 @@ add_test(NAME checkKeepDropSwitch COMMAND python scripts/check_KeepDropSwitch.py) set_test_env(checkKeepDropSwitch) set_property(TEST checkKeepDropSwitch APPEND PROPERTY DEPENDS ReadExampleEventData) -add_test_with_env(TestDataHandleUniquePtr options/TestDataHandleUniquePtr.py) add_test_with_env(TestUniqueIDGenSvc options/TestUniqueIDGenSvc.py) add_test_with_env(TestEventHeaderFiller options/createEventHeader.py) add_test_with_env(EventHeaderCheck options/runEventHeaderCheck.py PROPERTIES DEPENDS TestEventHeaderFiller) diff --git a/test/k4FWCoreTest/options/TestDataHandleUniquePtr.py b/test/k4FWCoreTest/options/TestDataHandleUniquePtr.py deleted file mode 100644 index 20a64de2..00000000 --- a/test/k4FWCoreTest/options/TestDataHandleUniquePtr.py +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright (c) 2014-2024 Key4hep-Project. -# -# This file is part of Key4hep. -# See https://key4hep.github.io/key4hep-doc/ for further info. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from Gaudi.Configuration import * - -from Configurables import ApplicationMgr - -ApplicationMgr().EvtSel = "NONE" -ApplicationMgr().EvtMax = 100 -ApplicationMgr().OutputLevel = INFO -ApplicationMgr().StopOnSignal = True - -from Configurables import k4DataSvc - -podioevent = k4DataSvc("EventDataSvc") -ApplicationMgr().ExtSvc += [podioevent] - -from Configurables import TestDataHandleUniquePtr - -producer = TestDataHandleUniquePtr() -ApplicationMgr().TopAlg += [producer] - -from Configurables import PodioOutput - -out = PodioOutput("out") -out.filename = "output_TestDataHandleUniquePtr.root" -out.outputCommands = ["keep *"] -ApplicationMgr().TopAlg += [out] diff --git a/test/k4FWCoreTest/src/components/ExampleEventHeaderConsumer.cpp b/test/k4FWCoreTest/src/components/ExampleEventHeaderConsumer.cpp index 3ee50615..7f1f6d70 100644 --- a/test/k4FWCoreTest/src/components/ExampleEventHeaderConsumer.cpp +++ b/test/k4FWCoreTest/src/components/ExampleEventHeaderConsumer.cpp @@ -22,8 +22,8 @@ #include "k4FWCore/BaseClass.h" +#include #include -#include #include #include diff --git a/test/k4FWCoreTest/src/components/TestDataHandleUniquePtr.cpp b/test/k4FWCoreTest/src/components/TestDataHandleUniquePtr.cpp deleted file mode 100644 index 522d415b..00000000 --- a/test/k4FWCoreTest/src/components/TestDataHandleUniquePtr.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2014-2024 Key4hep-Project. - * - * This file is part of Key4hep. - * See https://key4hep.github.io/key4hep-doc/ for further info. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "TestDataHandleUniquePtr.h" - -// datamodel -#include "edm4hep/MCParticleCollection.h" - -DECLARE_COMPONENT(TestDataHandleUniquePtr) - -TestDataHandleUniquePtr::TestDataHandleUniquePtr(const std::string& aName, ISvcLocator* aSvcLoc) - : GaudiAlgorithm(aName, aSvcLoc) { - declareProperty("mcparticles", m_mcParticleHandle, "Dummy Particle collection (output)"); -} - -TestDataHandleUniquePtr::~TestDataHandleUniquePtr() {} - -StatusCode TestDataHandleUniquePtr::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) { - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; -} - -StatusCode TestDataHandleUniquePtr::execute() { - auto coll = std::make_unique(); - - auto particle = coll->create(); - - auto& p4 = particle.getMomentum(); - p4.x = 5; - p4.y = 6; - p4.z = 7; - particle.setMass(8); - - m_mcParticleHandle.put(std::move(coll)); - - return StatusCode::SUCCESS; -} - -StatusCode TestDataHandleUniquePtr::finalize() { return GaudiAlgorithm::finalize(); } diff --git a/test/k4FWCoreTest/src/components/TestDataHandleUniquePtr.h b/test/k4FWCoreTest/src/components/TestDataHandleUniquePtr.h deleted file mode 100644 index b9f26754..00000000 --- a/test/k4FWCoreTest/src/components/TestDataHandleUniquePtr.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2014-2024 Key4hep-Project. - * - * This file is part of Key4hep. - * See https://key4hep.github.io/key4hep-doc/ for further info. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef TESTFWCORE_TESTDATAHANDLEUNIQUEPTR -#define TESTFWCORE_TESTDATAHANDLEUNIQUEPTR - -// GAUDI -#include "GaudiAlg/GaudiAlgorithm.h" - -// edm4hep -#include "TTree.h" -#include "k4FWCore/DataHandle.h" - -// datamodel -namespace edm4hep { - class MCParticleCollection; -} - -class TestDataHandleUniquePtr : public GaudiAlgorithm { -public: - explicit TestDataHandleUniquePtr(const std::string&, ISvcLocator*); - virtual ~TestDataHandleUniquePtr(); - /** Initialize. - * @return status code - */ - virtual StatusCode initialize() final; - /** Execute. - * @return status code - */ - virtual StatusCode execute() final; - /** Finalize. - * @return status code - */ - virtual StatusCode finalize() final; - -private: - DataHandle m_mcParticleHandle{"MCParticles", Gaudi::DataHandle::Writer, this}; -}; -#endif /* TESTFWCORE_TESTDATAHANDLEUNIQUEPTR */ diff --git a/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.cpp b/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.cpp index d213f2ae..00d5b677 100644 --- a/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.cpp +++ b/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.cpp @@ -21,12 +21,12 @@ DECLARE_COMPONENT(TestUniqueIDGenSvc) TestUniqueIDGenSvc::TestUniqueIDGenSvc(const std::string& aName, ISvcLocator* aSvcLoc) - : GaudiAlgorithm(aName, aSvcLoc) {} + : Gaudi::Algorithm(aName, aSvcLoc) {} TestUniqueIDGenSvc::~TestUniqueIDGenSvc() {} StatusCode TestUniqueIDGenSvc::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) { + if (Gaudi::Algorithm::initialize().isFailure()) { return StatusCode::FAILURE; } @@ -35,7 +35,7 @@ StatusCode TestUniqueIDGenSvc::initialize() { return StatusCode::SUCCESS; } -StatusCode TestUniqueIDGenSvc::execute() { +StatusCode TestUniqueIDGenSvc::execute(const EventContext&) const { uint evt_num = 4; uint run_num = 3; std::string name = "Some algorithm name"; @@ -50,4 +50,4 @@ StatusCode TestUniqueIDGenSvc::execute() { return StatusCode::SUCCESS; } -StatusCode TestUniqueIDGenSvc::finalize() { return GaudiAlgorithm::finalize(); } +StatusCode TestUniqueIDGenSvc::finalize() { return Gaudi::Algorithm::finalize(); } diff --git a/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.h b/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.h index 6f0aaab2..df56c683 100644 --- a/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.h +++ b/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.h @@ -20,11 +20,11 @@ #define TEST_UNIQUEIDGENSVC_H // GAUDI -#include +#include #include "k4Interface/IUniqueIDGenSvc.h" -class TestUniqueIDGenSvc : public GaudiAlgorithm { +class TestUniqueIDGenSvc : public Gaudi::Algorithm { public: explicit TestUniqueIDGenSvc(const std::string&, ISvcLocator*); virtual ~TestUniqueIDGenSvc(); @@ -35,7 +35,7 @@ class TestUniqueIDGenSvc : public GaudiAlgorithm { /** Execute. * @return status code */ - virtual StatusCode execute() final; + virtual StatusCode execute(const EventContext&) const final; /** Finalize. * @return status code */ diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.cpp index ae879c5b..d93b2347 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.cpp +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.cpp @@ -25,15 +25,17 @@ DECLARE_COMPONENT(k4FWCoreTest_AlgorithmWithTFile) k4FWCoreTest_AlgorithmWithTFile::k4FWCoreTest_AlgorithmWithTFile(const std::string& aName, ISvcLocator* aSvcLoc) - : GaudiAlgorithm(aName, aSvcLoc) { + : Gaudi::Algorithm(aName, aSvcLoc) { declareProperty("mcparticles", m_mcParticleHandle, "Dummy Particle collection (output)"); declareProperty("trackhits", m_simTrackerHitHandle, "Dummy Hit collection (output)"); + // Set Cardinality to 1 because this algorithm is not prepared to run in parallel + setProperty("Cardinality", 1).ignore(); } k4FWCoreTest_AlgorithmWithTFile::~k4FWCoreTest_AlgorithmWithTFile() {} StatusCode k4FWCoreTest_AlgorithmWithTFile::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) { + if (Gaudi::Algorithm::initialize().isFailure()) { return StatusCode::FAILURE; } @@ -47,7 +49,7 @@ StatusCode k4FWCoreTest_AlgorithmWithTFile::initialize() { return StatusCode::SUCCESS; } -StatusCode k4FWCoreTest_AlgorithmWithTFile::execute() { +StatusCode k4FWCoreTest_AlgorithmWithTFile::execute(const EventContext&) const { auto* floatVector = m_vectorFloatHandle.createAndPut(); floatVector->push_back(125.); floatVector->push_back(25.); @@ -79,5 +81,5 @@ StatusCode k4FWCoreTest_AlgorithmWithTFile::finalize() { m_tree->Write(); m_file->Close(); - return GaudiAlgorithm::finalize(); + return Gaudi::Algorithm::finalize(); } diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.h b/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.h index 37b43a83..753ac0a6 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.h +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_AlgorithmWithTFile.h @@ -20,7 +20,7 @@ #define K4FWCORE_K4FWCORETEST_ALGORITHMWITHTFILE // GAUDI -#include "GaudiAlg/GaudiAlgorithm.h" +#include "Gaudi/Algorithm.h" // edm4hep #include "TFile.h" @@ -41,7 +41,7 @@ namespace edm4hep { * a user-declared TFile when using the PodioDataSvc * */ -class k4FWCoreTest_AlgorithmWithTFile : public GaudiAlgorithm { +class k4FWCoreTest_AlgorithmWithTFile : public Gaudi::Algorithm { public: explicit k4FWCoreTest_AlgorithmWithTFile(const std::string&, ISvcLocator*); virtual ~k4FWCoreTest_AlgorithmWithTFile(); @@ -52,7 +52,7 @@ class k4FWCoreTest_AlgorithmWithTFile : public GaudiAlgorithm { /** Execute. * @return status code */ - virtual StatusCode execute() final; + virtual StatusCode execute(const EventContext&) const final; /** Finalize. * @return status code */ @@ -63,15 +63,17 @@ class k4FWCoreTest_AlgorithmWithTFile : public GaudiAlgorithm { Gaudi::Property m_magicNumberOffset{this, "magicNumberOffset", 0, "Integer to add to the dummy values written to the edm"}; /// Handle for the genparticles to be written - DataHandle m_mcParticleHandle{"MCParticles", Gaudi::DataHandle::Writer, this}; + mutable DataHandle m_mcParticleHandle{"MCParticles", Gaudi::DataHandle::Writer, this}; /// Handle for the genvertices to be written - DataHandle m_simTrackerHitHandle{"SimTrackerHit", Gaudi::DataHandle::Writer, this}; + mutable DataHandle m_simTrackerHitHandle{"SimTrackerHit", Gaudi::DataHandle::Writer, + this}; - DataHandle> m_vectorFloatHandle{"VectorFloat", Gaudi::DataHandle::Writer, this}; + mutable DataHandle> m_vectorFloatHandle{"VectorFloat", Gaudi::DataHandle::Writer, + this}; /// for testing: write a second TFile by user in an algorithm - Float_t m_value; - TFile* m_file; - TTree* m_tree; + mutable Float_t m_value; + TFile* m_file; + TTree* m_tree; }; #endif /* K4FWCORE_K4FWCORETEST_ALGORITHMWITHTFILE */ diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp index 38be7565..f53615cb 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.cpp @@ -17,7 +17,7 @@ * limitations under the License. */ #include "k4FWCoreTest_CheckExampleEventData.h" -#include +#include // datamodel #include "edm4hep/MCParticleCollection.h" @@ -36,14 +36,16 @@ namespace edm4hep { DECLARE_COMPONENT(k4FWCoreTest_CheckExampleEventData) k4FWCoreTest_CheckExampleEventData::k4FWCoreTest_CheckExampleEventData(const std::string& aName, ISvcLocator* aSvcLoc) - : GaudiAlgorithm(aName, aSvcLoc) { + : Gaudi::Algorithm(aName, aSvcLoc) { declareProperty("mcparticles", m_mcParticleHandle, "Dummy Particle collection (output)"); declareProperty("vectorfloat", m_vectorFloatHandle, "Dummy collection (output)"); + // Set Cardinality to 1 because this algorithm is not prepared to run in parallel + setProperty("Cardinality", 1).ignore(); } -StatusCode k4FWCoreTest_CheckExampleEventData::initialize() { return GaudiAlgorithm::initialize(); } +StatusCode k4FWCoreTest_CheckExampleEventData::initialize() { return Gaudi::Algorithm::initialize(); } -StatusCode k4FWCoreTest_CheckExampleEventData::execute() { +StatusCode k4FWCoreTest_CheckExampleEventData::execute(const EventContext&) const { auto floatVector = m_vectorFloatHandle.get(); if (floatVector->size() != 3 || (*floatVector)[2] != m_event) { fatal() << "Contents of vectorfloat collection is not as expected: size = " << floatVector->size() @@ -67,4 +69,4 @@ StatusCode k4FWCoreTest_CheckExampleEventData::execute() { return StatusCode::SUCCESS; } -StatusCode k4FWCoreTest_CheckExampleEventData::finalize() { return GaudiAlgorithm::finalize(); } +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 92fe7ba0..7e5a5970 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.h +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CheckExampleEventData.h @@ -22,7 +22,7 @@ #include "k4FWCore/DataHandle.h" // GAUDI -#include "GaudiAlg/GaudiAlgorithm.h" +#include "Gaudi/Algorithm.h" #include "podio/UserDataCollection.h" @@ -31,7 +31,7 @@ namespace edm4hep { class MCParticleCollection; } // namespace edm4hep -class k4FWCoreTest_CheckExampleEventData : public GaudiAlgorithm { +class k4FWCoreTest_CheckExampleEventData : public Gaudi::Algorithm { public: explicit k4FWCoreTest_CheckExampleEventData(const std::string&, ISvcLocator*); ~k4FWCoreTest_CheckExampleEventData() = default; @@ -42,7 +42,7 @@ class k4FWCoreTest_CheckExampleEventData : public GaudiAlgorithm { /** Execute. * @return status code */ - virtual StatusCode execute() final; + virtual StatusCode execute(const EventContext&) const final; /** Finalize. * @return status code */ @@ -55,10 +55,11 @@ class k4FWCoreTest_CheckExampleEventData : public GaudiAlgorithm { Gaudi::Property m_keepEventNumberZero{this, "keepEventNumberZero", false, "Don't add the event number to the dummy values written"}; /// Handle for the MCParticles to be written - DataHandle m_mcParticleHandle{"MCParticles", Gaudi::DataHandle::Reader, this}; - DataHandle> m_vectorFloatHandle{"VectorFloat", Gaudi::DataHandle::Reader, this}; + mutable DataHandle m_mcParticleHandle{"MCParticles", Gaudi::DataHandle::Reader, this}; + mutable DataHandle> m_vectorFloatHandle{"VectorFloat", Gaudi::DataHandle::Reader, + this}; - int m_event{0}; + mutable int m_event{0}; }; #endif // K4FWCORE_K4FWCORETEST_CHECKEEXAMPLEEVENTDATA diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp index 635bfa42..3ecf4e9d 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.cpp @@ -36,24 +36,26 @@ DECLARE_COMPONENT(k4FWCoreTest_CreateExampleEventData) k4FWCoreTest_CreateExampleEventData::k4FWCoreTest_CreateExampleEventData(const std::string& aName, ISvcLocator* aSvcLoc) - : GaudiAlgorithm(aName, aSvcLoc) { + : Gaudi::Algorithm(aName, aSvcLoc) { declareProperty("mcparticles", m_mcParticleHandle, "Dummy Particle collection (output)"); declareProperty("simtrackhits", m_simTrackerHitHandle, "Dummy Hit collection (output)"); declareProperty("trackhits", m_TrackerHitHandle, "Dummy Hit collection (output)"); declareProperty("tracks", m_trackHandle, "Dummy track collection (output)"); declareProperty("vectorfloat", m_vectorFloatHandle, "Dummy collection (output)"); + // Set Cardinality to 1 because this algorithm is not prepared to run in parallel + setProperty("Cardinality", 1).ignore(); } k4FWCoreTest_CreateExampleEventData::~k4FWCoreTest_CreateExampleEventData() {} StatusCode k4FWCoreTest_CreateExampleEventData::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) { + if (Gaudi::Algorithm::initialize().isFailure()) { return StatusCode::FAILURE; } return StatusCode::SUCCESS; } -StatusCode k4FWCoreTest_CreateExampleEventData::execute() { +StatusCode k4FWCoreTest_CreateExampleEventData::execute(const EventContext&) const { auto* floatVector = m_vectorFloatHandle.createAndPut(); floatVector->push_back(125.); floatVector->push_back(25.); @@ -105,4 +107,4 @@ StatusCode k4FWCoreTest_CreateExampleEventData::execute() { return StatusCode::SUCCESS; } -StatusCode k4FWCoreTest_CreateExampleEventData::finalize() { return GaudiAlgorithm::finalize(); } +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 2aa3d3bd..2caed1aa 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_CreateExampleEventData.h @@ -20,7 +20,7 @@ #define K4FWCORE_K4FWCORETEST_CREATEEXAMPLEEVENTDATA // GAUDI -#include "GaudiAlg/GaudiAlgorithm.h" +#include "Gaudi/Algorithm.h" // key4hep #include "k4FWCore/DataHandle.h" @@ -53,7 +53,7 @@ namespace edm4hep { * events can be easily distinguished. * */ -class k4FWCoreTest_CreateExampleEventData : public GaudiAlgorithm { +class k4FWCoreTest_CreateExampleEventData : public Gaudi::Algorithm { public: explicit k4FWCoreTest_CreateExampleEventData(const std::string&, ISvcLocator*); virtual ~k4FWCoreTest_CreateExampleEventData(); @@ -64,7 +64,7 @@ class k4FWCoreTest_CreateExampleEventData : public GaudiAlgorithm { /** Execute. * @return status code */ - virtual StatusCode execute() final; + virtual StatusCode execute(const EventContext&) const final; /** Finalize. * @return status code */ @@ -75,16 +75,19 @@ class k4FWCoreTest_CreateExampleEventData : public GaudiAlgorithm { Gaudi::Property m_magicNumberOffset{this, "magicNumberOffset", 0, "Integer to add to the dummy values written to the edm"}; /// Handle for the MCParticles to be written - DataHandle m_mcParticleHandle{"MCParticles", Gaudi::DataHandle::Writer, this}; + mutable DataHandle m_mcParticleHandle{"MCParticles", Gaudi::DataHandle::Writer, this}; /// Handle for the SimTrackerHits to be written - DataHandle m_simTrackerHitHandle{"SimTrackerHits", Gaudi::DataHandle::Writer, this}; - DataHandle m_TrackerHitHandle{"TrackerHits", Gaudi::DataHandle::Writer, this}; + mutable DataHandle m_simTrackerHitHandle{"SimTrackerHits", + Gaudi::DataHandle::Writer, this}; + mutable DataHandle m_TrackerHitHandle{"TrackerHits", Gaudi::DataHandle::Writer, + this}; /// Handle for the Tracks to be written - DataHandle m_trackHandle{"Tracks", Gaudi::DataHandle::Writer, this}; + mutable DataHandle m_trackHandle{"Tracks", Gaudi::DataHandle::Writer, this}; - DataHandle> m_vectorFloatHandle{"VectorFloat", Gaudi::DataHandle::Writer, this}; + mutable DataHandle> m_vectorFloatHandle{"VectorFloat", Gaudi::DataHandle::Writer, + this}; - int m_event{0}; + mutable int m_event{0}; }; #endif /* K4FWCORE_K4FWCORETEST_CREATEEXAMPLEEVENTDATA */ diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.cpp index 972c08d5..a576a298 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.cpp +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.cpp @@ -22,18 +22,21 @@ DECLARE_COMPONENT(k4FWCoreTest_HelloWorldAlg) k4FWCoreTest_HelloWorldAlg::k4FWCoreTest_HelloWorldAlg(const std::string& aName, ISvcLocator* aSvcLoc) - : GaudiAlgorithm(aName, aSvcLoc) {} + : Gaudi::Algorithm(aName, aSvcLoc) { + // Set Cardinality to 1 because this algorithm is not prepared to run in parallel + setProperty("Cardinality", 1).ignore(); +} k4FWCoreTest_HelloWorldAlg::~k4FWCoreTest_HelloWorldAlg() {} StatusCode k4FWCoreTest_HelloWorldAlg::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) { + if (Gaudi::Algorithm::initialize().isFailure()) { return StatusCode::FAILURE; } return StatusCode::SUCCESS; } -StatusCode k4FWCoreTest_HelloWorldAlg::execute() { +StatusCode k4FWCoreTest_HelloWorldAlg::execute(const EventContext&) const { info() << endmsg; info() << endmsg; info() << theMessage << endmsg; @@ -42,4 +45,4 @@ StatusCode k4FWCoreTest_HelloWorldAlg::execute() { return StatusCode::SUCCESS; } -StatusCode k4FWCoreTest_HelloWorldAlg::finalize() { return GaudiAlgorithm::finalize(); } +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 6c90a808..4a39f4fc 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.h +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_HelloWorldAlg.h @@ -20,10 +20,10 @@ #define K4FWCORE_K4FWCORETEST_HELLOWORLDALG // GAUDI +#include "Gaudi/Algorithm.h" #include "Gaudi/Property.h" -#include "GaudiAlg/GaudiAlgorithm.h" -class k4FWCoreTest_HelloWorldAlg : public GaudiAlgorithm { +class k4FWCoreTest_HelloWorldAlg : public Gaudi::Algorithm { public: explicit k4FWCoreTest_HelloWorldAlg(const std::string&, ISvcLocator*); virtual ~k4FWCoreTest_HelloWorldAlg(); @@ -34,7 +34,7 @@ class k4FWCoreTest_HelloWorldAlg : public GaudiAlgorithm { /** Execute. * @return status code */ - virtual StatusCode execute() final; + virtual StatusCode execute(const EventContext&) const final; /** Finalize. * @return status code */ diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.cpp index 04dd9d17..4e6ac18e 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.cpp +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.cpp @@ -22,21 +22,23 @@ DECLARE_COMPONENT(k4FWCoreTest_cellID_reader) k4FWCoreTest_cellID_reader::k4FWCoreTest_cellID_reader(const std::string& aName, ISvcLocator* aSvcLoc) - : GaudiAlgorithm(aName, aSvcLoc) { + : Gaudi::Algorithm(aName, aSvcLoc) { ; declareProperty("simtrackhits_r", m_simTrackerHitReaderHandle, "Dummy Hit collection Reader"); + // Set Cardinality to 1 because this algorithm is not prepared to run in parallel + setProperty("Cardinality", 1).ignore(); } k4FWCoreTest_cellID_reader::~k4FWCoreTest_cellID_reader() {} StatusCode k4FWCoreTest_cellID_reader::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) { + if (Gaudi::Algorithm::initialize().isFailure()) { return StatusCode::FAILURE; } return StatusCode::SUCCESS; } -StatusCode k4FWCoreTest_cellID_reader::execute() { +StatusCode k4FWCoreTest_cellID_reader::execute(const EventContext&) const { const auto simtrackerhits_coll = m_simTrackerHitReaderHandle.get(); auto collID = simtrackerhits_coll->getID(); @@ -49,4 +51,4 @@ StatusCode k4FWCoreTest_cellID_reader::execute() { return StatusCode::SUCCESS; } -StatusCode k4FWCoreTest_cellID_reader::finalize() { return GaudiAlgorithm::finalize(); } +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 b80750fd..f6541243 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.h +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_reader.h @@ -20,7 +20,7 @@ #define K4FWCORE_K4FWCORETEST_CELLID_READER // GAUDI -#include "GaudiAlg/GaudiAlgorithm.h" +#include "Gaudi/Algorithm.h" // key4hep #include "k4FWCore/DataHandle.h" @@ -34,7 +34,7 @@ /** @class k4FWCoreTest_cellID * Lightweight reader for edm data to test cellID reading */ -class k4FWCoreTest_cellID_reader : public GaudiAlgorithm { +class k4FWCoreTest_cellID_reader : public Gaudi::Algorithm { public: explicit k4FWCoreTest_cellID_reader(const std::string&, ISvcLocator*); virtual ~k4FWCoreTest_cellID_reader(); @@ -45,7 +45,7 @@ class k4FWCoreTest_cellID_reader : public GaudiAlgorithm { /** Execute. * @return status code */ - virtual StatusCode execute() final; + virtual StatusCode execute(const EventContext&) const final; /** Finalize. * @return status code */ @@ -53,9 +53,9 @@ class k4FWCoreTest_cellID_reader : public GaudiAlgorithm { private: /// Handle for the SimTrackerHits to be read - DataHandle m_simTrackerHitReaderHandle{"SimTrackerHits", Gaudi::DataHandle::Reader, - this}; - MetaDataHandle m_cellIDHandle{m_simTrackerHitReaderHandle, edm4hep::CellIDEncoding, - Gaudi::DataHandle::Reader}; + mutable DataHandle m_simTrackerHitReaderHandle{"SimTrackerHits", + Gaudi::DataHandle::Reader, this}; + mutable MetaDataHandle m_cellIDHandle{m_simTrackerHitReaderHandle, edm4hep::CellIDEncoding, + Gaudi::DataHandle::Reader}; }; #endif /* K4FWCORE_K4FWCORETEST_CELLID */ diff --git a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.cpp b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.cpp index 7e832fbc..ea83fd5a 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.cpp +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.cpp @@ -21,15 +21,17 @@ DECLARE_COMPONENT(k4FWCoreTest_cellID_writer) k4FWCoreTest_cellID_writer::k4FWCoreTest_cellID_writer(const std::string& aName, ISvcLocator* aSvcLoc) - : GaudiAlgorithm(aName, aSvcLoc) { + : Gaudi::Algorithm(aName, aSvcLoc) { ; declareProperty("simtrackhits_w", m_simTrackerHitWriterHandle, "Dummy Hit collection Writer"); + // Set Cardinality to 1 because this algorithm is not prepared to run in parallel + setProperty("Cardinality", 1).ignore(); } k4FWCoreTest_cellID_writer::~k4FWCoreTest_cellID_writer() {} StatusCode k4FWCoreTest_cellID_writer::initialize() { - if (GaudiAlgorithm::initialize().isFailure()) { + if (Gaudi::Algorithm::initialize().isFailure()) { return StatusCode::FAILURE; } m_cellIDHandle.put(cellIDtest); @@ -37,7 +39,7 @@ StatusCode k4FWCoreTest_cellID_writer::initialize() { return StatusCode::SUCCESS; } -StatusCode k4FWCoreTest_cellID_writer::execute() { +StatusCode k4FWCoreTest_cellID_writer::execute(const EventContext&) const { edm4hep::SimTrackerHitCollection* simTrackerHits = m_simTrackerHitWriterHandle.createAndPut(); auto hit = simTrackerHits->create(); hit.setPosition({3, 4, 5}); @@ -45,4 +47,4 @@ StatusCode k4FWCoreTest_cellID_writer::execute() { return StatusCode::SUCCESS; } -StatusCode k4FWCoreTest_cellID_writer::finalize() { return GaudiAlgorithm::finalize(); } +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 1ab93994..824e48dd 100644 --- a/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.h +++ b/test/k4FWCoreTest/src/components/k4FWCoreTest_cellID_writer.h @@ -20,7 +20,7 @@ #define K4FWCORE_K4FWCORETEST_CELLID_WRITER // GAUDI -#include "GaudiAlg/GaudiAlgorithm.h" +#include "Gaudi/Algorithm.h" // key4hep #include "k4FWCore/DataHandle.h" @@ -36,7 +36,7 @@ const std::string cellIDtest = "M:3,S-1:3,I:9,J:9,K-1:6"; /** @class k4FWCoreTest_cellID * Lightweight producer for edm data to test cellID */ -class k4FWCoreTest_cellID_writer : public GaudiAlgorithm { +class k4FWCoreTest_cellID_writer : public Gaudi::Algorithm { public: explicit k4FWCoreTest_cellID_writer(const std::string&, ISvcLocator*); virtual ~k4FWCoreTest_cellID_writer(); @@ -47,7 +47,7 @@ class k4FWCoreTest_cellID_writer : public GaudiAlgorithm { /** Execute. * @return status code */ - virtual StatusCode execute() final; + virtual StatusCode execute(const EventContext&) const final; /** Finalize. * @return status code */ @@ -55,9 +55,9 @@ class k4FWCoreTest_cellID_writer : public GaudiAlgorithm { private: /// Handle for the SimTrackerHits to be written - DataHandle m_simTrackerHitWriterHandle{"SimTrackerHits", Gaudi::DataHandle::Writer, - this}; - MetaDataHandle m_cellIDHandle{m_simTrackerHitWriterHandle, edm4hep::CellIDEncoding, + mutable DataHandle m_simTrackerHitWriterHandle{"SimTrackerHits", + Gaudi::DataHandle::Writer, this}; + MetaDataHandle m_cellIDHandle{m_simTrackerHitWriterHandle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Writer}; }; #endif /* K4FWCORE_K4FWCORETEST_CELLID_WRITER */