diff --git a/Core/include/Acts/Material/MaterialComposition.hpp b/Core/include/Acts/Material/MaterialComposition.hpp index 2768e62ff2d..38f1d9a19b9 100644 --- a/Core/include/Acts/Material/MaterialComposition.hpp +++ b/Core/include/Acts/Material/MaterialComposition.hpp @@ -38,8 +38,9 @@ class ElementFraction { /// @param e is the atomic number of the element /// @param f is the relative fraction and must be a value in [0,1] constexpr ElementFraction(unsigned int e, float f) - : m_element(static_cast(e)), - m_fraction(static_cast(f * UINT8_MAX)) { + : m_element(static_cast(e)), + m_fraction(static_cast( + f * std::numeric_limits::max())) { assert((0u < e) && ("The atomic number must be positive")); assert((0.0f <= f) && (f <= 1.0f) && "Relative fraction must be in [0,1]"); } @@ -48,8 +49,8 @@ class ElementFraction { /// @param e is the atomic number of the element /// @param w is the integer weight and must be a value in [0,256) constexpr explicit ElementFraction(unsigned int e, unsigned int w) - : m_element(static_cast(e)), - m_fraction(static_cast(w)) { + : m_element(static_cast(e)), + m_fraction(static_cast(w)) { assert((0u < e) && ("The atomic number must be positive")); assert((w < 256u) && "Integer weight must be in [0,256)"); } @@ -66,7 +67,8 @@ class ElementFraction { constexpr uint8_t element() const { return m_element; } /// The relative fraction of this element. constexpr float fraction() const { - return static_cast(m_fraction) / UINT8_MAX; + return static_cast(m_fraction) / + std::numeric_limits::max(); } private: diff --git a/Core/include/Acts/Surfaces/BoundaryCheck.hpp b/Core/include/Acts/Surfaces/BoundaryCheck.hpp index be686b65d3a..4acad8addfe 100644 --- a/Core/include/Acts/Surfaces/BoundaryCheck.hpp +++ b/Core/include/Acts/Surfaces/BoundaryCheck.hpp @@ -178,8 +178,9 @@ inline Acts::BoundaryCheck::BoundaryCheck(bool check) inline Acts::BoundaryCheck::BoundaryCheck(bool checkLocal0, bool checkLocal1, double tolerance0, double tolerance1) : m_weight(SquareMatrix2::Identity()), - m_tolerance(checkLocal0 ? tolerance0 : DBL_MAX, - checkLocal1 ? tolerance1 : DBL_MAX), + m_tolerance( + checkLocal0 ? tolerance0 : std::numeric_limits::max(), + checkLocal1 ? tolerance1 : std::numeric_limits::max()), m_type(Type::eAbsolute) {} inline Acts::BoundaryCheck::BoundaryCheck(const SquareMatrix2& localCovariance, diff --git a/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp b/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp index 8c8417826cc..6f0f752257e 100644 --- a/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp +++ b/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp @@ -181,13 +181,13 @@ struct Gx2FitterResult { // This is the index of the 'tip' of the track stored in multitrajectory. // This corresponds to the last measurement state in the multitrajectory. // Since this KF only stores one trajectory, it is unambiguous. - // SIZE_MAX is the start of a trajectory. + // Acts::MultiTrajectoryTraits::kInvalid is the start of a trajectory. std::size_t lastMeasurementIndex = Acts::MultiTrajectoryTraits::kInvalid; // This is the index of the 'tip' of the states stored in multitrajectory. // This corresponds to the last state in the multitrajectory. // Since this KF only stores one trajectory, it is unambiguous. - // SIZE_MAX is the start of a trajectory. + // Acts::MultiTrajectoryTraits::kInvalid is the start of a trajectory. std::size_t lastTrackIndex = Acts::MultiTrajectoryTraits::kInvalid; // The optional Parameters at the provided surface diff --git a/Core/include/Acts/TrackFitting/KalmanFitter.hpp b/Core/include/Acts/TrackFitting/KalmanFitter.hpp index 0cb9ba12982..8ad5f0b750b 100644 --- a/Core/include/Acts/TrackFitting/KalmanFitter.hpp +++ b/Core/include/Acts/TrackFitting/KalmanFitter.hpp @@ -195,14 +195,14 @@ struct KalmanFitterResult { /// This is the index of the 'tip' of the track stored in multitrajectory. /// This corresponds to the last measurement state in the multitrajectory. /// Since this KF only stores one trajectory, it is unambiguous. - /// SIZE_MAX is the start of a trajectory. - std::size_t lastMeasurementIndex = SIZE_MAX; + /// Acts::MultiTrajectoryTraits::kInvalid is the start of a trajectory. + std::size_t lastMeasurementIndex = Acts::MultiTrajectoryTraits::kInvalid; /// This is the index of the 'tip' of the states stored in multitrajectory. /// This corresponds to the last state in the multitrajectory. /// Since this KF only stores one trajectory, it is unambiguous. - /// SIZE_MAX is the start of a trajectory. - std::size_t lastTrackIndex = SIZE_MAX; + /// Acts::MultiTrajectoryTraits::kInvalid is the start of a trajectory. + std::size_t lastTrackIndex = Acts::MultiTrajectoryTraits::kInvalid; /// The optional Parameters at the provided surface std::optional fittedParameters; @@ -528,7 +528,8 @@ class KalmanFitter { const navigator_t& navigator, result_type& result) const { // Check if there is a measurement on track - if (result.lastMeasurementIndex == SIZE_MAX) { + if (result.lastMeasurementIndex == + Acts::MultiTrajectoryTraits::kInvalid) { ACTS_ERROR("No point to reverse for a track without measurements."); return KalmanFitterError::ReverseNavigationFailed; } diff --git a/Core/include/Acts/TrackFitting/detail/KalmanGlobalCovariance.hpp b/Core/include/Acts/TrackFitting/detail/KalmanGlobalCovariance.hpp index b5c9ded721f..7daaa52e88f 100644 --- a/Core/include/Acts/TrackFitting/detail/KalmanGlobalCovariance.hpp +++ b/Core/include/Acts/TrackFitting/detail/KalmanGlobalCovariance.hpp @@ -40,13 +40,13 @@ globalTrackParametersCovariance(const traj_t& multiTraj, using GainMatrix = CovMatrix; // The last smoothed state index - std::size_t lastSmoothedIndex = SIZE_MAX; + std::size_t lastSmoothedIndex = Acts::MultiTrajectoryTraits::kInvalid; // The total number of smoothed states std::size_t nSmoothedStates = 0; // Visit all the states multiTraj.visitBackwards(entryIndex, [&](const auto& ts) { if (ts.hasSmoothed()) { - if (lastSmoothedIndex == SIZE_MAX) { + if (lastSmoothedIndex == Acts::MultiTrajectoryTraits::kInvalid) { lastSmoothedIndex = ts.index(); } nSmoothedStates++; diff --git a/Core/include/Acts/Utilities/detail/Subspace.hpp b/Core/include/Acts/Utilities/detail/Subspace.hpp index a9db25348e8..a2ec07faaa8 100644 --- a/Core/include/Acts/Utilities/detail/Subspace.hpp +++ b/Core/include/Acts/Utilities/detail/Subspace.hpp @@ -61,7 +61,8 @@ namespace Acts::detail { /// @tparam kSize Size of the subspace template class FixedSizeSubspace { - static_assert(kFullSize <= static_cast(UINT8_MAX), + static_assert(kFullSize <= static_cast( + std::numeric_limits::max()), "Full vector space size is larger than the supported range"); static_assert(1u <= kSize, "Subspace size must be at least 1"); static_assert(kSize <= kFullSize, diff --git a/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp b/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp index 3834645ed7e..5eb6a6cab49 100644 --- a/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp +++ b/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -308,9 +309,9 @@ ActsExamples::DigitizationAlgorithm::localParameters( Acts::ActsScalar totalWeight = 0.; Acts::Vector2 m(0., 0.); - std::size_t b0min = SIZE_MAX; + std::size_t b0min = std::numeric_limits::max(); std::size_t b0max = 0; - std::size_t b1min = SIZE_MAX; + std::size_t b1min = std::numeric_limits::max(); std::size_t b1max = 0; // Combine the channels for (const auto& ch : channels) { diff --git a/Examples/Algorithms/Digitization/src/ModuleClusters.cpp b/Examples/Algorithms/Digitization/src/ModuleClusters.cpp index 180428722cc..1478dbe750d 100644 --- a/Examples/Algorithms/Digitization/src/ModuleClusters.cpp +++ b/Examples/Algorithms/Digitization/src/ModuleClusters.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -270,9 +271,9 @@ ModuleValue ModuleClusters::squash(std::vector& values) { Acts::Vector2 pos(0., 0.); Acts::Vector2 var(0., 0.); - std::size_t b0min = SIZE_MAX; + std::size_t b0min = std::numeric_limits::max(); std::size_t b0max = 0; - std::size_t b1min = SIZE_MAX; + std::size_t b1min = std::numeric_limits::max(); std::size_t b1max = 0; for (std::size_t i = 0; i < values.size(); i++) { diff --git a/Examples/Algorithms/Generators/ActsExamples/Generators/EventGenerator.cpp b/Examples/Algorithms/Generators/ActsExamples/Generators/EventGenerator.cpp index 03454952aea..16b575b4529 100644 --- a/Examples/Algorithms/Generators/ActsExamples/Generators/EventGenerator.cpp +++ b/Examples/Algorithms/Generators/ActsExamples/Generators/EventGenerator.cpp @@ -13,7 +13,7 @@ #include "ActsFatras/EventData/Barcode.hpp" #include "ActsFatras/EventData/Particle.hpp" -#include +#include #include #include @@ -43,7 +43,7 @@ std::string ActsExamples::EventGenerator::name() const { std::pair ActsExamples::EventGenerator::availableEvents() const { - return {0u, SIZE_MAX}; + return {0u, std::numeric_limits::max()}; } ActsExamples::ProcessCode ActsExamples::EventGenerator::read( diff --git a/Examples/Algorithms/Generators/ActsExamples/Generators/EventGenerator.hpp b/Examples/Algorithms/Generators/ActsExamples/Generators/EventGenerator.hpp index 6f4a8260e97..90ecece72bb 100644 --- a/Examples/Algorithms/Generators/ActsExamples/Generators/EventGenerator.hpp +++ b/Examples/Algorithms/Generators/ActsExamples/Generators/EventGenerator.hpp @@ -105,7 +105,8 @@ class EventGenerator final : public ActsExamples::IReader { /// Name of the reader. std::string name() const final; - /// Available events range. Always return [0,SIZE_MAX) since we generate them. + /// Available events range. Always return + /// [0,std::numeric_limits::max()) since we generate them. std::pair availableEvents() const final; /// Generate an event. ProcessCode read(const AlgorithmContext& ctx) final; diff --git a/Examples/Framework/include/ActsExamples/Framework/IReader.hpp b/Examples/Framework/include/ActsExamples/Framework/IReader.hpp index 527ef4e0e76..51e056c24e3 100644 --- a/Examples/Framework/include/ActsExamples/Framework/IReader.hpp +++ b/Examples/Framework/include/ActsExamples/Framework/IReader.hpp @@ -24,7 +24,8 @@ namespace ActsExamples { /// calls. class IReader : public SequenceElement { public: - /// Provide range of available events or [0, SIZE_MAX) if undefined. + /// Provide range of available events or [0, + /// std::numeric_limits::max()) if undefined. /// /// The upper limit is exclusive, i.e. [0,3) means events 0, 1, and 2. virtual std::pair availableEvents() const = 0; diff --git a/Examples/Framework/include/ActsExamples/Framework/Sequencer.hpp b/Examples/Framework/include/ActsExamples/Framework/Sequencer.hpp index 947e8495089..70a29825142 100644 --- a/Examples/Framework/include/ActsExamples/Framework/Sequencer.hpp +++ b/Examples/Framework/include/ActsExamples/Framework/Sequencer.hpp @@ -67,7 +67,8 @@ class Sequencer { struct Config { /// number of events to skip at the beginning std::size_t skip = 0; - /// number of events to process, SIZE_MAX to process all available events + /// number of events to process, std::numeric_limits::max() to + /// process all available events std::optional events = std::nullopt; /// logging level Acts::Logging::Level logLevel = Acts::Logging::INFO; @@ -158,7 +159,9 @@ class Sequencer { private: /// List of all configured algorithm names. std::vector listAlgorithmNames() const; - /// Determine range of (requested) events; [SIZE_MAX, SIZE_MAX) for error. + /// Determine range of (requested) events; + /// [std::numeric_limits::max(), + /// std::numeric_limits::max()) for error. std::pair determineEventsRange() const; std::pair fpeMaskCount( diff --git a/Examples/Framework/src/Framework/Sequencer.cpp b/Examples/Framework/src/Framework/Sequencer.cpp index 400f3bab352..945a66aab8d 100644 --- a/Examples/Framework/src/Framework/Sequencer.cpp +++ b/Examples/Framework/src/Framework/Sequencer.cpp @@ -67,7 +67,8 @@ std::string_view getAlgorithmType(const SequenceElement& element) { return "Algorithm"; } -// Saturated addition that does not overflow and exceed SIZE_MAX. +// Saturated addition that does not overflow and exceed +// std::numeric_limits::max(). // // From http://locklessinc.com/articles/sat_arithmetic/ std::size_t saturatedAdd(std::size_t a, std::size_t b) { @@ -290,7 +291,9 @@ std::vector Sequencer::listAlgorithmNames() const { } std::pair Sequencer::determineEventsRange() const { - constexpr auto kInvalidEventsRange = std::make_pair(SIZE_MAX, SIZE_MAX); + constexpr auto kInvalidEventsRange = + std::make_pair(std::numeric_limits::max(), + std::numeric_limits::max()); // Note on skipping events: // @@ -303,7 +306,7 @@ std::pair Sequencer::determineEventsRange() const { // determine intersection of event ranges available from readers std::size_t beg = 0u; - std::size_t end = SIZE_MAX; + std::size_t end = std::numeric_limits::max(); for (const auto& reader : m_readers) { auto available = reader->availableEvents(); beg = std::max(beg, available.first); @@ -329,7 +332,8 @@ std::pair Sequencer::determineEventsRange() const { return kInvalidEventsRange; } // events range was not defined by either the readers or user command line. - if ((beg == 0u) && (end == SIZE_MAX) && (!m_cfg.events.has_value())) { + if ((beg == 0u) && (end == std::numeric_limits::max()) && + (!m_cfg.events.has_value())) { ACTS_ERROR("Could not determine number of events"); return kInvalidEventsRange; } @@ -421,7 +425,8 @@ int Sequencer::run() { // processing only works w/ a well-known number of events // error message is already handled by the helper function std::pair eventsRange = determineEventsRange(); - if ((eventsRange.first == SIZE_MAX) && (eventsRange.second == SIZE_MAX)) { + if ((eventsRange.first == std::numeric_limits::max()) && + (eventsRange.second == std::numeric_limits::max())) { return EXIT_FAILURE; } diff --git a/Examples/Framework/src/Utilities/Paths.cpp b/Examples/Framework/src/Utilities/Paths.cpp index eb1a1cbdd05..8cd858a40e4 100644 --- a/Examples/Framework/src/Utilities/Paths.cpp +++ b/Examples/Framework/src/Utilities/Paths.cpp @@ -77,7 +77,7 @@ std::pair ActsExamples::determineEventFilesRange( } // invalid default range that allows simple restriction later on - std::size_t eventMin = SIZE_MAX; + std::size_t eventMin = std::numeric_limits::max(); std::size_t eventMax = 0; // filter matching event files from the directory listing diff --git a/Examples/Io/NuclearInteractions/include/ActsExamples/Io/NuclearInteractions/detail/NuclearInteractionParametrisation.hpp b/Examples/Io/NuclearInteractions/include/ActsExamples/Io/NuclearInteractions/detail/NuclearInteractionParametrisation.hpp index c0efc4e1eb5..97ab2338d96 100644 --- a/Examples/Io/NuclearInteractions/include/ActsExamples/Io/NuclearInteractions/detail/NuclearInteractionParametrisation.hpp +++ b/Examples/Io/NuclearInteractions/include/ActsExamples/Io/NuclearInteractions/detail/NuclearInteractionParametrisation.hpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -53,7 +54,8 @@ struct EventFraction { float initialMomentum = 0.; }; -static constexpr uint32_t s_MaxValue = UINT32_MAX; +static constexpr std::uint32_t s_MaxValue = + std::numeric_limits::max(); using EventCollection = std::vector; using EventProperties = std::vector>; using ProbabilityDistributions = std::vector; diff --git a/Examples/Io/NuclearInteractions/src/RootNuclearInteractionParametersWriter.cpp b/Examples/Io/NuclearInteractions/src/RootNuclearInteractionParametersWriter.cpp index 7ccbf331270..2c054cc8859 100644 --- a/Examples/Io/NuclearInteractions/src/RootNuclearInteractionParametersWriter.cpp +++ b/Examples/Io/NuclearInteractions/src/RootNuclearInteractionParametersWriter.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -175,8 +176,9 @@ std::pair, std::vector> buildMap( std::vector normalisedHistoContents(nBins); const double invIntegral = 1. / std::get<2>(map); for (int iBin = 0; iBin < nBins; ++iBin) { - normalisedHistoContents[iBin] = static_cast( - UINT32_MAX * (histoContents[iBin] * invIntegral)); + normalisedHistoContents[iBin] = + static_cast(std::numeric_limits::max() * + (histoContents[iBin] * invIntegral)); } auto histoBorders = std::get<0>(map); @@ -213,8 +215,9 @@ std::pair, std::vector> buildMap(TH1F const* hist, std::vector normalisedHistoContents(nBins); const double invIntegral = 1. / std::max(integral, std::get<2>(map)); for (int iBin = 0; iBin < nBins; ++iBin) { - normalisedHistoContents[iBin] = static_cast( - UINT32_MAX * (histoContents[iBin] * invIntegral)); + normalisedHistoContents[iBin] = + static_cast(std::numeric_limits::max() * + (histoContents[iBin] * invIntegral)); } std::vector histoBorders = std::get<0>(map); diff --git a/Fatras/include/ActsFatras/Kernel/InteractionList.hpp b/Fatras/include/ActsFatras/Kernel/InteractionList.hpp index e02a35b2898..c148446c6cb 100644 --- a/Fatras/include/ActsFatras/Kernel/InteractionList.hpp +++ b/Fatras/include/ActsFatras/Kernel/InteractionList.hpp @@ -185,8 +185,8 @@ class InteractionList { std::numeric_limits::infinity(); Particle::Scalar l0Limit = std::numeric_limits::infinity(); - std::size_t x0Process = SIZE_MAX; - std::size_t l0Process = SIZE_MAX; + std::size_t x0Process = std::numeric_limits::max(); + std::size_t l0Process = std::numeric_limits::max(); }; /// Disable a specific process identified by index. diff --git a/Fatras/include/ActsFatras/Kernel/SimulationResult.hpp b/Fatras/include/ActsFatras/Kernel/SimulationResult.hpp index 81d25b72154..9ffbc04278d 100644 --- a/Fatras/include/ActsFatras/Kernel/SimulationResult.hpp +++ b/Fatras/include/ActsFatras/Kernel/SimulationResult.hpp @@ -44,8 +44,8 @@ struct SimulationResult { Particle::Scalar x0Limit = std::numeric_limits::quiet_NaN(); Particle::Scalar l0Limit = std::numeric_limits::quiet_NaN(); // Process selection for the next interaction. - std::size_t x0Process = SIZE_MAX; - std::size_t l0Process = SIZE_MAX; + std::size_t x0Process = std::numeric_limits::max(); + std::size_t l0Process = std::numeric_limits::max(); }; } // namespace ActsFatras diff --git a/Fatras/src/Physics/NuclearInteraction/NuclearInteraction.cpp b/Fatras/src/Physics/NuclearInteraction/NuclearInteraction.cpp index 483ea94b102..5b1a8ce90fd 100644 --- a/Fatras/src/Physics/NuclearInteraction/NuclearInteraction.cpp +++ b/Fatras/src/Physics/NuclearInteraction/NuclearInteraction.cpp @@ -55,7 +55,8 @@ unsigned int NuclearInteraction::sampleDiscreteValues( } // Find the bin - const uint32_t int_rnd = static_cast(UINT32_MAX * rnd); + const std::uint32_t int_rnd = static_cast( + std::numeric_limits::max() * rnd); const auto it = std::upper_bound(distribution.second.begin(), distribution.second.end(), int_rnd); std::size_t iBin = std::min( @@ -77,7 +78,8 @@ Particle::Scalar NuclearInteraction::sampleContinuousValues( } // Find the bin - const uint32_t int_rnd = static_cast(UINT32_MAX * rnd); + const std::uint32_t int_rnd = static_cast( + std::numeric_limits::max() * rnd); // Fast exit for non-normalised CDFs like interaction probability if (int_rnd > distribution.second.back()) { return std::numeric_limits::infinity(); diff --git a/Tests/UnitTests/Core/Utilities/AlgebraHelpersTests.cpp b/Tests/UnitTests/Core/Utilities/AlgebraHelpersTests.cpp index a6356e4cfa5..978a27953ed 100644 --- a/Tests/UnitTests/Core/Utilities/AlgebraHelpersTests.cpp +++ b/Tests/UnitTests/Core/Utilities/AlgebraHelpersTests.cpp @@ -68,7 +68,8 @@ BOOST_AUTO_TEST_CASE(safeInverseBadLargeMatrix) { } BOOST_AUTO_TEST_CASE(SafeInverseFPESmallMatrix) { - Eigen::Matrix m = Eigen::MatrixXd::Identity(4, 4) * SIZE_MAX; + Eigen::Matrix m = + Eigen::MatrixXd::Identity(4, 4) * std::numeric_limits::max(); m(1, 1) = 1; auto mInv = Acts::safeInverse(m); @@ -88,7 +89,8 @@ BOOST_AUTO_TEST_CASE(SafeInverseFPESmallMatrix) { } BOOST_AUTO_TEST_CASE(SafeInverseFPELargeMatrix) { - Eigen::Matrix m = Eigen::MatrixXd::Identity(5, 5) * SIZE_MAX; + Eigen::Matrix m = + Eigen::MatrixXd::Identity(5, 5) * std::numeric_limits::max(); m(1, 1) = 1; auto mInv = Acts::safeInverse(m); diff --git a/Tests/UnitTests/Core/Utilities/MultiIndexTests.cpp b/Tests/UnitTests/Core/Utilities/MultiIndexTests.cpp index a3a9c48e9d3..eee44a157e7 100644 --- a/Tests/UnitTests/Core/Utilities/MultiIndexTests.cpp +++ b/Tests/UnitTests/Core/Utilities/MultiIndexTests.cpp @@ -212,7 +212,7 @@ BOOST_AUTO_TEST_CASE(index32_as_key) { set.emplace(Index32::Encode(2u)); BOOST_CHECK(!set.count(Index32(0u))); - BOOST_CHECK(!set.count(Index32(UINT32_MAX))); + BOOST_CHECK(!set.count(Index32(std::numeric_limits::max()))); BOOST_CHECK_EQUAL(set.size(), 3); // automatically converts encoded value to MultiIndex BOOST_CHECK(set.count(0x00010204u)); @@ -230,6 +230,6 @@ BOOST_AUTO_TEST_CASE(index64_as_key) { set.emplace(Index64::Encode(2u, 1u)); BOOST_CHECK(!set.count(Index64(0u))); - BOOST_CHECK(!set.count(Index64(UINT64_MAX))); + BOOST_CHECK(!set.count(Index64(std::numeric_limits::max()))); BOOST_CHECK_EQUAL(set.size(), 3); } diff --git a/Tests/UnitTests/Fatras/Kernel/InteractionListTests.cpp b/Tests/UnitTests/Fatras/Kernel/InteractionListTests.cpp index 2b88f8ef32a..c86dcf58105 100644 --- a/Tests/UnitTests/Fatras/Kernel/InteractionListTests.cpp +++ b/Tests/UnitTests/Fatras/Kernel/InteractionListTests.cpp @@ -131,15 +131,16 @@ BOOST_AUTO_TEST_CASE(Empty) { auto sel = l.armPointLike(f.rng, f.incoming); BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits::infinity()); BOOST_CHECK_EQUAL(sel.l0Limit, std::numeric_limits::infinity()); - BOOST_CHECK_EQUAL(sel.x0Process, SIZE_MAX); - BOOST_CHECK_EQUAL(sel.l0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(sel.x0Process, std::numeric_limits::max()); + BOOST_CHECK_EQUAL(sel.l0Process, std::numeric_limits::max()); // running with an invalid process index should do nothing // interaction list is empty and 0 should already be invalid BOOST_CHECK(!l.runPointLike(f.rng, 0u, f.incoming, f.outgoing)); BOOST_CHECK_EQUAL(f.outgoing.size(), 0u); - // SIZE_MAX should always be an invalid index - BOOST_CHECK(!l.runPointLike(f.rng, SIZE_MAX, f.incoming, f.outgoing)); + // std::numeric_limits::max() should always be an invalid index + BOOST_CHECK(!l.runPointLike(f.rng, std::numeric_limits::max(), + f.incoming, f.outgoing)); BOOST_CHECK_EQUAL(f.outgoing.size(), 0u); } @@ -180,13 +181,14 @@ BOOST_AUTO_TEST_CASE(PointLikeX0) { BOOST_CHECK_EQUAL(sel.x0Limit, 0.5); BOOST_CHECK_EQUAL(sel.l0Limit, std::numeric_limits::infinity()); BOOST_CHECK_EQUAL(sel.x0Process, 0u); - BOOST_CHECK_EQUAL(sel.l0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(sel.l0Process, std::numeric_limits::max()); // valid index, X0Process leaves the particle alive BOOST_CHECK(!l.runPointLike(f.rng, 0u, f.incoming, f.outgoing)); BOOST_CHECK_EQUAL(f.outgoing.size(), 1u); // invalid index, should do nothing - BOOST_CHECK(!l.runPointLike(f.rng, SIZE_MAX, f.incoming, f.outgoing)); + BOOST_CHECK(!l.runPointLike(f.rng, std::numeric_limits::max(), + f.incoming, f.outgoing)); BOOST_CHECK_EQUAL(f.outgoing.size(), 1u); } @@ -198,14 +200,15 @@ BOOST_AUTO_TEST_CASE(PointLikeL0) { auto sel = l.armPointLike(f.rng, f.incoming); BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits::infinity()); BOOST_CHECK_EQUAL(sel.l0Limit, 1.5); - BOOST_CHECK_EQUAL(sel.x0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(sel.x0Process, std::numeric_limits::max()); BOOST_CHECK_EQUAL(sel.l0Process, 0u); // valid index, L0Process kills the particles and creates 2 descendants BOOST_CHECK(l.runPointLike(f.rng, 0u, f.incoming, f.outgoing)); BOOST_CHECK_EQUAL(f.outgoing.size(), 2u); // invalid index, should do nothing - BOOST_CHECK(!l.runPointLike(f.rng, SIZE_MAX, f.incoming, f.outgoing)); + BOOST_CHECK(!l.runPointLike(f.rng, std::numeric_limits::max(), + f.incoming, f.outgoing)); BOOST_CHECK_EQUAL(f.outgoing.size(), 2u); } @@ -227,7 +230,8 @@ BOOST_AUTO_TEST_CASE(PointLikeX0L0) { BOOST_CHECK(l.runPointLike(f.rng, 1u, f.incoming, f.outgoing)); BOOST_CHECK_EQUAL(f.outgoing.size(), 3u); // invalid index, should do nothing - BOOST_CHECK(!l.runPointLike(f.rng, SIZE_MAX, f.incoming, f.outgoing)); + BOOST_CHECK(!l.runPointLike(f.rng, std::numeric_limits::max(), + f.incoming, f.outgoing)); BOOST_CHECK_EQUAL(f.outgoing.size(), 3u); } @@ -251,7 +255,7 @@ BOOST_AUTO_TEST_CASE(Disable) { auto sel = l.armPointLike(f.rng, f.incoming); BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits::infinity()); BOOST_CHECK_EQUAL(sel.l0Limit, 1.5); - BOOST_CHECK_EQUAL(sel.x0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(sel.x0Process, std::numeric_limits::max()); BOOST_CHECK_EQUAL(sel.l0Process, 3u); // index for X0Process, should do nothing since its disabled @@ -269,8 +273,8 @@ BOOST_AUTO_TEST_CASE(Disable) { auto sel = l.armPointLike(f.rng, f.incoming); BOOST_CHECK_EQUAL(sel.x0Limit, std::numeric_limits::infinity()); BOOST_CHECK_EQUAL(sel.l0Limit, std::numeric_limits::infinity()); - BOOST_CHECK_EQUAL(sel.x0Process, SIZE_MAX); - BOOST_CHECK_EQUAL(sel.l0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(sel.x0Process, std::numeric_limits::max()); + BOOST_CHECK_EQUAL(sel.l0Process, std::numeric_limits::max()); // index for X0Process, should do nothing since its disabled f.outgoing.clear(); @@ -283,7 +287,8 @@ BOOST_AUTO_TEST_CASE(Disable) { // invalid index, should do nothing f.outgoing.clear(); - BOOST_CHECK(!l.runPointLike(f.rng, SIZE_MAX, f.incoming, f.outgoing)); + BOOST_CHECK(!l.runPointLike(f.rng, std::numeric_limits::max(), + f.incoming, f.outgoing)); BOOST_CHECK_EQUAL(f.outgoing.size(), 0u); } diff --git a/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp b/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp index 4fee9292355..ee463e5a729 100644 --- a/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp +++ b/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp @@ -64,8 +64,8 @@ struct MockInteractionList { struct Selection { double x0Limit = std::numeric_limits::infinity(); double l0Limit = std::numeric_limits::infinity(); - std::size_t x0Process = SIZE_MAX; - std::size_t l0Process = SIZE_MAX; + std::size_t x0Process = std::numeric_limits::max(); + std::size_t l0Process = std::numeric_limits::max(); }; double energyLoss = 0; @@ -246,9 +246,11 @@ BOOST_AUTO_TEST_CASE(HitsOnEmptySurface) { BOOST_CHECK_EQUAL(f.result.particle.pathInL0(), 0); // no processes are configured, so none can be selected BOOST_CHECK_EQUAL(f.result.x0Limit, inf); - BOOST_CHECK_EQUAL(f.result.x0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.x0Process, + std::numeric_limits::max()); BOOST_CHECK_EQUAL(f.result.l0Limit, inf); - BOOST_CHECK_EQUAL(f.result.l0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.l0Process, + std::numeric_limits::max()); // check consistency between particle and stepper state BOOST_CHECK_EQUAL(f.state.stepping.pos, f.result.particle.position()); BOOST_CHECK_EQUAL(f.state.stepping.time, f.result.particle.time()); @@ -271,9 +273,11 @@ BOOST_AUTO_TEST_CASE(HitsOnEmptySurface) { BOOST_CHECK_EQUAL(f.result.particle.pathInL0(), 0); // no processes are configured, so none can be selected BOOST_CHECK_EQUAL(f.result.x0Limit, inf); - BOOST_CHECK_EQUAL(f.result.x0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.x0Process, + std::numeric_limits::max()); BOOST_CHECK_EQUAL(f.result.l0Limit, inf); - BOOST_CHECK_EQUAL(f.result.l0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.l0Process, + std::numeric_limits::max()); // check consistency between particle and stepper state BOOST_CHECK_EQUAL(f.state.stepping.pos, f.result.particle.position()); BOOST_CHECK_EQUAL(f.state.stepping.time, f.result.particle.time()); @@ -314,9 +318,11 @@ BOOST_AUTO_TEST_CASE(HitsOnMaterialSurface) { BOOST_CHECK_EQUAL(f.result.particle.pathInL0(), 1); // no processes are configured, so none can be selected BOOST_CHECK_EQUAL(f.result.x0Limit, inf); - BOOST_CHECK_EQUAL(f.result.x0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.x0Process, + std::numeric_limits::max()); BOOST_CHECK_EQUAL(f.result.l0Limit, inf); - BOOST_CHECK_EQUAL(f.result.l0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.l0Process, + std::numeric_limits::max()); // check consistency between particle and stepper state BOOST_CHECK_EQUAL(f.state.stepping.pos, f.result.particle.position()); BOOST_CHECK_EQUAL(f.state.stepping.time, f.result.particle.time()); @@ -340,9 +346,11 @@ BOOST_AUTO_TEST_CASE(HitsOnMaterialSurface) { BOOST_CHECK_EQUAL(f.result.particle.pathInL0(), 2); // no processes are configured, so none can be selected BOOST_CHECK_EQUAL(f.result.x0Limit, inf); - BOOST_CHECK_EQUAL(f.result.x0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.x0Process, + std::numeric_limits::max()); BOOST_CHECK_EQUAL(f.result.l0Limit, inf); - BOOST_CHECK_EQUAL(f.result.l0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.l0Process, + std::numeric_limits::max()); // check consistency between particle and stepper state BOOST_CHECK_EQUAL(f.state.stepping.pos, f.result.particle.position()); BOOST_CHECK_EQUAL(f.state.stepping.time, f.result.particle.time()); @@ -382,9 +390,11 @@ BOOST_AUTO_TEST_CASE(NoHitsEmptySurface) { BOOST_CHECK_EQUAL(f.result.particle.pathInL0(), 0); // no processes are configured, so none can be selected BOOST_CHECK_EQUAL(f.result.x0Limit, inf); - BOOST_CHECK_EQUAL(f.result.x0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.x0Process, + std::numeric_limits::max()); BOOST_CHECK_EQUAL(f.result.l0Limit, inf); - BOOST_CHECK_EQUAL(f.result.l0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.l0Process, + std::numeric_limits::max()); // check consistency between particle and stepper state BOOST_CHECK_EQUAL(f.state.stepping.pos, f.result.particle.position()); BOOST_CHECK_EQUAL(f.state.stepping.time, f.result.particle.time()); @@ -405,9 +415,11 @@ BOOST_AUTO_TEST_CASE(NoHitsEmptySurface) { BOOST_CHECK_EQUAL(f.result.particle.pathInL0(), 0); // no processes are configured, so none can be selected BOOST_CHECK_EQUAL(f.result.x0Limit, inf); - BOOST_CHECK_EQUAL(f.result.x0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.x0Process, + std::numeric_limits::max()); BOOST_CHECK_EQUAL(f.result.l0Limit, inf); - BOOST_CHECK_EQUAL(f.result.l0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.l0Process, + std::numeric_limits::max()); // check consistency between particle and stepper state BOOST_CHECK_EQUAL(f.state.stepping.pos, f.result.particle.position()); BOOST_CHECK_EQUAL(f.state.stepping.time, f.result.particle.time()); @@ -439,9 +451,11 @@ BOOST_AUTO_TEST_CASE(NoHitsMaterialSurface) { BOOST_CHECK_EQUAL(f.result.particle.pathInL0(), 1); // no processes are configured, so none can be selected BOOST_CHECK_EQUAL(f.result.x0Limit, inf); - BOOST_CHECK_EQUAL(f.result.x0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.x0Process, + std::numeric_limits::max()); BOOST_CHECK_EQUAL(f.result.l0Limit, inf); - BOOST_CHECK_EQUAL(f.result.l0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.l0Process, + std::numeric_limits::max()); // check consistency between particle and stepper state BOOST_CHECK_EQUAL(f.state.stepping.pos, f.result.particle.position()); BOOST_CHECK_EQUAL(f.state.stepping.time, f.result.particle.time()); @@ -463,9 +477,11 @@ BOOST_AUTO_TEST_CASE(NoHitsMaterialSurface) { BOOST_CHECK_EQUAL(f.result.particle.pathInL0(), 2); // no processes are configured, so none can be selected BOOST_CHECK_EQUAL(f.result.x0Limit, inf); - BOOST_CHECK_EQUAL(f.result.x0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.x0Process, + std::numeric_limits::max()); BOOST_CHECK_EQUAL(f.result.l0Limit, inf); - BOOST_CHECK_EQUAL(f.result.l0Process, SIZE_MAX); + BOOST_CHECK_EQUAL(f.result.l0Process, + std::numeric_limits::max()); // check consistency between particle and stepper state BOOST_CHECK_EQUAL(f.state.stepping.pos, f.result.particle.position()); BOOST_CHECK_EQUAL(f.state.stepping.time, f.result.particle.time()); diff --git a/docs/conf.py b/docs/conf.py index 158b96524be..4eee02a6850 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -112,7 +112,6 @@ nitpick_ignore = [ ("cpp:identifier", "Acts"), ("cpp:identifier", "detail"), - ("cpp:identifier", "SIZE_MAX"), ("cpp:identifier", "M_PI"), ("cpp:identifier", "eSize"), ("cpp:identifier", "eBoundSize"),