From 7b79806f1c260b2a12838f0e603205ecb1c9cdcb Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 16:31:51 +0100 Subject: [PATCH 01/21] Removed Selector Code --- .../reco/ChargedMCParticleSelector.h | 45 ------------------- .../ChargedReconstructedParticleSelector.h | 45 ------------------- .../reco/ChargedMCParticleSelector_factory.h | 41 ----------------- ...gedReconstructedParticleSelector_factory.h | 41 ----------------- 4 files changed, 172 deletions(-) delete mode 100644 src/algorithms/reco/ChargedMCParticleSelector.h delete mode 100644 src/algorithms/reco/ChargedReconstructedParticleSelector.h delete mode 100644 src/global/reco/ChargedMCParticleSelector_factory.h delete mode 100644 src/global/reco/ChargedReconstructedParticleSelector_factory.h diff --git a/src/algorithms/reco/ChargedMCParticleSelector.h b/src/algorithms/reco/ChargedMCParticleSelector.h deleted file mode 100644 index f004d83cef..0000000000 --- a/src/algorithms/reco/ChargedMCParticleSelector.h +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2024 Dmitry Kalinkin, Derek Anderson - -#pragma once - -#include -#include - -#include -#include - -#include "algorithms/interfaces/WithPodConfig.h" - -namespace eicrecon { - - class ChargedMCParticleSelector : public WithPodConfig { - - private: - - std::shared_ptr m_log; - - public: - - // algorithm initialization - void init(std::shared_ptr& logger) { - m_log = logger; - } - - // primary algorithm call - std::unique_ptr process(const edm4hep::MCParticleCollection* inputs) { - auto outputs = std::make_unique(); - outputs->setSubsetCollection(); - - for (const auto &particle : *inputs) { - if (particle.getCharge() != 0.) { - outputs->push_back(particle); - } - } - - return std::move(outputs); - } - - }; - -} diff --git a/src/algorithms/reco/ChargedReconstructedParticleSelector.h b/src/algorithms/reco/ChargedReconstructedParticleSelector.h deleted file mode 100644 index 93381738e4..0000000000 --- a/src/algorithms/reco/ChargedReconstructedParticleSelector.h +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2024 Dmitry Kalinkin, Derek Anderson - -#pragma once - -#include -#include - -#include -#include - -#include "algorithms/interfaces/WithPodConfig.h" - -namespace eicrecon { - - class ChargedReconstructedParticleSelector : public WithPodConfig { - - private: - - std::shared_ptr m_log; - - public: - - // algorithm initialization - void init(std::shared_ptr& logger) { - m_log = logger; - } - - // primary algorithm call - std::unique_ptr process(const edm4eic::ReconstructedParticleCollection* inputs) { - auto outputs = std::make_unique(); - outputs->setSubsetCollection(); - - for (const auto &particle : *inputs) { - if (particle.getCharge() != 0.) { - outputs->push_back(particle); - } - } - - return std::move(outputs); - } - - }; - -} diff --git a/src/global/reco/ChargedMCParticleSelector_factory.h b/src/global/reco/ChargedMCParticleSelector_factory.h deleted file mode 100644 index 8bfbd8c531..0000000000 --- a/src/global/reco/ChargedMCParticleSelector_factory.h +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2024 Wouter Deconinck, Dmitry Kalinkin, Derek Anderson - -#pragma once - -#include "extensions/jana/JOmniFactory.h" -#include "algorithms/reco/ChargedMCParticleSelector.h" - -namespace eicrecon { - - class ChargedMCParticleSelector_factory : public JOmniFactory { - - private: - - // algorithm - std::unique_ptr m_algo; - - // input collection - PodioInput m_pars_in {this, "GeneratedParticles"}; - - // output collection - PodioOutput m_pars_out {this}; - - public: - - void Configure() { - m_algo = std::make_unique(); - m_algo->init(logger()); - } - - void ChangeRun(int64_t run_number) { - /* nothing to do */ - } - - void Process(int64_t run_number, int64_t event_number) { - m_pars_out() = m_algo->process(m_pars_in()); - } - - }; - -} // end eicrecon namespace diff --git a/src/global/reco/ChargedReconstructedParticleSelector_factory.h b/src/global/reco/ChargedReconstructedParticleSelector_factory.h deleted file mode 100644 index 249f306e51..0000000000 --- a/src/global/reco/ChargedReconstructedParticleSelector_factory.h +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2024, Derek Anderson - -#pragma once - -#include "extensions/jana/JOmniFactory.h" -#include "algorithms/reco/ChargedReconstructedParticleSelector.h" - -namespace eicrecon { - - class ChargedReconstructedParticleSelector_factory : public JOmniFactory { - - private: - - // algorithm - std::unique_ptr m_algo; - - // input collection - PodioInput m_pars_in {this, "GeneratedParticles"}; - - // output collection - PodioOutput m_pars_out {this}; - - public: - - void Configure() { - m_algo = std::make_unique(); - m_algo->init(logger()); - } - - void ChangeRun(int64_t run_number) { - /* nothing to do */ - } - - void Process(int64_t run_number, int64_t event_number) { - m_pars_out() = m_algo->process(m_pars_in()); - } - - }; - -} // end eicrecon namespace From 2f8fae7e2925c207b44297653f4a8ecfb543dbcd Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 17:44:12 +0100 Subject: [PATCH 02/21] Added functionality to the RangeSplit and ValueSplit functors --- src/algorithms/meta/SubDivideFunctors.h | 45 +++++++++++++++++++++---- src/global/reco/reco.cc | 7 ++-- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 090b54ad89..58bb7c8525 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -14,15 +14,35 @@ template class RangeSplit { public: - RangeSplit(std::vector> ranges) : m_ranges(ranges) {}; + RangeSplit(std::vector> ranges, std::variant> inside = true) + : m_ranges(ranges) { + std::visit([this, &ranges](auto&& arg) { + using T = std::decay_t; + if constexpr (std::is_same_v) { + m_inside = std::vector(ranges.size(), arg); + } else if constexpr (std::is_same_v>) { + if (arg.size() != ranges.size()) { + throw std::invalid_argument("Size of inside must match the size of ranges"); + } else { + m_inside = arg; + } + } + }, inside); + }; template std::vector operator()(T& instance) const { std::vector ids; //Check if requested value is within the ranges for(size_t i = 0; i < m_ranges.size(); i++){ - if((instance.*MemberFunctionPtr)() > m_ranges[i].first && (instance.*MemberFunctionPtr)() < m_ranges[i].second){ - ids.push_back(i); + if(m_inside[i]){ + if((instance.*MemberFunctionPtr)() >= m_ranges[i].first && (instance.*MemberFunctionPtr)() <= m_ranges[i].second){ + ids.push_back(i); + } + } else { + if((instance.*MemberFunctionPtr)() < m_ranges[i].first || (instance.*MemberFunctionPtr)() > m_ranges[i].second){ + ids.push_back(i); + } } } return ids; @@ -30,6 +50,7 @@ class RangeSplit { private: std::vector> m_ranges; + std::vector m_inside; }; @@ -90,7 +111,8 @@ template class ValueSplit { public: - ValueSplit(std::vector> ids) : m_ids(ids) {}; + ValueSplit(std::vector> ids, bool matching = true) + : m_ids(ids), m_matching(matching) {}; template std::vector operator()(T& instance) const { @@ -98,15 +120,24 @@ class ValueSplit { // Check if requested value matches any configuration combinations std::vector values; (values.push_back((instance.*MemberFunctionPtrs)()), ...); - auto index = std::find(m_ids.begin(),m_ids.end(),values); - if(index != m_ids.end()){ - ids.push_back(std::distance(m_ids.begin(),index)); + if(m_matching){ + auto index = std::find(m_ids.begin(),m_ids.end(),values); + if(index != m_ids.end()){ + ids.push_back(std::distance(m_ids.begin(),index)); + } + } else { + for (size_t i = 0; i < m_ids.size(); ++i){ + if(m_ids[i] != values){ + ids.push_back(i); + } + } } return ids; } private: std::vector> m_ids; + bool m_matching = true; }; diff --git a/src/global/reco/reco.cc b/src/global/reco/reco.cc index e8cbf21e58..997f5ab52e 100644 --- a/src/global/reco/reco.cc +++ b/src/global/reco/reco.cc @@ -26,6 +26,8 @@ #include "extensions/jana/JOmniFactoryGeneratorT.h" #include "factories/meta/CollectionCollector_factory.h" #include "factories/meta/FilterMatching_factory.h" +#include "factories/meta/SubDivideCollection_factory.h" +#include "algorithms/meta/SubDivideFunctors.h" #include "factories/reco/FarForwardNeutronReconstruction_factory.h" #ifdef USE_ONNX #include "factories/reco/InclusiveKinematicsML_factory.h" @@ -40,13 +42,13 @@ #include "factories/reco/HadronicFinalState_factory.h" #endif #include "factories/reco/UndoAfterBurnerMCParticles_factory.h" -#include "global/reco/ChargedReconstructedParticleSelector_factory.h" #include "global/reco/MC2SmearedParticle_factory.h" #include "global/reco/MatchClusters_factory.h" #include "global/reco/ReconstructedElectrons_factory.h" #include "global/reco/ScatteredElectronsEMinusPz_factory.h" #include "global/reco/ScatteredElectronsTruth_factory.h" + extern "C" { void InitPlugin(JApplication *app) { InitJANAPlugin(app); @@ -235,10 +237,11 @@ void InitPlugin(JApplication *app) { app )); - app->Add(new JOmniFactoryGeneratorT( + app->Add(new JOmniFactoryGeneratorT>( "GeneratedChargedParticles", {"GeneratedParticles"}, {"GeneratedChargedParticles"}, + {.function = ValueSplit<&edm4eic::ReconstructedParticle::getCharge>{{{0}},false}}, app )); From 0f2ce1d263e142d655389d49684ffc893137706c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 17:01:39 +0000 Subject: [PATCH 03/21] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/algorithms/meta/SubDivideFunctors.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 58bb7c8525..051b12c41f 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -20,7 +20,7 @@ class RangeSplit { using T = std::decay_t; if constexpr (std::is_same_v) { m_inside = std::vector(ranges.size(), arg); - } else if constexpr (std::is_same_v>) { + } else if constexpr (std::is_same_v>) { if (arg.size() != ranges.size()) { throw std::invalid_argument("Size of inside must match the size of ranges"); } else { @@ -130,7 +130,7 @@ class ValueSplit { if(m_ids[i] != values){ ids.push_back(i); } - } + } } return ids; } From a601ad40c468602b45c086c3102791f8b44367f6 Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 18:13:24 +0100 Subject: [PATCH 04/21] Changes suggested by sonarcloud --- src/algorithms/meta/SubDivideFunctors.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 051b12c41f..27f2d15ef0 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -14,7 +14,7 @@ template class RangeSplit { public: - RangeSplit(std::vector> ranges, std::variant> inside = true) + RangeSplit(const std::vector>& ranges, std::variant> inside = true) : m_ranges(ranges) { std::visit([this, &ranges](auto&& arg) { using T = std::decay_t; @@ -27,7 +27,7 @@ class RangeSplit { m_inside = arg; } } - }, inside); + }, std::forward(inside)); }; template @@ -49,7 +49,7 @@ class RangeSplit { } private: - std::vector> m_ranges; + const std::vector>& m_ranges; std::vector m_inside; }; @@ -60,7 +60,7 @@ class RangeSplit { class GeometrySplit { public: - GeometrySplit(std::vector> ids, std::string readout, std::vector divisions) + GeometrySplit(const std::vector>& ids, std::string readout, std::vector divisions) : m_ids(ids), m_readout(readout), m_divisions(divisions){}; template @@ -93,7 +93,7 @@ class GeometrySplit { } } - std::vector> m_ids; + const std::vector>& m_ids; std::vector m_divisions; std::string m_readout; @@ -111,7 +111,7 @@ template class ValueSplit { public: - ValueSplit(std::vector> ids, bool matching = true) + ValueSplit(const std::vector>& ids, bool matching = true) : m_ids(ids), m_matching(matching) {}; template @@ -136,7 +136,7 @@ class ValueSplit { } private: - std::vector> m_ids; + const std::vector>& m_ids; bool m_matching = true; }; From ccce8f5fe55ca34082b2d8732b9a2e38dad65c96 Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 18:24:29 +0100 Subject: [PATCH 05/21] Overload the constructor rather than messing around with variants --- src/algorithms/meta/SubDivideFunctors.h | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 27f2d15ef0..7b4c4cd899 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -13,22 +13,16 @@ namespace eicrecon { template class RangeSplit { public: + RangeSplit(const std::vector>& ranges, bool inside) + : m_ranges(ranges), m_inside(ranges.size(), inside) {} - RangeSplit(const std::vector>& ranges, std::variant> inside = true) + RangeSplit(const std::vector>& ranges, const std::vector& inside) : m_ranges(ranges) { - std::visit([this, &ranges](auto&& arg) { - using T = std::decay_t; - if constexpr (std::is_same_v) { - m_inside = std::vector(ranges.size(), arg); - } else if constexpr (std::is_same_v>) { - if (arg.size() != ranges.size()) { - throw std::invalid_argument("Size of inside must match the size of ranges"); - } else { - m_inside = arg; - } - } - }, std::forward(inside)); - }; + if (inside.size() != ranges.size()) { + throw std::invalid_argument("Size of inside must match the size of ranges"); + } + m_inside = inside; + } template std::vector operator()(T& instance) const { From c499b4e7bd6ed52c6beb544a9a5b7680d6dfeace Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 18:25:49 +0100 Subject: [PATCH 06/21] Re-add default --- src/algorithms/meta/SubDivideFunctors.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 7b4c4cd899..9febc06140 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -13,7 +13,7 @@ namespace eicrecon { template class RangeSplit { public: - RangeSplit(const std::vector>& ranges, bool inside) + RangeSplit(const std::vector>& ranges, bool inside = true) : m_ranges(ranges), m_inside(ranges.size(), inside) {} RangeSplit(const std::vector>& ranges, const std::vector& inside) From 95286e90e2a2662dee4d0502a6757fb961ab8396 Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 19:02:58 +0100 Subject: [PATCH 07/21] More sonarcloud advised changes --- src/algorithms/meta/SubDivideFunctors.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 9febc06140..b3c9a885fe 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -54,7 +54,7 @@ class RangeSplit { class GeometrySplit { public: - GeometrySplit(const std::vector>& ids, std::string readout, std::vector divisions) + GeometrySplit(const std::vector>& ids, const std::string& readout, const std::vector& divisions) : m_ids(ids), m_readout(readout), m_divisions(divisions){}; template @@ -88,8 +88,8 @@ class GeometrySplit { } const std::vector>& m_ids; - std::vector m_divisions; - std::string m_readout; + const std::vector& m_divisions; + const std::string& m_readout; mutable std::shared_ptr is_init = std::make_shared(); mutable dd4hep::DDSegmentation::BitFieldCoder* m_id_dec; From 20cb0b4f4feed097227e60da5dd94ac26eb10388 Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 22:00:53 +0100 Subject: [PATCH 08/21] Remove suggested const flags to see if the CI behaves better --- src/algorithms/meta/SubDivideFunctors.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index b3c9a885fe..0a57ecca4d 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -13,7 +13,7 @@ namespace eicrecon { template class RangeSplit { public: - RangeSplit(const std::vector>& ranges, bool inside = true) + RangeSplit(std::vector> ranges, bool inside = true) : m_ranges(ranges), m_inside(ranges.size(), inside) {} RangeSplit(const std::vector>& ranges, const std::vector& inside) @@ -43,7 +43,7 @@ class RangeSplit { } private: - const std::vector>& m_ranges; + std::vector> m_ranges; std::vector m_inside; }; @@ -54,7 +54,7 @@ class RangeSplit { class GeometrySplit { public: - GeometrySplit(const std::vector>& ids, const std::string& readout, const std::vector& divisions) + GeometrySplit(std::vector> ids, const std::string& readout, const std::vector& divisions) : m_ids(ids), m_readout(readout), m_divisions(divisions){}; template @@ -87,9 +87,9 @@ class GeometrySplit { } } - const std::vector>& m_ids; - const std::vector& m_divisions; - const std::string& m_readout; + std::vector> m_ids; + std::vector m_divisions; + std::string m_readout; mutable std::shared_ptr is_init = std::make_shared(); mutable dd4hep::DDSegmentation::BitFieldCoder* m_id_dec; @@ -105,7 +105,7 @@ template class ValueSplit { public: - ValueSplit(const std::vector>& ids, bool matching = true) + ValueSplit( std::vector> ids, bool matching = true) : m_ids(ids), m_matching(matching) {}; template @@ -130,7 +130,7 @@ class ValueSplit { } private: - const std::vector>& m_ids; + std::vector> m_ids; bool m_matching = true; }; From 134a54d843c4816c83d831f7b34f4149265277cd Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 16:31:51 +0100 Subject: [PATCH 09/21] Removed Selector Code --- .../reco/ChargedMCParticleSelector.h | 45 ------------------- .../ChargedReconstructedParticleSelector.h | 45 ------------------- .../reco/ChargedMCParticleSelector_factory.h | 41 ----------------- ...gedReconstructedParticleSelector_factory.h | 41 ----------------- 4 files changed, 172 deletions(-) delete mode 100644 src/algorithms/reco/ChargedMCParticleSelector.h delete mode 100644 src/algorithms/reco/ChargedReconstructedParticleSelector.h delete mode 100644 src/global/reco/ChargedMCParticleSelector_factory.h delete mode 100644 src/global/reco/ChargedReconstructedParticleSelector_factory.h diff --git a/src/algorithms/reco/ChargedMCParticleSelector.h b/src/algorithms/reco/ChargedMCParticleSelector.h deleted file mode 100644 index f004d83cef..0000000000 --- a/src/algorithms/reco/ChargedMCParticleSelector.h +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2024 Dmitry Kalinkin, Derek Anderson - -#pragma once - -#include -#include - -#include -#include - -#include "algorithms/interfaces/WithPodConfig.h" - -namespace eicrecon { - - class ChargedMCParticleSelector : public WithPodConfig { - - private: - - std::shared_ptr m_log; - - public: - - // algorithm initialization - void init(std::shared_ptr& logger) { - m_log = logger; - } - - // primary algorithm call - std::unique_ptr process(const edm4hep::MCParticleCollection* inputs) { - auto outputs = std::make_unique(); - outputs->setSubsetCollection(); - - for (const auto &particle : *inputs) { - if (particle.getCharge() != 0.) { - outputs->push_back(particle); - } - } - - return std::move(outputs); - } - - }; - -} diff --git a/src/algorithms/reco/ChargedReconstructedParticleSelector.h b/src/algorithms/reco/ChargedReconstructedParticleSelector.h deleted file mode 100644 index 93381738e4..0000000000 --- a/src/algorithms/reco/ChargedReconstructedParticleSelector.h +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2024 Dmitry Kalinkin, Derek Anderson - -#pragma once - -#include -#include - -#include -#include - -#include "algorithms/interfaces/WithPodConfig.h" - -namespace eicrecon { - - class ChargedReconstructedParticleSelector : public WithPodConfig { - - private: - - std::shared_ptr m_log; - - public: - - // algorithm initialization - void init(std::shared_ptr& logger) { - m_log = logger; - } - - // primary algorithm call - std::unique_ptr process(const edm4eic::ReconstructedParticleCollection* inputs) { - auto outputs = std::make_unique(); - outputs->setSubsetCollection(); - - for (const auto &particle : *inputs) { - if (particle.getCharge() != 0.) { - outputs->push_back(particle); - } - } - - return std::move(outputs); - } - - }; - -} diff --git a/src/global/reco/ChargedMCParticleSelector_factory.h b/src/global/reco/ChargedMCParticleSelector_factory.h deleted file mode 100644 index 8bfbd8c531..0000000000 --- a/src/global/reco/ChargedMCParticleSelector_factory.h +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2024 Wouter Deconinck, Dmitry Kalinkin, Derek Anderson - -#pragma once - -#include "extensions/jana/JOmniFactory.h" -#include "algorithms/reco/ChargedMCParticleSelector.h" - -namespace eicrecon { - - class ChargedMCParticleSelector_factory : public JOmniFactory { - - private: - - // algorithm - std::unique_ptr m_algo; - - // input collection - PodioInput m_pars_in {this, "GeneratedParticles"}; - - // output collection - PodioOutput m_pars_out {this}; - - public: - - void Configure() { - m_algo = std::make_unique(); - m_algo->init(logger()); - } - - void ChangeRun(int64_t run_number) { - /* nothing to do */ - } - - void Process(int64_t run_number, int64_t event_number) { - m_pars_out() = m_algo->process(m_pars_in()); - } - - }; - -} // end eicrecon namespace diff --git a/src/global/reco/ChargedReconstructedParticleSelector_factory.h b/src/global/reco/ChargedReconstructedParticleSelector_factory.h deleted file mode 100644 index 249f306e51..0000000000 --- a/src/global/reco/ChargedReconstructedParticleSelector_factory.h +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2024, Derek Anderson - -#pragma once - -#include "extensions/jana/JOmniFactory.h" -#include "algorithms/reco/ChargedReconstructedParticleSelector.h" - -namespace eicrecon { - - class ChargedReconstructedParticleSelector_factory : public JOmniFactory { - - private: - - // algorithm - std::unique_ptr m_algo; - - // input collection - PodioInput m_pars_in {this, "GeneratedParticles"}; - - // output collection - PodioOutput m_pars_out {this}; - - public: - - void Configure() { - m_algo = std::make_unique(); - m_algo->init(logger()); - } - - void ChangeRun(int64_t run_number) { - /* nothing to do */ - } - - void Process(int64_t run_number, int64_t event_number) { - m_pars_out() = m_algo->process(m_pars_in()); - } - - }; - -} // end eicrecon namespace From 0e1c3a1d999c7bbef431040b085352f1b83bf3e9 Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 17:44:12 +0100 Subject: [PATCH 10/21] Added functionality to the RangeSplit and ValueSplit functors --- src/algorithms/meta/SubDivideFunctors.h | 45 +++++++++++++++++++++---- src/global/reco/reco.cc | 7 ++-- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 090b54ad89..58bb7c8525 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -14,15 +14,35 @@ template class RangeSplit { public: - RangeSplit(std::vector> ranges) : m_ranges(ranges) {}; + RangeSplit(std::vector> ranges, std::variant> inside = true) + : m_ranges(ranges) { + std::visit([this, &ranges](auto&& arg) { + using T = std::decay_t; + if constexpr (std::is_same_v) { + m_inside = std::vector(ranges.size(), arg); + } else if constexpr (std::is_same_v>) { + if (arg.size() != ranges.size()) { + throw std::invalid_argument("Size of inside must match the size of ranges"); + } else { + m_inside = arg; + } + } + }, inside); + }; template std::vector operator()(T& instance) const { std::vector ids; //Check if requested value is within the ranges for(size_t i = 0; i < m_ranges.size(); i++){ - if((instance.*MemberFunctionPtr)() > m_ranges[i].first && (instance.*MemberFunctionPtr)() < m_ranges[i].second){ - ids.push_back(i); + if(m_inside[i]){ + if((instance.*MemberFunctionPtr)() >= m_ranges[i].first && (instance.*MemberFunctionPtr)() <= m_ranges[i].second){ + ids.push_back(i); + } + } else { + if((instance.*MemberFunctionPtr)() < m_ranges[i].first || (instance.*MemberFunctionPtr)() > m_ranges[i].second){ + ids.push_back(i); + } } } return ids; @@ -30,6 +50,7 @@ class RangeSplit { private: std::vector> m_ranges; + std::vector m_inside; }; @@ -90,7 +111,8 @@ template class ValueSplit { public: - ValueSplit(std::vector> ids) : m_ids(ids) {}; + ValueSplit(std::vector> ids, bool matching = true) + : m_ids(ids), m_matching(matching) {}; template std::vector operator()(T& instance) const { @@ -98,15 +120,24 @@ class ValueSplit { // Check if requested value matches any configuration combinations std::vector values; (values.push_back((instance.*MemberFunctionPtrs)()), ...); - auto index = std::find(m_ids.begin(),m_ids.end(),values); - if(index != m_ids.end()){ - ids.push_back(std::distance(m_ids.begin(),index)); + if(m_matching){ + auto index = std::find(m_ids.begin(),m_ids.end(),values); + if(index != m_ids.end()){ + ids.push_back(std::distance(m_ids.begin(),index)); + } + } else { + for (size_t i = 0; i < m_ids.size(); ++i){ + if(m_ids[i] != values){ + ids.push_back(i); + } + } } return ids; } private: std::vector> m_ids; + bool m_matching = true; }; diff --git a/src/global/reco/reco.cc b/src/global/reco/reco.cc index 9813baac82..18f9054aec 100644 --- a/src/global/reco/reco.cc +++ b/src/global/reco/reco.cc @@ -27,6 +27,8 @@ #include "extensions/jana/JOmniFactoryGeneratorT.h" #include "factories/meta/CollectionCollector_factory.h" #include "factories/meta/FilterMatching_factory.h" +#include "factories/meta/SubDivideCollection_factory.h" +#include "algorithms/meta/SubDivideFunctors.h" #include "factories/reco/FarForwardNeutronReconstruction_factory.h" #ifdef USE_ONNX #include "factories/reco/InclusiveKinematicsML_factory.h" @@ -41,13 +43,13 @@ #include "factories/reco/HadronicFinalState_factory.h" #endif #include "factories/reco/UndoAfterBurnerMCParticles_factory.h" -#include "global/reco/ChargedReconstructedParticleSelector_factory.h" #include "global/reco/MC2SmearedParticle_factory.h" #include "global/reco/MatchClusters_factory.h" #include "global/reco/ReconstructedElectrons_factory.h" #include "global/reco/ScatteredElectronsEMinusPz_factory.h" #include "global/reco/ScatteredElectronsTruth_factory.h" + extern "C" { void InitPlugin(JApplication *app) { InitJANAPlugin(app); @@ -248,10 +250,11 @@ void InitPlugin(JApplication *app) { app )); - app->Add(new JOmniFactoryGeneratorT( + app->Add(new JOmniFactoryGeneratorT>( "GeneratedChargedParticles", {"GeneratedParticles"}, {"GeneratedChargedParticles"}, + {.function = ValueSplit<&edm4eic::ReconstructedParticle::getCharge>{{{0}},false}}, app )); From fc9c691e9875579867a7b11b6e86ad9c3ce86e94 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 17:01:39 +0000 Subject: [PATCH 11/21] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/algorithms/meta/SubDivideFunctors.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 58bb7c8525..051b12c41f 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -20,7 +20,7 @@ class RangeSplit { using T = std::decay_t; if constexpr (std::is_same_v) { m_inside = std::vector(ranges.size(), arg); - } else if constexpr (std::is_same_v>) { + } else if constexpr (std::is_same_v>) { if (arg.size() != ranges.size()) { throw std::invalid_argument("Size of inside must match the size of ranges"); } else { @@ -130,7 +130,7 @@ class ValueSplit { if(m_ids[i] != values){ ids.push_back(i); } - } + } } return ids; } From 5aed707c15ed1b1754752371ae7a8a87f0a8cf9d Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 18:13:24 +0100 Subject: [PATCH 12/21] Changes suggested by sonarcloud --- src/algorithms/meta/SubDivideFunctors.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 051b12c41f..27f2d15ef0 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -14,7 +14,7 @@ template class RangeSplit { public: - RangeSplit(std::vector> ranges, std::variant> inside = true) + RangeSplit(const std::vector>& ranges, std::variant> inside = true) : m_ranges(ranges) { std::visit([this, &ranges](auto&& arg) { using T = std::decay_t; @@ -27,7 +27,7 @@ class RangeSplit { m_inside = arg; } } - }, inside); + }, std::forward(inside)); }; template @@ -49,7 +49,7 @@ class RangeSplit { } private: - std::vector> m_ranges; + const std::vector>& m_ranges; std::vector m_inside; }; @@ -60,7 +60,7 @@ class RangeSplit { class GeometrySplit { public: - GeometrySplit(std::vector> ids, std::string readout, std::vector divisions) + GeometrySplit(const std::vector>& ids, std::string readout, std::vector divisions) : m_ids(ids), m_readout(readout), m_divisions(divisions){}; template @@ -93,7 +93,7 @@ class GeometrySplit { } } - std::vector> m_ids; + const std::vector>& m_ids; std::vector m_divisions; std::string m_readout; @@ -111,7 +111,7 @@ template class ValueSplit { public: - ValueSplit(std::vector> ids, bool matching = true) + ValueSplit(const std::vector>& ids, bool matching = true) : m_ids(ids), m_matching(matching) {}; template @@ -136,7 +136,7 @@ class ValueSplit { } private: - std::vector> m_ids; + const std::vector>& m_ids; bool m_matching = true; }; From 2c188c2b1b43714da508fa2c1e0e67d5e7193812 Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 18:24:29 +0100 Subject: [PATCH 13/21] Overload the constructor rather than messing around with variants --- src/algorithms/meta/SubDivideFunctors.h | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 27f2d15ef0..7b4c4cd899 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -13,22 +13,16 @@ namespace eicrecon { template class RangeSplit { public: + RangeSplit(const std::vector>& ranges, bool inside) + : m_ranges(ranges), m_inside(ranges.size(), inside) {} - RangeSplit(const std::vector>& ranges, std::variant> inside = true) + RangeSplit(const std::vector>& ranges, const std::vector& inside) : m_ranges(ranges) { - std::visit([this, &ranges](auto&& arg) { - using T = std::decay_t; - if constexpr (std::is_same_v) { - m_inside = std::vector(ranges.size(), arg); - } else if constexpr (std::is_same_v>) { - if (arg.size() != ranges.size()) { - throw std::invalid_argument("Size of inside must match the size of ranges"); - } else { - m_inside = arg; - } - } - }, std::forward(inside)); - }; + if (inside.size() != ranges.size()) { + throw std::invalid_argument("Size of inside must match the size of ranges"); + } + m_inside = inside; + } template std::vector operator()(T& instance) const { From bbff480973489b33d9af2995ef6800b6fce6bf5a Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 18:25:49 +0100 Subject: [PATCH 14/21] Re-add default --- src/algorithms/meta/SubDivideFunctors.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 7b4c4cd899..9febc06140 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -13,7 +13,7 @@ namespace eicrecon { template class RangeSplit { public: - RangeSplit(const std::vector>& ranges, bool inside) + RangeSplit(const std::vector>& ranges, bool inside = true) : m_ranges(ranges), m_inside(ranges.size(), inside) {} RangeSplit(const std::vector>& ranges, const std::vector& inside) From 6b3010e2b083eb95ff73b448263ecd7aaa442b5e Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 19:02:58 +0100 Subject: [PATCH 15/21] More sonarcloud advised changes --- src/algorithms/meta/SubDivideFunctors.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 9febc06140..b3c9a885fe 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -54,7 +54,7 @@ class RangeSplit { class GeometrySplit { public: - GeometrySplit(const std::vector>& ids, std::string readout, std::vector divisions) + GeometrySplit(const std::vector>& ids, const std::string& readout, const std::vector& divisions) : m_ids(ids), m_readout(readout), m_divisions(divisions){}; template @@ -88,8 +88,8 @@ class GeometrySplit { } const std::vector>& m_ids; - std::vector m_divisions; - std::string m_readout; + const std::vector& m_divisions; + const std::string& m_readout; mutable std::shared_ptr is_init = std::make_shared(); mutable dd4hep::DDSegmentation::BitFieldCoder* m_id_dec; From 9786e24e3793537f7e57a5f0a86493e3afbf5570 Mon Sep 17 00:00:00 2001 From: simonge Date: Tue, 20 Aug 2024 22:00:53 +0100 Subject: [PATCH 16/21] Remove suggested const flags to see if the CI behaves better --- src/algorithms/meta/SubDivideFunctors.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index b3c9a885fe..0a57ecca4d 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -13,7 +13,7 @@ namespace eicrecon { template class RangeSplit { public: - RangeSplit(const std::vector>& ranges, bool inside = true) + RangeSplit(std::vector> ranges, bool inside = true) : m_ranges(ranges), m_inside(ranges.size(), inside) {} RangeSplit(const std::vector>& ranges, const std::vector& inside) @@ -43,7 +43,7 @@ class RangeSplit { } private: - const std::vector>& m_ranges; + std::vector> m_ranges; std::vector m_inside; }; @@ -54,7 +54,7 @@ class RangeSplit { class GeometrySplit { public: - GeometrySplit(const std::vector>& ids, const std::string& readout, const std::vector& divisions) + GeometrySplit(std::vector> ids, const std::string& readout, const std::vector& divisions) : m_ids(ids), m_readout(readout), m_divisions(divisions){}; template @@ -87,9 +87,9 @@ class GeometrySplit { } } - const std::vector>& m_ids; - const std::vector& m_divisions; - const std::string& m_readout; + std::vector> m_ids; + std::vector m_divisions; + std::string m_readout; mutable std::shared_ptr is_init = std::make_shared(); mutable dd4hep::DDSegmentation::BitFieldCoder* m_id_dec; @@ -105,7 +105,7 @@ template class ValueSplit { public: - ValueSplit(const std::vector>& ids, bool matching = true) + ValueSplit( std::vector> ids, bool matching = true) : m_ids(ids), m_matching(matching) {}; template @@ -130,7 +130,7 @@ class ValueSplit { } private: - const std::vector>& m_ids; + std::vector> m_ids; bool m_matching = true; }; From 5f943e0a3467f681315fe713d70a65a4a579f375 Mon Sep 17 00:00:00 2001 From: simonge Date: Wed, 28 Aug 2024 19:27:09 +0100 Subject: [PATCH 17/21] Fix indentation --- src/algorithms/meta/SubDivideFunctors.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 0a57ecca4d..755cc74745 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -87,8 +87,8 @@ class GeometrySplit { } } - std::vector> m_ids; - std::vector m_divisions; + std::vector> m_ids; + std::vector m_divisions; std::string m_readout; mutable std::shared_ptr is_init = std::make_shared(); From c336c4fbfb27430ce71aba23753b2f87c1c8e772 Mon Sep 17 00:00:00 2001 From: simonge Date: Wed, 28 Aug 2024 21:13:43 +0100 Subject: [PATCH 18/21] Created BooleanSplit functor and reverted ValueSplit --- src/algorithms/meta/SubDivideFunctors.h | 70 +++++++++++++++++++++---- src/global/reco/reco.cc | 3 +- 2 files changed, 61 insertions(+), 12 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 755cc74745..35075a4cee 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -4,6 +4,9 @@ #pragma once #include +#include +#include +#include namespace eicrecon { @@ -114,16 +117,51 @@ class ValueSplit { // Check if requested value matches any configuration combinations std::vector values; (values.push_back((instance.*MemberFunctionPtrs)()), ...); - if(m_matching){ - auto index = std::find(m_ids.begin(),m_ids.end(),values); - if(index != m_ids.end()){ - ids.push_back(std::distance(m_ids.begin(),index)); - } - } else { - for (size_t i = 0; i < m_ids.size(); ++i){ - if(m_ids[i] != values){ - ids.push_back(i); - } + auto index = std::find(m_ids.begin(),m_ids.end(),values); + if(index != m_ids.end()){ + ids.push_back(std::distance(m_ids.begin(),index)); + } + return ids; + } + +private: + std::vector> m_ids; + bool m_matching = true; + +}; + +// ---------------------------------------------------------------------------- +// Functor to split collection based on any number of collection values +// ---------------------------------------------------------------------------- +template +class BooleanSplit { +public: + using ComparisonFunction = std::function; + + BooleanSplit( std::vector> ids, ComparisonFunction comparison) + : m_ids(ids), m_comparisons(ids.size(), comparison) {}; + + BooleanSplit( std::vector ids, ComparisonFunction comparison) + : m_ids(1,ids), m_comparisons(ids.size(), comparison) {}; + + + BooleanSplit( std::vector> ids, std::vector comparisons) + : m_ids(ids) { + if (ids.size() != comparisons.size()) { + throw std::invalid_argument("Size of values to compare must match the size of boolean functions"); + } + m_comparisons = comparisons; + } + + template + std::vector operator()(T& instance) const { + std::vector ids; + // Check if requested value matches any configuration combinations + std::vector values; + (values.push_back((instance.*MemberFunctionPtrs)()), ...); + for (size_t i = 0; i < m_ids.size(); ++i){ + if(compareVectors(m_ids[i], values, m_comparisons)){ + ids.push_back(i); } } return ids; @@ -131,7 +169,17 @@ class ValueSplit { private: std::vector> m_ids; - bool m_matching = true; + std::vector m_comparisons; + + static bool compareVectors(const std::vector& vec1, const std::vector& vec2, const std::vector& comparisons) { + for (size_t i = 0; i < vec1.size(); ++i) { + if (!comparisons[i](vec1[i], vec2[i])) { + return false; + } + } + return true; + } + }; diff --git a/src/global/reco/reco.cc b/src/global/reco/reco.cc index 18f9054aec..7040d58cda 100644 --- a/src/global/reco/reco.cc +++ b/src/global/reco/reco.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include "algorithms/interfaces/WithPodConfig.h" @@ -254,7 +255,7 @@ void InitPlugin(JApplication *app) { "GeneratedChargedParticles", {"GeneratedParticles"}, {"GeneratedChargedParticles"}, - {.function = ValueSplit<&edm4eic::ReconstructedParticle::getCharge>{{{0}},false}}, + {.function = BooleanSplit<&edm4eic::ReconstructedParticle::getCharge>{{0},std::not_equal_to{}}}, app )); From b13bbe86a8ff51a40254a4e860452f3c31e2e96b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 20:15:11 +0000 Subject: [PATCH 19/21] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/algorithms/meta/SubDivideFunctors.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 35075a4cee..b05fa45315 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -120,7 +120,7 @@ class ValueSplit { auto index = std::find(m_ids.begin(),m_ids.end(),values); if(index != m_ids.end()){ ids.push_back(std::distance(m_ids.begin(),index)); - } + } return ids; } @@ -170,7 +170,7 @@ class BooleanSplit { private: std::vector> m_ids; std::vector m_comparisons; - + static bool compareVectors(const std::vector& vec1, const std::vector& vec2, const std::vector& comparisons) { for (size_t i = 0; i < vec1.size(); ++i) { if (!comparisons[i](vec1[i], vec2[i])) { From d22b85389aed033eea4203f591d7255a63898a2d Mon Sep 17 00:00:00 2001 From: simonge Date: Wed, 28 Aug 2024 21:34:39 +0100 Subject: [PATCH 20/21] Convert BooleanSplit to use float type as the charged field in ReconstructedParticle --- src/algorithms/meta/SubDivideFunctors.h | 14 +++++++------- src/global/reco/reco.cc | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/algorithms/meta/SubDivideFunctors.h b/src/algorithms/meta/SubDivideFunctors.h index 35075a4cee..40d58ba7e0 100644 --- a/src/algorithms/meta/SubDivideFunctors.h +++ b/src/algorithms/meta/SubDivideFunctors.h @@ -136,16 +136,16 @@ class ValueSplit { template class BooleanSplit { public: - using ComparisonFunction = std::function; + using ComparisonFunction = std::function; - BooleanSplit( std::vector> ids, ComparisonFunction comparison) + BooleanSplit( std::vector> ids, ComparisonFunction comparison) : m_ids(ids), m_comparisons(ids.size(), comparison) {}; - BooleanSplit( std::vector ids, ComparisonFunction comparison) + BooleanSplit( std::vector ids, ComparisonFunction comparison) : m_ids(1,ids), m_comparisons(ids.size(), comparison) {}; - BooleanSplit( std::vector> ids, std::vector comparisons) + BooleanSplit( std::vector> ids, std::vector comparisons) : m_ids(ids) { if (ids.size() != comparisons.size()) { throw std::invalid_argument("Size of values to compare must match the size of boolean functions"); @@ -157,7 +157,7 @@ class BooleanSplit { std::vector operator()(T& instance) const { std::vector ids; // Check if requested value matches any configuration combinations - std::vector values; + std::vector values; (values.push_back((instance.*MemberFunctionPtrs)()), ...); for (size_t i = 0; i < m_ids.size(); ++i){ if(compareVectors(m_ids[i], values, m_comparisons)){ @@ -168,10 +168,10 @@ class BooleanSplit { } private: - std::vector> m_ids; + std::vector> m_ids; std::vector m_comparisons; - static bool compareVectors(const std::vector& vec1, const std::vector& vec2, const std::vector& comparisons) { + static bool compareVectors(const std::vector& vec1, const std::vector& vec2, const std::vector& comparisons) { for (size_t i = 0; i < vec1.size(); ++i) { if (!comparisons[i](vec1[i], vec2[i])) { return false; diff --git a/src/global/reco/reco.cc b/src/global/reco/reco.cc index 7040d58cda..4ad2bfea41 100644 --- a/src/global/reco/reco.cc +++ b/src/global/reco/reco.cc @@ -255,7 +255,7 @@ void InitPlugin(JApplication *app) { "GeneratedChargedParticles", {"GeneratedParticles"}, {"GeneratedChargedParticles"}, - {.function = BooleanSplit<&edm4eic::ReconstructedParticle::getCharge>{{0},std::not_equal_to{}}}, + {.function = BooleanSplit<&edm4eic::ReconstructedParticle::getCharge>{{0.0},std::not_equal_to{}}}, app )); From 5acacfd2d3d23928d742e2da4757c172d5ee31ea Mon Sep 17 00:00:00 2001 From: simonge Date: Wed, 28 Aug 2024 21:50:24 +0100 Subject: [PATCH 21/21] specify float array --- src/global/reco/reco.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/global/reco/reco.cc b/src/global/reco/reco.cc index 4ad2bfea41..7c9b070e68 100644 --- a/src/global/reco/reco.cc +++ b/src/global/reco/reco.cc @@ -255,7 +255,7 @@ void InitPlugin(JApplication *app) { "GeneratedChargedParticles", {"GeneratedParticles"}, {"GeneratedChargedParticles"}, - {.function = BooleanSplit<&edm4eic::ReconstructedParticle::getCharge>{{0.0},std::not_equal_to{}}}, + {.function = BooleanSplit<&edm4eic::ReconstructedParticle::getCharge>{std::vector{0.0},std::not_equal_to{}}}, app ));