From 5c45f3c01e59026d223495457d917a87e750abac Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 9 Oct 2024 10:39:07 +0200 Subject: [PATCH 01/11] Use bit manipulation with the UniqueIDGenSvc and add a check for the case where an ID is repeated. --- k4FWCore/components/UniqueIDGenSvc.cpp | 44 ++++++++++++++----- k4FWCore/components/UniqueIDGenSvc.h | 13 +++--- .../include/k4Interface/IUniqueIDGenSvc.h | 3 -- test/k4FWCoreTest/CMakeLists.txt | 1 + 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/k4FWCore/components/UniqueIDGenSvc.cpp b/k4FWCore/components/UniqueIDGenSvc.cpp index 5f6f0f7b..d108594d 100644 --- a/k4FWCore/components/UniqueIDGenSvc.cpp +++ b/k4FWCore/components/UniqueIDGenSvc.cpp @@ -18,27 +18,47 @@ */ #include "UniqueIDGenSvc.h" +#include +#include + DECLARE_COMPONENT(UniqueIDGenSvc) UniqueIDGenSvc::UniqueIDGenSvc(const std::string& name, ISvcLocator* svcLoc) : base_class(name, svcLoc) {} -StatusCode UniqueIDGenSvc::initialize() { - StatusCode sc = Service::initialize(); - return sc; -} - -const size_t bits32 = std::numeric_limits::digits; -const size_t bits64 = std::numeric_limits::digits; -const size_t bitsSizeT = std::numeric_limits::digits; +constexpr size_t bits32 = std::numeric_limits::digits; +constexpr size_t bits64 = std::numeric_limits::digits; +constexpr size_t bitsSizeT = std::numeric_limits::digits; size_t UniqueIDGenSvc::getUniqueID(uint32_t evt_num, uint32_t run_num, const std::string& name) const { - std::bitset seed_bits(this->m_seed); + std::bitset seed_bits = this->m_seed.value(); std::bitset event_num_bits(evt_num), run_num_bits(run_num); size_t str_hash = std::hash{}(name); std::bitset name_bits(str_hash); - std::bitset combined_bits(seed_bits.to_string() + event_num_bits.to_string() + - run_num_bits.to_string() + name_bits.to_string()); + std::bitset combined_bits; + + for (size_t i = 0; i < bits64; i++) { + combined_bits[i + bits32 + bits32 + bitsSizeT] = seed_bits[i]; + } + for (size_t i = 0; i < bits32; i++) { + combined_bits[i + bits32 + bitsSizeT] = event_num_bits[i]; + } + for (size_t i = 0; i < bits32; i++) { + combined_bits[i + bitsSizeT] = run_num_bits[i]; + } + for (size_t i = 0; i < bitsSizeT; i++) { + combined_bits[i] = name_bits[i]; + } + + auto hash = std::hash>{}(combined_bits); + std::lock_guard lock(m_mutex); + if (m_uniqueIDs.contains(hash)) { + warning() << "Event number " << evt_num << ", run number " << run_num << " and algorithm name \"" << name + << "\" have already been used. Please check the uniqueness of the event number, run number and name." + << endmsg; + } else { + m_uniqueIDs.insert(hash); + } - return std::hash>{}(combined_bits); + return hash; } diff --git a/k4FWCore/components/UniqueIDGenSvc.h b/k4FWCore/components/UniqueIDGenSvc.h index 966fbd99..795bf414 100644 --- a/k4FWCore/components/UniqueIDGenSvc.h +++ b/k4FWCore/components/UniqueIDGenSvc.h @@ -19,11 +19,13 @@ #ifndef FWCORE_UNIQUEIDGENSVC_H #define FWCORE_UNIQUEIDGENSVC_H +#include "GaudiKernel/Service.h" +#include "k4Interface/IUniqueIDGenSvc.h" + #include +#include #include - -#include -#include "k4Interface/IUniqueIDGenSvc.h" +#include /** @class UniqueIDGenSvc * Generate unique, reproducible numbers using @@ -34,11 +36,12 @@ class UniqueIDGenSvc : public extends { public: UniqueIDGenSvc(const std::string& name, ISvcLocator* svcLoc); - StatusCode initialize() override; size_t getUniqueID(uint32_t evt_num, uint32_t run_num, const std::string& name) const override; private: - Gaudi::Property m_seed{this, "Seed", {123456789}}; + Gaudi::Property m_seed{this, "Seed", {123456789}}; + mutable std::unordered_set m_uniqueIDs; + mutable std::mutex m_mutex; }; #endif diff --git a/k4Interface/include/k4Interface/IUniqueIDGenSvc.h b/k4Interface/include/k4Interface/IUniqueIDGenSvc.h index c7a8bf07..913f18b4 100644 --- a/k4Interface/include/k4Interface/IUniqueIDGenSvc.h +++ b/k4Interface/include/k4Interface/IUniqueIDGenSvc.h @@ -19,10 +19,7 @@ #ifndef FWCORE_IUNIQUEIDGENSVC_H #define FWCORE_IUNIQUEIDGENSVC_H -#include #include -#include -#include #include #include diff --git a/test/k4FWCoreTest/CMakeLists.txt b/test/k4FWCoreTest/CMakeLists.txt index 2bb2cb47..0f44272c 100644 --- a/test/k4FWCoreTest/CMakeLists.txt +++ b/test/k4FWCoreTest/CMakeLists.txt @@ -126,6 +126,7 @@ add_test(NAME checkKeepDropSwitch set_test_env(checkKeepDropSwitch) set_property(TEST checkKeepDropSwitch APPEND PROPERTY DEPENDS ReadExampleEventData) add_test_with_env(TestUniqueIDGenSvc options/TestUniqueIDGenSvc.py) +add_test_with_env(TestUniqueIDGenSvcRepeated options/TestUniqueIDGenSvc.py PROPERTIES PASS_REGULAR_EXPRESSION "WARNING *Event number 4, run number 3 and algorithm name \"Some algorithm name\" have already been used. Please check the uniqueness of the event number, run number and name.") add_test_with_env(TestEventHeaderFiller options/createEventHeader.py) add_test_with_env(EventHeaderCheck options/runEventHeaderCheck.py PROPERTIES DEPENDS TestEventHeaderFiller) add_test(NAME TestExec WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} COMMAND python options/TestExec.py) From e4773ec80f3be5e3270b657b0fc47f7bd70e21ea Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 9 Oct 2024 10:42:47 +0200 Subject: [PATCH 02/11] Fix pre-commit --- k4FWCore/components/UniqueIDGenSvc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k4FWCore/components/UniqueIDGenSvc.cpp b/k4FWCore/components/UniqueIDGenSvc.cpp index d108594d..c6a1a677 100644 --- a/k4FWCore/components/UniqueIDGenSvc.cpp +++ b/k4FWCore/components/UniqueIDGenSvc.cpp @@ -50,7 +50,7 @@ size_t UniqueIDGenSvc::getUniqueID(uint32_t evt_num, uint32_t run_num, const std combined_bits[i] = name_bits[i]; } - auto hash = std::hash>{}(combined_bits); + auto hash = std::hash>{}(combined_bits); std::lock_guard lock(m_mutex); if (m_uniqueIDs.contains(hash)) { warning() << "Event number " << evt_num << ", run number " << run_num << " and algorithm name \"" << name From cb60ae4000c06cf21c9d84b50ead87d8de3c7deb Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 9 Oct 2024 10:43:12 +0200 Subject: [PATCH 03/11] Move DECLARE_COMPONENT to the bottom for readability --- k4FWCore/components/UniqueIDGenSvc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/k4FWCore/components/UniqueIDGenSvc.cpp b/k4FWCore/components/UniqueIDGenSvc.cpp index c6a1a677..bda34edd 100644 --- a/k4FWCore/components/UniqueIDGenSvc.cpp +++ b/k4FWCore/components/UniqueIDGenSvc.cpp @@ -21,8 +21,6 @@ #include #include -DECLARE_COMPONENT(UniqueIDGenSvc) - UniqueIDGenSvc::UniqueIDGenSvc(const std::string& name, ISvcLocator* svcLoc) : base_class(name, svcLoc) {} constexpr size_t bits32 = std::numeric_limits::digits; @@ -62,3 +60,5 @@ size_t UniqueIDGenSvc::getUniqueID(uint32_t evt_num, uint32_t run_num, const std return hash; } + +DECLARE_COMPONENT(UniqueIDGenSvc) From cc5403401839d0513651bdffd2e15b9521d2621a Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 9 Oct 2024 10:45:58 +0200 Subject: [PATCH 04/11] Fix pre-commit --- k4FWCore/components/UniqueIDGenSvc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/k4FWCore/components/UniqueIDGenSvc.h b/k4FWCore/components/UniqueIDGenSvc.h index 795bf414..e3976fd5 100644 --- a/k4FWCore/components/UniqueIDGenSvc.h +++ b/k4FWCore/components/UniqueIDGenSvc.h @@ -36,12 +36,12 @@ class UniqueIDGenSvc : public extends { public: UniqueIDGenSvc(const std::string& name, ISvcLocator* svcLoc); - size_t getUniqueID(uint32_t evt_num, uint32_t run_num, const std::string& name) const override; + size_t getUniqueID(uint32_t evt_num, uint32_t run_num, const std::string& name) const override; private: - Gaudi::Property m_seed{this, "Seed", {123456789}}; + Gaudi::Property m_seed{this, "Seed", {123456789}}; mutable std::unordered_set m_uniqueIDs; - mutable std::mutex m_mutex; + mutable std::mutex m_mutex; }; #endif From 5302833b16d1e87c8b501b3160bb58988464504c Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 9 Oct 2024 11:05:27 +0200 Subject: [PATCH 05/11] Use = instead of () for assignments (for style) --- k4FWCore/components/UniqueIDGenSvc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/k4FWCore/components/UniqueIDGenSvc.cpp b/k4FWCore/components/UniqueIDGenSvc.cpp index bda34edd..b93c2598 100644 --- a/k4FWCore/components/UniqueIDGenSvc.cpp +++ b/k4FWCore/components/UniqueIDGenSvc.cpp @@ -29,9 +29,9 @@ constexpr size_t bitsSizeT = std::numeric_limits::digits; size_t UniqueIDGenSvc::getUniqueID(uint32_t evt_num, uint32_t run_num, const std::string& name) const { std::bitset seed_bits = this->m_seed.value(); - std::bitset event_num_bits(evt_num), run_num_bits(run_num); + std::bitset event_num_bits = evt_num, run_num_bits = run_num; size_t str_hash = std::hash{}(name); - std::bitset name_bits(str_hash); + std::bitset name_bits = str_hash; std::bitset combined_bits; From 1994069e53cfe9700be5889241bf21db1451c099 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 9 Oct 2024 11:05:53 +0200 Subject: [PATCH 06/11] Fix pre-commit --- k4FWCore/components/UniqueIDGenSvc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/k4FWCore/components/UniqueIDGenSvc.cpp b/k4FWCore/components/UniqueIDGenSvc.cpp index b93c2598..f92132d1 100644 --- a/k4FWCore/components/UniqueIDGenSvc.cpp +++ b/k4FWCore/components/UniqueIDGenSvc.cpp @@ -28,9 +28,9 @@ constexpr size_t bits64 = std::numeric_limits::digits; constexpr size_t bitsSizeT = std::numeric_limits::digits; size_t UniqueIDGenSvc::getUniqueID(uint32_t evt_num, uint32_t run_num, const std::string& name) const { - std::bitset seed_bits = this->m_seed.value(); + std::bitset seed_bits = this->m_seed.value(); std::bitset event_num_bits = evt_num, run_num_bits = run_num; - size_t str_hash = std::hash{}(name); + size_t str_hash = std::hash{}(name); std::bitset name_bits = str_hash; std::bitset combined_bits; From 69248a70859ec8c1522c8bcb764a3bfd8976c6ad Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:49:30 +0200 Subject: [PATCH 07/11] Update k4FWCore/components/UniqueIDGenSvc.cpp Co-authored-by: Thomas Madlener --- k4FWCore/components/UniqueIDGenSvc.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/k4FWCore/components/UniqueIDGenSvc.cpp b/k4FWCore/components/UniqueIDGenSvc.cpp index f92132d1..cd390e31 100644 --- a/k4FWCore/components/UniqueIDGenSvc.cpp +++ b/k4FWCore/components/UniqueIDGenSvc.cpp @@ -49,13 +49,15 @@ size_t UniqueIDGenSvc::getUniqueID(uint32_t evt_num, uint32_t run_num, const std } auto hash = std::hash>{}(combined_bits); - std::lock_guard lock(m_mutex); - if (m_uniqueIDs.contains(hash)) { + bool inserted = false; + { + std::lock_guard lock(m_mutex); + std::tie(std::ignore, inserted), = m_uniqueIDs.insert(hash); + } + if (!inserted) { warning() << "Event number " << evt_num << ", run number " << run_num << " and algorithm name \"" << name << "\" have already been used. Please check the uniqueness of the event number, run number and name." << endmsg; - } else { - m_uniqueIDs.insert(hash); } return hash; From 50a4e6ddfa0038f18595aaa12df494699547396b Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 9 Oct 2024 11:50:24 +0200 Subject: [PATCH 08/11] Change the order of the loops --- k4FWCore/components/UniqueIDGenSvc.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/k4FWCore/components/UniqueIDGenSvc.cpp b/k4FWCore/components/UniqueIDGenSvc.cpp index cd390e31..cd55f0ab 100644 --- a/k4FWCore/components/UniqueIDGenSvc.cpp +++ b/k4FWCore/components/UniqueIDGenSvc.cpp @@ -35,17 +35,17 @@ size_t UniqueIDGenSvc::getUniqueID(uint32_t evt_num, uint32_t run_num, const std std::bitset combined_bits; - for (size_t i = 0; i < bits64; i++) { - combined_bits[i + bits32 + bits32 + bitsSizeT] = seed_bits[i]; + for (size_t i = 0; i < bitsSizeT; i++) { + combined_bits[i] = name_bits[i]; } for (size_t i = 0; i < bits32; i++) { - combined_bits[i + bits32 + bitsSizeT] = event_num_bits[i]; + combined_bits[i + bitsSizeT] = run_num_bits[i]; } for (size_t i = 0; i < bits32; i++) { - combined_bits[i + bitsSizeT] = run_num_bits[i]; + combined_bits[i + bits32 + bitsSizeT] = event_num_bits[i]; } - for (size_t i = 0; i < bitsSizeT; i++) { - combined_bits[i] = name_bits[i]; + for (size_t i = 0; i < bits64; i++) { + combined_bits[i + bits32 + bits32 + bitsSizeT] = seed_bits[i]; } auto hash = std::hash>{}(combined_bits); From 6bd99997d7349cee4734c17bd2a572ac9636dfe4 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:54:42 +0200 Subject: [PATCH 09/11] Update k4FWCore/components/UniqueIDGenSvc.cpp Co-authored-by: Thomas Madlener --- k4FWCore/components/UniqueIDGenSvc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k4FWCore/components/UniqueIDGenSvc.cpp b/k4FWCore/components/UniqueIDGenSvc.cpp index cd55f0ab..63d9f15f 100644 --- a/k4FWCore/components/UniqueIDGenSvc.cpp +++ b/k4FWCore/components/UniqueIDGenSvc.cpp @@ -52,7 +52,7 @@ size_t UniqueIDGenSvc::getUniqueID(uint32_t evt_num, uint32_t run_num, const std bool inserted = false; { std::lock_guard lock(m_mutex); - std::tie(std::ignore, inserted), = m_uniqueIDs.insert(hash); + std::tie(std::ignore, inserted) = m_uniqueIDs.insert(hash); } if (!inserted) { warning() << "Event number " << evt_num << ", run number " << run_num << " and algorithm name \"" << name From c8fb1e26d1376a98f8e98ca3b783e09cad29af76 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 9 Oct 2024 13:19:48 +0200 Subject: [PATCH 10/11] Fix pre-commit --- k4FWCore/components/UniqueIDGenSvc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k4FWCore/components/UniqueIDGenSvc.cpp b/k4FWCore/components/UniqueIDGenSvc.cpp index 63d9f15f..b28561b1 100644 --- a/k4FWCore/components/UniqueIDGenSvc.cpp +++ b/k4FWCore/components/UniqueIDGenSvc.cpp @@ -48,7 +48,7 @@ size_t UniqueIDGenSvc::getUniqueID(uint32_t evt_num, uint32_t run_num, const std combined_bits[i + bits32 + bits32 + bitsSizeT] = seed_bits[i]; } - auto hash = std::hash>{}(combined_bits); + auto hash = std::hash>{}(combined_bits); bool inserted = false; { std::lock_guard lock(m_mutex); From f0097d66ae54ddaff6c7131bff56cb3ef4a0058e Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 9 Oct 2024 18:43:24 +0200 Subject: [PATCH 11/11] Make the service throw when asked for the same ID twice --- k4FWCore/components/UniqueIDGenSvc.cpp | 10 +++++++--- k4FWCore/components/UniqueIDGenSvc.h | 1 + test/k4FWCoreTest/CMakeLists.txt | 4 ++-- .../src/components/TestUniqueIDGenSvc.cpp | 17 +++++++++++------ .../src/components/TestUniqueIDGenSvc.h | 6 ++++-- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/k4FWCore/components/UniqueIDGenSvc.cpp b/k4FWCore/components/UniqueIDGenSvc.cpp index b28561b1..55ff6abd 100644 --- a/k4FWCore/components/UniqueIDGenSvc.cpp +++ b/k4FWCore/components/UniqueIDGenSvc.cpp @@ -19,6 +19,7 @@ #include "UniqueIDGenSvc.h" #include +#include #include UniqueIDGenSvc::UniqueIDGenSvc(const std::string& name, ISvcLocator* svcLoc) : base_class(name, svcLoc) {} @@ -55,9 +56,12 @@ size_t UniqueIDGenSvc::getUniqueID(uint32_t evt_num, uint32_t run_num, const std std::tie(std::ignore, inserted) = m_uniqueIDs.insert(hash); } if (!inserted) { - warning() << "Event number " << evt_num << ", run number " << run_num << " and algorithm name \"" << name - << "\" have already been used. Please check the uniqueness of the event number, run number and name." - << endmsg; + error() << "Event number " << evt_num << ", run number " << run_num << " and algorithm name \"" << name + << "\" have already been used. Please check the uniqueness of the event number, run number and name." + << endmsg; + if (m_throwIfDuplicate) { + throw std::runtime_error("Duplicate event number, run number and algorithm name"); + } } return hash; diff --git a/k4FWCore/components/UniqueIDGenSvc.h b/k4FWCore/components/UniqueIDGenSvc.h index e3976fd5..ff202370 100644 --- a/k4FWCore/components/UniqueIDGenSvc.h +++ b/k4FWCore/components/UniqueIDGenSvc.h @@ -42,6 +42,7 @@ class UniqueIDGenSvc : public extends { Gaudi::Property m_seed{this, "Seed", {123456789}}; mutable std::unordered_set m_uniqueIDs; mutable std::mutex m_mutex; + Gaudi::Property m_throwIfDuplicate{this, "ThrowIfDuplicate", {true}}; }; #endif diff --git a/test/k4FWCoreTest/CMakeLists.txt b/test/k4FWCoreTest/CMakeLists.txt index 0f44272c..6d48d076 100644 --- a/test/k4FWCoreTest/CMakeLists.txt +++ b/test/k4FWCoreTest/CMakeLists.txt @@ -125,8 +125,8 @@ add_test(NAME checkKeepDropSwitch COMMAND python scripts/check_KeepDropSwitch.py ${PROJECT_BINARY_DIR}/test/k4FWCoreTest/output_k4test_exampledata_2.root) set_test_env(checkKeepDropSwitch) set_property(TEST checkKeepDropSwitch APPEND PROPERTY DEPENDS ReadExampleEventData) -add_test_with_env(TestUniqueIDGenSvc options/TestUniqueIDGenSvc.py) -add_test_with_env(TestUniqueIDGenSvcRepeated options/TestUniqueIDGenSvc.py PROPERTIES PASS_REGULAR_EXPRESSION "WARNING *Event number 4, run number 3 and algorithm name \"Some algorithm name\" have already been used. Please check the uniqueness of the event number, run number and name.") +add_test_with_env(TestUniqueIDGenSvc options/TestUniqueIDGenSvc.py -n 1) +add_test_with_env(TestUniqueIDGenSvcRepeated options/TestUniqueIDGenSvc.py -n 2 PROPERTIES PASS_REGULAR_EXPRESSION "Duplicate event number, run number and algorithm name") add_test_with_env(TestEventHeaderFiller options/createEventHeader.py) add_test_with_env(EventHeaderCheck options/runEventHeaderCheck.py PROPERTIES DEPENDS TestEventHeaderFiller) add_test(NAME TestExec WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} COMMAND python options/TestExec.py) diff --git a/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.cpp b/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.cpp index fb3c6add..bc39ab1b 100644 --- a/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.cpp +++ b/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.cpp @@ -18,6 +18,8 @@ */ #include "TestUniqueIDGenSvc.h" +#include + DECLARE_COMPONENT(TestUniqueIDGenSvc) TestUniqueIDGenSvc::TestUniqueIDGenSvc(const std::string& aName, ISvcLocator* aSvcLoc) @@ -33,16 +35,19 @@ StatusCode TestUniqueIDGenSvc::initialize() { return StatusCode::SUCCESS; } +// This is meant to run up to two times +// For the first event, check that when giving two different event numbers, the unique IDs are different +// For the second event, the service throws when trying to get the same ID twice StatusCode TestUniqueIDGenSvc::execute(const EventContext&) const { - uint evt_num = 4; - uint run_num = 3; + ++m_counter; + uint32_t evt_num = 4; + uint32_t run_num = 3 + m_counter.sum(); std::string name = "Some algorithm name"; auto uid = m_service->getUniqueID(evt_num, run_num, name); - auto uid_again = m_service->getUniqueID(evt_num, run_num, name); - - if (uid != uid_again) { - return StatusCode::FAILURE; + auto uid_again = m_service->getUniqueID(evt_num + (m_counter.sum() % 2), run_num, name); + if (uid == uid_again) { + throw std::runtime_error("Unique IDs are the same"); } return StatusCode::SUCCESS; diff --git a/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.h b/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.h index b0bfa656..5658c6b7 100644 --- a/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.h +++ b/test/k4FWCoreTest/src/components/TestUniqueIDGenSvc.h @@ -20,7 +20,8 @@ #define TEST_UNIQUEIDGENSVC_H // GAUDI -#include +#include "Gaudi/Accumulators.h" +#include "Gaudi/Algorithm.h" #include "k4Interface/IUniqueIDGenSvc.h" @@ -37,7 +38,8 @@ class TestUniqueIDGenSvc : public Gaudi::Algorithm { StatusCode execute(const EventContext&) const final; private: - SmartIF m_service; + SmartIF m_service; + mutable Gaudi::Accumulators::Counter<> m_counter{this, "EventCounter"}; }; #endif // TEST_UNIQUEIDGENSVC_H