From 4a506f8298d13376c5c85335e3783c1e7aed43c8 Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Mon, 2 Dec 2024 15:51:03 +0100 Subject: [PATCH] refactor: replace `long unsigned int` with `std::size_t` (#3930) ## Summary by CodeRabbit - **New Features** - Enhanced error handling for input space points in the GbtsSeedingAlgorithm. - Improved seed finding logic based on internal ROI descriptors. - **Bug Fixes** - Updated handling of mapping logic to ensure clarity and prevent missing keys. - **Refactor** - Changed variable types from `long unsigned int` to `std::size_t` across multiple components for improved type safety. - **Tests** - Updated loop index types in various test cases to enhance type safety and align with best practices. --- Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp | 2 +- .../include/ActsExamples/Io/Root/RootAthenaDumpReader.hpp | 2 +- Tests/UnitTests/Plugins/GeoModel/GeoBoxToVolumeTest.cpp | 2 +- Tests/UnitTests/Plugins/GeoModel/GeoDetectorObjectTest.cpp | 4 ++-- Tests/UnitTests/Plugins/GeoModel/GeoPolyConverterTests.cpp | 4 ++-- Tests/UnitTests/Plugins/GeoModel/GeoTubeToVolumeTest.cpp | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp b/Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp index 677ba2b4c10..c126225aea1 100644 --- a/Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp +++ b/Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp @@ -355,7 +355,7 @@ ActsExamples::GbtsSeedingAlgorithm::LayerNumbering() const { } }); - for (long unsigned int i = 0; i < input_vector.size(); i++) { + for (std::size_t i = 0; i < input_vector.size(); i++) { input_vector[i].m_refCoord = input_vector[i].m_refCoord / count_vector[i]; } diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/RootAthenaDumpReader.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/RootAthenaDumpReader.hpp index 2a09d8492b2..f7873bd0e2a 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/RootAthenaDumpReader.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/RootAthenaDumpReader.hpp @@ -172,7 +172,7 @@ class RootAthenaDumpReader : public IReader { /// Vector of {eventNr, entryMin, entryMax} std::vector> m_eventMap; std::shared_ptr m_inputchain; - long unsigned int m_events; + std::size_t m_events; bool m_haveStripFeatures = true; static constexpr unsigned int maxCL = 1500000; diff --git a/Tests/UnitTests/Plugins/GeoModel/GeoBoxToVolumeTest.cpp b/Tests/UnitTests/Plugins/GeoModel/GeoBoxToVolumeTest.cpp index b905fda65ee..426b7cc07c3 100644 --- a/Tests/UnitTests/Plugins/GeoModel/GeoBoxToVolumeTest.cpp +++ b/Tests/UnitTests/Plugins/GeoModel/GeoBoxToVolumeTest.cpp @@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(GeoBoxToSensitiveConversion) { const auto* bounds = dynamic_cast(&volumeBox->volumeBounds()); std::vector convHls = bounds->values(); - for (long unsigned int i = 0; i < hls.size(); i++) { + for (std::size_t i = 0; i < hls.size(); i++) { BOOST_CHECK(hls[i] == convHls[i]); } } diff --git a/Tests/UnitTests/Plugins/GeoModel/GeoDetectorObjectTest.cpp b/Tests/UnitTests/Plugins/GeoModel/GeoDetectorObjectTest.cpp index 033f2c9cb4a..ae3c4ec0420 100644 --- a/Tests/UnitTests/Plugins/GeoModel/GeoDetectorObjectTest.cpp +++ b/Tests/UnitTests/Plugins/GeoModel/GeoDetectorObjectTest.cpp @@ -43,7 +43,7 @@ void test(const Acts::GeoModelDetectorObjectFactory::Cache& cache, GeoModelDetObj::GeoDims geoDims) { for (const auto& box : cache.boundingBoxes) { const Acts::VolumeBounds& bounds = box->volumeBounds(); - for (long unsigned int i = 0; i < geoDims.boxO.size(); i++) { + for (std::size_t i = 0; i < geoDims.boxO.size(); i++) { BOOST_CHECK(geoDims.boxO[i] == bounds.values()[i]); } std::vector surfaces = box->surfaces(); @@ -75,7 +75,7 @@ void test(const Acts::GeoModelDetectorObjectFactory::Cache& cache, dynamic_cast(&sbounds); std::vector trapVerts = trapBounds->vertices(); - for (long unsigned int i = 0; i < trapVerts.size(); i++) { + for (std::size_t i = 0; i < trapVerts.size(); i++) { BOOST_CHECK(trapVerts[i][0] == geoDims.trapVerts[i][0]); BOOST_CHECK(trapVerts[i][1] == geoDims.trapVerts[i][1]); } diff --git a/Tests/UnitTests/Plugins/GeoModel/GeoPolyConverterTests.cpp b/Tests/UnitTests/Plugins/GeoModel/GeoPolyConverterTests.cpp index b273b0a2364..a9ed6fa6f56 100644 --- a/Tests/UnitTests/Plugins/GeoModel/GeoPolyConverterTests.cpp +++ b/Tests/UnitTests/Plugins/GeoModel/GeoPolyConverterTests.cpp @@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE(GeoModelDetectorObjectFactory) { const auto* polyBounds = dynamic_cast(&polySurface->bounds()); std::vector convPolyVerts = polyBounds->vertices(); - for (long unsigned int i = 0; i < polyVerts.size(); i++) { + for (std::size_t i = 0; i < polyVerts.size(); i++) { BOOST_CHECK(polyVerts[i][0] == convPolyVerts[i][0]); BOOST_CHECK(polyVerts[i][1] == convPolyVerts[i][1]); } @@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(GeoModelDetectorObjectFactory) { const auto* trapBounds = dynamic_cast(&trapSurface->bounds()); std::vector convTrapVerts = trapBounds->vertices(); - for (long unsigned int i = 0; i < trapVerts.size(); i++) { + for (std::size_t i = 0; i < trapVerts.size(); i++) { BOOST_CHECK(trapVerts[i][0] == convTrapVerts[i][0]); BOOST_CHECK(trapVerts[i][1] == convTrapVerts[i][1]); } diff --git a/Tests/UnitTests/Plugins/GeoModel/GeoTubeToVolumeTest.cpp b/Tests/UnitTests/Plugins/GeoModel/GeoTubeToVolumeTest.cpp index 64d368e7f2b..fd58df2f7ff 100644 --- a/Tests/UnitTests/Plugins/GeoModel/GeoTubeToVolumeTest.cpp +++ b/Tests/UnitTests/Plugins/GeoModel/GeoTubeToVolumeTest.cpp @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(GeoBoxToSensitiveConversion) { const auto* bounds = dynamic_cast( &volumeTube->volumeBounds()); std::vector convDims = bounds->values(); - for (long unsigned int i = 0; i < dims.size(); i++) { + for (std::size_t i = 0; i < dims.size(); i++) { BOOST_CHECK(dims[i] == convDims[i]); } }