From 9cfe1898f8335ff94745cdf56862b0fc44e7d7cb Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 20 Feb 2025 17:26:15 +0100 Subject: [PATCH] refactor: Drop `SympyStepper::stepImpl` (#4103) After getting rid of the templated `step` function there is no reason to have a separate `stepImpl` function anymore. This PR is merging `stepImpl` into `step` and drops former. ## Summary by CodeRabbit - **Refactor** - Streamlined the stepping process by centralizing configuration parameters within the system's state. - Improved error handling and step size scaling to maintain consistent performance. --- Core/include/Acts/Propagator/SympyStepper.hpp | 5 ----- Core/src/Propagator/SympyStepper.cpp | 16 +++++----------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Core/include/Acts/Propagator/SympyStepper.hpp b/Core/include/Acts/Propagator/SympyStepper.hpp index f64be7cb8f0..46f5e5d2c79 100644 --- a/Core/include/Acts/Propagator/SympyStepper.hpp +++ b/Core/include/Acts/Propagator/SympyStepper.hpp @@ -379,11 +379,6 @@ class SympyStepper { protected: /// Magnetic field inside of the detector std::shared_ptr m_bField; - - private: - Result stepImpl(State& state, Direction propDir, double stepTolerance, - double stepSizeCutOff, - std::size_t maxRungeKuttaStepTrials) const; }; template <> diff --git a/Core/src/Propagator/SympyStepper.cpp b/Core/src/Propagator/SympyStepper.cpp index bc0cf3c2eb4..2b004ac835b 100644 --- a/Core/src/Propagator/SympyStepper.cpp +++ b/Core/src/Propagator/SympyStepper.cpp @@ -129,14 +129,7 @@ void SympyStepper::transportCovarianceToBound( Result SympyStepper::step(State& state, Direction propDir, const IVolumeMaterial* material) const { (void)material; - return stepImpl(state, propDir, state.options.stepTolerance, - state.options.stepSizeCutOff, - state.options.maxRungeKuttaStepTrials); -} -Result SympyStepper::stepImpl( - State& state, Direction propDir, double stepTolerance, - double stepSizeCutOff, std::size_t maxRungeKuttaStepTrials) const { auto pos = position(state); auto dir = direction(state); double t = time(state); @@ -155,7 +148,7 @@ Result SympyStepper::stepImpl( // This is given by the order of the Runge-Kutta method constexpr double exponent = 0.25; - double x = stepTolerance / errorEstimate_; + double x = state.options.stepTolerance / errorEstimate_; if constexpr (exponent == 0.25) { // This is 3x faster than std::pow @@ -179,7 +172,8 @@ Result SympyStepper::stepImpl( // For details about the factor 4 see ATL-SOFT-PUB-2009-001 Result res = rk4(pos.data(), dir.data(), t, h, qop, m, p_abs, getB, &errorEstimate, - 4 * stepTolerance, state.pars.template segment<3>(eFreePos0).data(), + 4 * state.options.stepTolerance, + state.pars.template segment<3>(eFreePos0).data(), state.pars.template segment<3>(eFreeDir0).data(), state.pars.template segment<1>(eFreeTime).data(), state.derivative.data(), @@ -201,14 +195,14 @@ Result SympyStepper::stepImpl( // If step size becomes too small the particle remains at the initial // place - if (std::abs(h) < std::abs(stepSizeCutOff)) { + if (std::abs(h) < std::abs(state.options.stepSizeCutOff)) { // Not moving due to too low momentum needs an aborter return EigenStepperError::StepSizeStalled; } // If the parameter is off track too much or given stepSize is not // appropriate - if (nStepTrials > maxRungeKuttaStepTrials) { + if (nStepTrials > state.options.maxRungeKuttaStepTrials) { // Too many trials, have to abort return EigenStepperError::StepSizeAdjustmentFailed; }