From 75886d6f540b65799b1c5bbc85eb15d418ec3330 Mon Sep 17 00:00:00 2001 From: Luis Falda Coelho <56648068+LuisFelipeCoelho@users.noreply.github.com> Date: Mon, 16 Jan 2023 11:00:33 +0100 Subject: [PATCH] feat: throw runtime_error in seed finder if deltaR values were not initialised (#1782) PR #1378 has changed the default values of `deltaRMinTopSP`, `deltaRMaxTopSP`, `deltaRMinBottomSP` and `deltaRMaxBottomSP` to NAN. As suggested by @osbornjd, we need to check that these variables have been correctly initialised in the seeder itself and not just in the SeedingAlgorithm, since the experiments will have their own seeding algorithms implemented within their own frameworks. This PR adds checks and exceptions to seedFinder if those values were NAN. --- Core/include/Acts/Seeding/SeedFinder.ipp | 12 ++++++++++++ .../include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp | 12 ++++++++++++ .../Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/Core/include/Acts/Seeding/SeedFinder.ipp b/Core/include/Acts/Seeding/SeedFinder.ipp index 790e6a0dbb0..b4081afc9fa 100644 --- a/Core/include/Acts/Seeding/SeedFinder.ipp +++ b/Core/include/Acts/Seeding/SeedFinder.ipp @@ -22,6 +22,18 @@ SeedFinder::SeedFinder( throw std::runtime_error( "SeedFinderConfig not in ACTS internal units in SeedFinder"); } + if (std::isnan(config.deltaRMaxTopSP)) { + throw std::runtime_error("Value of deltaRMaxTopSP was not initialised"); + } + if (std::isnan(config.deltaRMinTopSP)) { + throw std::runtime_error("Value of deltaRMinTopSP was not initialised"); + } + if (std::isnan(config.deltaRMaxBottomSP)) { + throw std::runtime_error("Value of deltaRMaxBottomSP was not initialised"); + } + if (std::isnan(config.deltaRMinBottomSP)) { + throw std::runtime_error("Value of deltaRMinBottomSP was not initialised"); + } } template diff --git a/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp b/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp index 098fc2ccfb7..86392402f5a 100644 --- a/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp +++ b/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp @@ -26,6 +26,18 @@ SeedFinder::SeedFinder( throw std::runtime_error( "SeedFinderOptions not in ACTS internal units in " "Cuda/Seeding/SeedFinder"); + if (std::isnan(m_config.deltaRMaxTopSP)) { + throw std::runtime_error("Value of deltaRMaxTopSP was not initialised"); + } + if (std::isnan(m_config.deltaRMinTopSP)) { + throw std::runtime_error("Value of deltaRMinTopSP was not initialised"); + } + if (std::isnan(m_config.deltaRMaxBottomSP)) { + throw std::runtime_error("Value of deltaRMaxBottomSP was not initialised"); + } + if (std::isnan(m_config.deltaRMinBottomSP)) { + throw std::runtime_error("Value of deltaRMinBottomSP was not initialised"); + } } // CUDA seed finding diff --git a/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp b/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp index 83ab0ba0fc8..11f1b2fbc2e 100644 --- a/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp +++ b/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp @@ -53,6 +53,18 @@ SeedFinder::SeedFinder( throw std::runtime_error( "SeedFilterConfig not in ACTS internal units in " "Cuda/Seeding2/SeedFinder"); + if (std::isnan(m_commonConfig.deltaRMaxTopSP)) { + throw std::runtime_error("Value of deltaRMaxTopSP was not initialised"); + } + if (std::isnan(m_commonConfig.deltaRMinTopSP)) { + throw std::runtime_error("Value of deltaRMinTopSP was not initialised"); + } + if (std::isnan(m_commonConfig.deltaRMaxBottomSP)) { + throw std::runtime_error("Value of deltaRMaxBottomSP was not initialised"); + } + if (std::isnan(m_commonConfig.deltaRMinBottomSP)) { + throw std::runtime_error("Value of deltaRMinBottomSP was not initialised"); + } // Tell the user what CUDA device will be used by the object. if (static_cast(m_device) < Info::instance().devices().size()) {