Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add option for initial step size #4101

Merged
merged 5 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Core/include/Acts/Propagator/AtlasStepper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ class AtlasStepper {
state.pathAccumulated = 0;
state.nSteps = 0;
state.nStepTrials = 0;
state.stepSize = ConstrainedStep(state.options.maxStepSize);
state.stepSize = ConstrainedStep();
state.stepSize.setAccuracy(state.options.initialStepSize);
state.stepSize.setUser(state.options.maxStepSize);
state.previousStepSize = 0;
state.statistics = StepperStatistics();

Expand Down
4 changes: 3 additions & 1 deletion Core/include/Acts/Propagator/EigenStepper.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ void Acts::EigenStepper<E>::initialize(State& state,
state.pathAccumulated = 0;
state.nSteps = 0;
state.nStepTrials = 0;
state.stepSize = ConstrainedStep(state.options.maxStepSize);
state.stepSize = ConstrainedStep();
state.stepSize.setAccuracy(state.options.initialStepSize);
state.stepSize.setUser(state.options.maxStepSize);
state.previousStepSize = 0;
state.statistics = StepperStatistics();

Expand Down
6 changes: 5 additions & 1 deletion Core/include/Acts/Propagator/StepperOptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Acts/Definitions/Units.hpp"

#include <functional>
#include <limits>

namespace Acts {

Expand All @@ -35,8 +36,11 @@ struct StepperPlainOptions {
/// Cut-off value for the step size
double stepSizeCutOff = 0.;

/// Initial step size
double initialStepSize = 10 * Acts::UnitConstants::m;

/// Absolute maximum step size
double maxStepSize = 10 * Acts::UnitConstants::m;
double maxStepSize = std::numeric_limits<double>::max();

/// Maximum number of Runge-Kutta steps for the stepper step call
unsigned int maxRungeKuttaStepTrials = 10000;
Expand Down
4 changes: 3 additions & 1 deletion Core/src/Propagator/StraightLineStepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ void StraightLineStepper::initialize(State& state,
state.pathAccumulated = 0;
state.nSteps = 0;
state.nStepTrials = 0;
state.stepSize = ConstrainedStep(state.options.maxStepSize);
state.stepSize = ConstrainedStep();
state.stepSize.setAccuracy(state.options.initialStepSize);
state.stepSize.setUser(state.options.maxStepSize);
state.previousStepSize = 0;
state.statistics = StepperStatistics();

Expand Down
4 changes: 3 additions & 1 deletion Core/src/Propagator/SympyStepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ void SympyStepper::initialize(State& state, const BoundVector& boundParams,
state.pathAccumulated = 0;
state.nSteps = 0;
state.nStepTrials = 0;
state.stepSize = ConstrainedStep(state.options.maxStepSize);
state.stepSize = ConstrainedStep();
state.stepSize.setAccuracy(state.options.initialStepSize);
state.stepSize.setUser(state.options.maxStepSize);
state.previousStepSize = 0;
state.statistics = StepperStatistics();

Expand Down
1 change: 1 addition & 0 deletions Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) {

EigenStepper<>::Options esOptions(tgContext, mfContext);
esOptions.maxStepSize = stepSize;
esOptions.initialStepSize = 10_m;

// Build the stepper and the state
EigenStepper<> es(bField);
Expand Down
2 changes: 2 additions & 0 deletions Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <optional>
#include <string>

using namespace Acts::UnitLiterals;
using Acts::VectorHelpers::makeVector4;

namespace Acts::Test {
Expand Down Expand Up @@ -114,6 +115,7 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) {

StraightLineStepper::Options options(tgContext, mfContext);
options.maxStepSize = stepSize;
options.initialStepSize = 10_m;

// Build the stepper and the state
StraightLineStepper sls;
Expand Down
1 change: 1 addition & 0 deletions Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_test) {

SympyStepper::Options esOptions(tgContext, mfContext);
esOptions.maxStepSize = stepSize;
esOptions.initialStepSize = 10_m;

// Build the stepper and the state
SympyStepper es(bField);
Expand Down
Loading