diff --git a/Core/include/Acts/Navigation/DetectorNavigator.hpp b/Core/include/Acts/Navigation/DetectorNavigator.hpp index d397128a5a4..8ba5a1b4000 100644 --- a/Core/include/Acts/Navigation/DetectorNavigator.hpp +++ b/Core/include/Acts/Navigation/DetectorNavigator.hpp @@ -142,15 +142,15 @@ class DetectorNavigator { updateCandidateSurfaces(state, position); } - NavigationTarget estimateNextTarget(State& state, const Vector3& position, - const Vector3& direction) const { + NavigationTarget nextTarget(State& state, const Vector3& position, + const Vector3& direction) const { ACTS_VERBOSE(volInfo(state) << posInfo(state, position) << "Entering navigator::preStep."); if (inactive()) { ACTS_VERBOSE(volInfo(state) << posInfo(state, position) << "navigator inactive"); - return NavigationTarget::invalid(); + return NavigationTarget::None(); } fillNavigationState(position, direction, state); @@ -163,7 +163,7 @@ class DetectorNavigator { if (state.surfaceCandidateIndex == state.surfaceCandidates.size()) { ACTS_VERBOSE(volInfo(state) << posInfo(state, position) << "no surface candidates"); - return NavigationTarget::invalid(); + return NavigationTarget::None(); } // Screen output how much is left to try diff --git a/Core/include/Acts/Propagator/AtlasStepper.hpp b/Core/include/Acts/Propagator/AtlasStepper.hpp index cb78e828f17..4d6934601e9 100644 --- a/Core/include/Acts/Propagator/AtlasStepper.hpp +++ b/Core/include/Acts/Propagator/AtlasStepper.hpp @@ -28,12 +28,12 @@ #include "Acts/Utilities/Result.hpp" #include -#include -// This is based original stepper code from the ATLAS RungeKuttaPropagator namespace Acts { /// @brief the AtlasStepper implementation for the +/// +/// This is based original stepper code from the ATLAS RungeKuttaPropagator class AtlasStepper { public: using Jacobian = BoundMatrix; @@ -47,6 +47,10 @@ class AtlasStepper { }; struct Options : public StepperPlainOptions { + explicit Options(const GeometryContext& gctx, + const MagneticFieldContext& mctx) + : StepperPlainOptions(gctx, mctx) {} + void setPlainOptions(const StepperPlainOptions& options) { static_cast(*this) = options; } @@ -54,34 +58,25 @@ class AtlasStepper { /// @brief Nested State struct for the local caching struct State { - /// Default constructor - deleted - State() = delete; - /// Constructor /// /// @tparam Type of TrackParameters /// - /// @param [in] gctx The geometry context tof this call + /// @param [in] optionsIn The stepper options /// @param [in] fieldCacheIn The magnetic field cache for this call /// @param [in] pars Input parameters - /// @param [in] ssize the steps size limitation - /// @param [in] stolerance is the stepping tolerance template - State(const GeometryContext& gctx, - MagneticFieldProvider::Cache fieldCacheIn, const Parameters& pars, - double ssize = std::numeric_limits::max(), - double stolerance = s_onSurfaceTolerance) - : particleHypothesis(pars.particleHypothesis()), + State(const Options& optionsIn, MagneticFieldProvider::Cache fieldCacheIn, + const Parameters& pars) + : options(optionsIn), + particleHypothesis(pars.particleHypothesis()), field(0., 0., 0.), - stepSize(ssize), - tolerance(stolerance), - fieldCache(std::move(fieldCacheIn)), - geoContext(gctx) { + fieldCache(std::move(fieldCacheIn)) { // The rest of this constructor is copy&paste of AtlasStepper::update() - // this is a nasty but working solution for the stepper state without // functions - const auto pos = pars.position(gctx); + const auto pos = pars.position(options.geoContext); const auto Vp = pars.parameters(); double Sf = std::sin(Vp[eBoundPhi]); @@ -111,7 +106,7 @@ class AtlasStepper { covTransport = true; useJacobian = true; const auto transform = pars.referenceSurface().referenceFrame( - geoContext, pos, pars.direction()); + options.geoContext, pos, pars.direction()); pVector[8] = transform(0, eBoundLoc0); pVector[16] = transform(0, eBoundLoc1); @@ -240,6 +235,8 @@ class AtlasStepper { state_ready = true; } + Options options; + ParticleHypothesis particleHypothesis; // optimisation that init is not called twice @@ -289,16 +286,10 @@ class AtlasStepper { // Previous step size for overstep estimation double previousStepSize = 0.; - /// The tolerance for the stepping - double tolerance = s_onSurfaceTolerance; - /// It caches the current magnetic field cell and stays (and interpolates) /// within as long as this is valid. See step() code for details. MagneticFieldProvider::Cache fieldCache; - /// Cache the geometry context - std::reference_wrapper geoContext; - /// Debug output /// the string where debug messages are stored (optionally) bool debug = false; @@ -316,12 +307,11 @@ class AtlasStepper { explicit AtlasStepper(const Config& config) : m_bField(config.bField) {} - State makeState(std::reference_wrapper gctx, - std::reference_wrapper mctx, - const BoundTrackParameters& par, - double ssize = std::numeric_limits::max(), - double stolerance = s_onSurfaceTolerance) const { - return State{gctx, m_bField->makeCache(mctx), par, ssize, stolerance}; + State makeState(const Options& options, + const BoundTrackParameters& par) const { + State state{options, m_bField->makeCache(options.magFieldContext), par}; + state.stepSize = ConstrainedStep(options.maxStepSize); + return state; } /// @brief Resets the state @@ -336,10 +326,10 @@ class AtlasStepper { const BoundSquareMatrix& cov, const Surface& surface, const double stepSize = std::numeric_limits::max()) const { // Update the stepping state - update( - state, - transformBoundToFreeParameters(surface, state.geoContext, boundParams), - boundParams, cov, surface); + update(state, + transformBoundToFreeParameters(surface, state.options.geoContext, + boundParams), + boundParams, cov, surface); state.stepSize = ConstrainedStep(stepSize); state.pathAccumulated = 0.; @@ -418,15 +408,17 @@ class AtlasStepper { /// @param [in] navDir The navigation direction /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection + /// @param [in] stype The step size type to be set + /// @param [in] release Do we release the step size? /// @param [in] logger Logger instance to use IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - double surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance, ConstrainedStep::Type stype, bool release, const Logger& logger = getDummyLogger()) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, - surfaceTolerance, logger); + surfaceTolerance, stype, release, logger); } /// Update step size @@ -439,8 +431,10 @@ class AtlasStepper { /// @param release [in] boolean to trigger step size release template void updateStepSize(State& state, const object_intersection_t& oIntersection, - Direction /*direction*/, bool release = true) const { - detail::updateSingleStepSize(state, oIntersection, release); + Direction /*direction*/, ConstrainedStep::Type stype, + bool release) const { + double stepSize = oIntersection.pathLength(); + updateStepSize(state, stepSize, stype, release); } /// Update step size - explicitly with a double @@ -450,7 +444,7 @@ class AtlasStepper { /// @param [in] stype The step size type to be set /// @param release [in] Do we release the step size? void updateStepSize(State& state, double stepSize, - ConstrainedStep::Type stype, bool release = true) const { + ConstrainedStep::Type stype, bool release) const { state.previousStepSize = state.stepSize.value(); state.stepSize.update(stepSize, stype, release); } @@ -519,7 +513,7 @@ class AtlasStepper { // Fill the end parameters auto parameters = BoundTrackParameters::create( - surface.getSharedPtr(), state.geoContext, pos4, dir, qOverP, + surface.getSharedPtr(), state.options.geoContext, pos4, dir, qOverP, std::move(covOpt), state.particleHypothesis); if (!parameters.ok()) { return parameters.error(); @@ -626,7 +620,8 @@ class AtlasStepper { double Se = std::sin(boundParams[eBoundTheta]); double Ce = std::cos(boundParams[eBoundTheta]); - const auto transform = surface.referenceFrame(state.geoContext, pos, mom); + const auto transform = + surface.referenceFrame(state.options.geoContext, pos, mom); state.pVector[8] = transform(0, eBoundLoc0); state.pVector[16] = transform(0, eBoundLoc1); @@ -956,7 +951,8 @@ class AtlasStepper { P[45] *= p; P[46] *= p; - const auto fFrame = surface.referenceFrame(state.geoContext, gp, mom); + const auto fFrame = + surface.referenceFrame(state.options.geoContext, gp, mom); double Ax[3] = {fFrame(0, 0), fFrame(1, 0), fFrame(2, 0)}; double Ay[3] = {fFrame(0, 1), fFrame(1, 1), fFrame(2, 1)}; @@ -985,9 +981,9 @@ class AtlasStepper { if (surface.type() == Surface::Straw || surface.type() == Surface::Perigee) { // vector from position to center - double x = P[0] - surface.center(state.geoContext).x(); - double y = P[1] - surface.center(state.geoContext).y(); - double z = P[2] - surface.center(state.geoContext).z(); + double x = P[0] - surface.center(state.options.geoContext).x(); + double y = P[1] - surface.center(state.options.geoContext).y(); + double z = P[2] - surface.center(state.options.geoContext).z(); // this is the projection of the direction onto the local y axis double d = P[4] * Ay[0] + P[5] * Ay[1] + P[6] * Ay[2]; @@ -1085,7 +1081,7 @@ class AtlasStepper { // Jacobian production of transport and to_local if (surface.type() == Surface::Disc) { // the vector from the disc surface to the p - const auto& sfc = surface.center(state.geoContext); + const auto& sfc = surface.center(state.options.geoContext); double d[3] = {P[0] - sfc(0), P[1] - sfc(1), P[2] - sfc(2)}; // this needs the transformation to polar coordinates double RC = d[0] * Ax[0] + d[1] * Ax[1] + d[2] * Ax[2]; diff --git a/Core/include/Acts/Propagator/DirectNavigator.hpp b/Core/include/Acts/Propagator/DirectNavigator.hpp index 7f4f64f0239..46acae90411 100644 --- a/Core/include/Acts/Propagator/DirectNavigator.hpp +++ b/Core/include/Acts/Propagator/DirectNavigator.hpp @@ -81,6 +81,8 @@ class DirectNavigator { Direction direction = Direction::Forward; /// Index of the next surface to try + /// @note -1 means before the first surface in the sequence and size() + /// means after the last surface in the sequence int surfaceIndex = -1; /// Navigation state - external interface: the current surface @@ -105,8 +107,10 @@ class DirectNavigator { } bool endOfSurfaces() const { - return surfaceIndex < 0 || - surfaceIndex >= static_cast(options.surfaces.size()); + if (direction == Direction::Forward) { + return surfaceIndex >= static_cast(options.surfaces.size()); + } + return surfaceIndex < 0; } int remainingSurfaces() const { @@ -213,9 +217,9 @@ class DirectNavigator { state.navigationBreak = false; } - /// @brief Estimate the next target surface + /// @brief Get the next target surface /// - /// This function estimates the next target surface for the propagation. For + /// This function gets the next target surface for the propagation. For /// the direct navigator this is always the next surface in the sequence. /// /// @param state The navigation state @@ -223,13 +227,13 @@ class DirectNavigator { /// @param direction The current direction /// /// @return The next target surface - NavigationTarget estimateNextTarget(State& state, const Vector3& position, - const Vector3& direction) const { + NavigationTarget nextTarget(State& state, const Vector3& position, + const Vector3& direction) const { if (state.navigationBreak) { - return NavigationTarget::invalid(); + return NavigationTarget::None(); } - ACTS_VERBOSE("DirectNavigator::estimateNextTarget"); + ACTS_VERBOSE("DirectNavigator::nextTarget"); // Navigator target always resets the current surface state.currentSurface = nullptr; @@ -246,7 +250,7 @@ class DirectNavigator { } else { ACTS_VERBOSE("End of surfaces reached, navigation break."); state.navigationBreak = true; - return NavigationTarget::invalid(); + return NavigationTarget::None(); } // Establish & update the surface status diff --git a/Core/include/Acts/Propagator/EigenStepper.hpp b/Core/include/Acts/Propagator/EigenStepper.hpp index df4cd4ac35c..c76109c2922 100644 --- a/Core/include/Acts/Propagator/EigenStepper.hpp +++ b/Core/include/Acts/Propagator/EigenStepper.hpp @@ -12,7 +12,6 @@ #include "Acts/Utilities/detail/ReferenceWrapperAnyCompat.hpp" #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/Tolerance.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp" #include "Acts/Geometry/GeometryContext.hpp" @@ -28,7 +27,6 @@ #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Result.hpp" -#include #include #include @@ -61,6 +59,10 @@ class EigenStepper { }; struct Options : public StepperPlainOptions { + explicit Options(const GeometryContext& gctx, + const MagneticFieldContext& mctx) + : StepperPlainOptions(gctx, mctx) {} + void setPlainOptions(const StepperPlainOptions& options) { static_cast(*this) = options; } @@ -71,25 +73,19 @@ class EigenStepper { /// It contains the stepping information and is provided thread local /// by the propagator struct State { - State() = delete; - /// Constructor from the initial bound track parameters /// - /// @param [in] gctx is the context object for the geometry + /// @param [in] optionsIn is the options object for the stepper /// @param [in] fieldCacheIn is the cache object for the magnetic field /// @param [in] par The track parameters at start - /// @param [in] ssize is the maximum step size /// /// @note the covariance matrix is copied when needed - explicit State(const GeometryContext& gctx, - MagneticFieldProvider::Cache fieldCacheIn, - const BoundTrackParameters& par, - double ssize = 10 * Acts::UnitConstants::m) - : particleHypothesis(par.particleHypothesis()), - stepSize(ssize), - fieldCache(std::move(fieldCacheIn)), - geoContext(gctx) { - Vector3 position = par.position(gctx); + State(const Options& optionsIn, MagneticFieldProvider::Cache fieldCacheIn, + const BoundTrackParameters& par) + : options(optionsIn), + particleHypothesis(par.particleHypothesis()), + fieldCache(std::move(fieldCacheIn)) { + Vector3 position = par.position(options.geoContext); Vector3 direction = par.direction(); pars.template segment<3>(eFreePos0) = position; pars.template segment<3>(eFreeDir0) = direction; @@ -103,10 +99,13 @@ class EigenStepper { // set the covariance transport flag to true and copy covTransport = true; cov = BoundSquareMatrix(*par.covariance()); - jacToGlobal = surface.boundToFreeJacobian(gctx, position, direction); + jacToGlobal = surface.boundToFreeJacobian(options.geoContext, position, + direction); } } + Options options; + /// Internal free vector parameters FreeVector pars = FreeVector::Zero(); @@ -150,9 +149,6 @@ class EigenStepper { /// See step() code for details. MagneticFieldProvider::Cache fieldCache; - /// The geometry context - std::reference_wrapper geoContext; - /// Algorithmic extension extension_t extension; @@ -179,10 +175,8 @@ class EigenStepper { /// @param [in] config The configuration of the stepper explicit EigenStepper(const Config& config) : m_bField(config.bField) {} - State makeState(std::reference_wrapper gctx, - std::reference_wrapper mctx, - const BoundTrackParameters& par, - double ssize = 10 * Acts::UnitConstants::m) const; + State makeState(const Options& options, + const BoundTrackParameters& par) const; /// @brief Resets the state /// @@ -274,11 +268,11 @@ class EigenStepper { IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - double surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance, ConstrainedStep::Type stype, bool release, const Logger& logger = getDummyLogger()) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, - surfaceTolerance, logger); + surfaceTolerance, stype, release, logger); } /// Update step size @@ -293,8 +287,10 @@ class EigenStepper { /// @param release [in] boolean to trigger step size release template void updateStepSize(State& state, const object_intersection_t& oIntersection, - Direction /*direction*/, bool release = true) const { - detail::updateSingleStepSize(state, oIntersection, release); + Direction /*direction*/, ConstrainedStep::Type stype, + bool release) const { + double stepSize = oIntersection.pathLength(); + updateStepSize(state, stepSize, stype, release); } /// Update step size - explicitly with a double @@ -304,7 +300,7 @@ class EigenStepper { /// @param stype [in] The step size type to be set /// @param release [in] Do we release the step size? void updateStepSize(State& state, double stepSize, - ConstrainedStep::Type stype, bool release = true) const { + ConstrainedStep::Type stype, bool release) const { state.previousStepSize = state.stepSize.value(); state.stepSize.update(stepSize, stype, release); } diff --git a/Core/include/Acts/Propagator/EigenStepper.ipp b/Core/include/Acts/Propagator/EigenStepper.ipp index 4ee3a41b04a..fa1ed56e879 100644 --- a/Core/include/Acts/Propagator/EigenStepper.ipp +++ b/Core/include/Acts/Propagator/EigenStepper.ipp @@ -21,10 +21,10 @@ Acts::EigenStepper::EigenStepper( template auto Acts::EigenStepper::makeState( - std::reference_wrapper gctx, - std::reference_wrapper mctx, - const BoundTrackParameters& par, double ssize) const -> State { - return State{gctx, m_bField->makeCache(mctx), par, ssize}; + const Options& options, const BoundTrackParameters& par) const -> State { + State state{options, m_bField->makeCache(options.magFieldContext), par}; + state.stepSize = ConstrainedStep(options.maxStepSize); + return state; } template @@ -33,8 +33,8 @@ void Acts::EigenStepper::resetState(State& state, const BoundSquareMatrix& cov, const Surface& surface, const double stepSize) const { - FreeVector freeParams = - transformBoundToFreeParameters(surface, state.geoContext, boundParams); + FreeVector freeParams = transformBoundToFreeParameters( + surface, state.options.geoContext, boundParams); // Update the stepping state state.pars = freeParams; @@ -44,7 +44,7 @@ void Acts::EigenStepper::resetState(State& state, // Reinitialize the stepping jacobian state.jacToGlobal = surface.boundToFreeJacobian( - state.geoContext, freeParams.template segment<3>(eFreePos0), + state.options.geoContext, freeParams.template segment<3>(eFreePos0), freeParams.template segment<3>(eFreeDir0)); state.jacobian = BoundMatrix::Identity(); state.jacTransport = FreeMatrix::Identity(); @@ -57,10 +57,10 @@ auto Acts::EigenStepper::boundState( const FreeToBoundCorrection& freeToBoundCorrection) const -> Result { return detail::boundState( - state.geoContext, surface, state.cov, state.jacobian, state.jacTransport, - state.derivative, state.jacToGlobal, state.pars, state.particleHypothesis, - state.covTransport && transportCov, state.pathAccumulated, - freeToBoundCorrection); + state.options.geoContext, surface, state.cov, state.jacobian, + state.jacTransport, state.derivative, state.jacToGlobal, state.pars, + state.particleHypothesis, state.covTransport && transportCov, + state.pathAccumulated, freeToBoundCorrection); } template @@ -113,7 +113,7 @@ void Acts::EigenStepper::update(State& state, const FreeVector& freeParams, state.pars = freeParams; state.cov = covariance; state.jacToGlobal = surface.boundToFreeJacobian( - state.geoContext, freeParams.template segment<3>(eFreePos0), + state.options.geoContext, freeParams.template segment<3>(eFreePos0), freeParams.template segment<3>(eFreeDir0)); } @@ -139,10 +139,10 @@ template void Acts::EigenStepper::transportCovarianceToBound( State& state, const Surface& surface, const FreeToBoundCorrection& freeToBoundCorrection) const { - detail::transportCovarianceToBound(state.geoContext.get(), surface, state.cov, - state.jacobian, state.jacTransport, - state.derivative, state.jacToGlobal, - state.pars, freeToBoundCorrection); + detail::transportCovarianceToBound( + state.options.geoContext.get(), surface, state.cov, state.jacobian, + state.jacTransport, state.derivative, state.jacToGlobal, state.pars, + freeToBoundCorrection); } template diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp index a5236e571e3..c3656998b68 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -181,7 +180,11 @@ class MultiEigenStepperLoop : public EigenStepper { std::shared_ptr bField; }; - struct Options : public StepperPlainOptions { + struct Options : public SingleStepper::Options { + explicit Options(const GeometryContext& gctx, + const MagneticFieldContext& mctx) + : SingleStepper::Options(gctx, mctx) {} + void setPlainOptions(const StepperPlainOptions& options) { static_cast(*this) = options; } @@ -195,6 +198,8 @@ class MultiEigenStepperLoop : public EigenStepper { IntersectionStatus status; }; + Options options; + /// Particle hypothesis ParticleHypothesis particleHypothesis = ParticleHypothesis::pion(); @@ -205,12 +210,6 @@ class MultiEigenStepperLoop : public EigenStepper { double pathAccumulated = 0.; std::size_t steps = 0; - /// geoContext - std::reference_wrapper geoContext; - - /// MagneticFieldContext - std::reference_wrapper magContext; - /// Step-limit counter which limits the number of steps when one component /// reached a surface std::optional stepCounterAfterFirstComponentOnSurface; @@ -218,26 +217,19 @@ class MultiEigenStepperLoop : public EigenStepper { /// The stepper statistics StepperStatistics statistics; - /// No default constructor is provided - State() = delete; - /// Constructor from the initial bound track parameters /// - /// @param [in] gctx is the context object for the geometry - /// @param [in] mctx is the context object for the magnetic field + /// @param [in] optionsIn is the options object for the stepper /// @param [in] bfield the shared magnetic filed provider /// @param [in] multipars The track multi-component track-parameters at start /// @param [in] ssize is the maximum step size /// /// @note the covariance matrix is copied when needed - explicit State(const GeometryContext& gctx, - const MagneticFieldContext& mctx, - const std::shared_ptr& bfield, - const MultiComponentBoundTrackParameters& multipars, - double ssize = std::numeric_limits::max()) - : particleHypothesis(multipars.particleHypothesis()), - geoContext(gctx), - magContext(mctx) { + State(const Options& optionsIn, + const std::shared_ptr& bfield, + const MultiComponentBoundTrackParameters& multipars) + : options(optionsIn), + particleHypothesis(multipars.particleHypothesis()) { if (multipars.components().empty()) { throw std::invalid_argument( "Cannot construct MultiEigenStepperLoop::State with empty " @@ -249,7 +241,8 @@ class MultiEigenStepperLoop : public EigenStepper { for (auto i = 0ul; i < multipars.components().size(); ++i) { const auto& [weight, singlePars] = multipars[i]; components.push_back( - {SingleState(gctx, bfield->makeCache(mctx), singlePars, ssize), + {SingleState(options, bfield->makeCache(options.magFieldContext), + singlePars), weight, IntersectionStatus::onSurface}); } @@ -273,11 +266,9 @@ class MultiEigenStepperLoop : public EigenStepper { : EigenStepper(config), m_logger(std::move(logger)) {} /// Construct and initialize a state - State makeState(std::reference_wrapper gctx, - std::reference_wrapper mctx, - const MultiComponentBoundTrackParameters& par, - double ssize = std::numeric_limits::max()) const { - return State(gctx, mctx, SingleStepper::m_bField, par, ssize); + State makeState(const Options& options, + const MultiComponentBoundTrackParameters& par) const { + return State(options, SingleStepper::m_bField, par); } /// @brief Resets the state @@ -432,11 +423,11 @@ class MultiEigenStepperLoop : public EigenStepper { Result addComponent(State& state, const BoundTrackParameters& pars, double weight) const { - state.components.push_back( - {SingleState(state.geoContext, - SingleStepper::m_bField->makeCache(state.magContext), - pars), - weight, IntersectionStatus::onSurface}); + state.components.push_back({SingleState(state.options, + SingleStepper::m_bField->makeCache( + state.options.magFieldContext), + pars), + weight, IntersectionStatus::onSurface}); return ComponentProxy{state.components.back(), state}; } @@ -518,7 +509,7 @@ class MultiEigenStepperLoop : public EigenStepper { IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - double surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance, ConstrainedStep::Type stype, bool release, const Logger& logger = getDummyLogger()) const { using Status = IntersectionStatus; @@ -527,7 +518,7 @@ class MultiEigenStepperLoop : public EigenStepper { for (auto& component : state.components) { component.status = detail::updateSingleSurfaceStatus( *this, component.state, surface, index, navDir, boundaryTolerance, - surfaceTolerance, logger); + surfaceTolerance, stype, release, logger); ++counts[static_cast(component.status)]; } @@ -541,8 +532,8 @@ class MultiEigenStepperLoop : public EigenStepper { ACTS_VERBOSE("Component status wrt " << surface.geometryId() << " at {" - << surface.center(state.geoContext).transpose() << "}:\t" - << [&]() { + << surface.center(state.options.geoContext).transpose() + << "}:\t" << [&]() { std::stringstream ss; for (auto& component : state.components) { ss << component.status << "\t"; @@ -594,17 +585,19 @@ class MultiEigenStepperLoop : public EigenStepper { /// @param release [in] boolean to trigger step size release template void updateStepSize(State& state, const object_intersection_t& oIntersection, - Direction direction, bool release = true) const { + Direction direction, ConstrainedStep::Type stype, + bool release) const { const Surface& surface = *oIntersection.object(); for (auto& component : state.components) { auto intersection = surface.intersect( - component.state.geoContext, SingleStepper::position(component.state), + component.state.options.geoContext, + SingleStepper::position(component.state), direction * SingleStepper::direction(component.state), BoundaryTolerance::None())[oIntersection.index()]; SingleStepper::updateStepSize(component.state, intersection, direction, - release); + stype, release); } } @@ -615,7 +608,7 @@ class MultiEigenStepperLoop : public EigenStepper { /// @param stype [in] The step size type to be set /// @param release [in] Do we release the step size? void updateStepSize(State& state, double stepSize, - ConstrainedStep::Type stype, bool release = true) const { + ConstrainedStep::Type stype, bool release) const { for (auto& component : state.components) { SingleStepper::updateStepSize(component.state, stepSize, stype, release); } diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp index 3eac67c27b3..a09e35b9a18 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp @@ -34,7 +34,7 @@ auto MultiEigenStepperLoop::boundState( // onSurface. cmpState.pars.template segment<3>(eFreePos0) = surface - .intersect(state.geoContext, + .intersect(state.options.geoContext, cmpState.pars.template segment<3>(eFreePos0), cmpState.pars.template segment<3>(eFreeDir0), BoundaryTolerance::Infinite()) @@ -78,7 +78,7 @@ auto MultiEigenStepperLoop::curvilinearState( state.components[i].state, transportCov); cmps.emplace_back(state.components[i].weight, - cp.fourPosition(state.geoContext), cp.direction(), + cp.fourPosition(state.options.geoContext), cp.direction(), cp.qOverP(), cp.covariance().value_or(BoundSquareMatrix::Zero())); accumulatedPathLength += state.components[i].weight * pl; diff --git a/Core/include/Acts/Propagator/NavigationTarget.hpp b/Core/include/Acts/Propagator/NavigationTarget.hpp index 71e9e876c22..b664ce65953 100644 --- a/Core/include/Acts/Propagator/NavigationTarget.hpp +++ b/Core/include/Acts/Propagator/NavigationTarget.hpp @@ -16,12 +16,19 @@ namespace Acts { class Surface; +/// @brief The navigation target +/// +/// This struct represents a navigation target which is communicated from the +/// navigator to the stepper through the propagator. +/// +/// @note This incorporates `std::optional` semantics as the next target might +/// not exist. struct NavigationTarget { const Surface* surface = nullptr; std::uint8_t surfaceIntersectionIndex = 0; BoundaryTolerance boundaryTolerance = BoundaryTolerance::None(); - static NavigationTarget invalid() { return NavigationTarget(); } + static NavigationTarget None() { return NavigationTarget(); } NavigationTarget(const Surface& surface_, std::uint8_t surfaceIntersectionIndex_, @@ -30,7 +37,7 @@ struct NavigationTarget { surfaceIntersectionIndex(surfaceIntersectionIndex_), boundaryTolerance(std::move(boundaryTolerance_)) {} - bool isValid() const { return surface != nullptr; } + bool isNone() const { return surface != nullptr; } private: NavigationTarget() = default; diff --git a/Core/include/Acts/Propagator/Navigator.hpp b/Core/include/Acts/Propagator/Navigator.hpp index fe1b40219cc..c1cca9a0220 100644 --- a/Core/include/Acts/Propagator/Navigator.hpp +++ b/Core/include/Acts/Propagator/Navigator.hpp @@ -22,6 +22,7 @@ #include "Acts/Utilities/StringHelpers.hpp" #include +#include #include #include @@ -91,10 +92,10 @@ class Navigator { /// The navigation stage enum struct Stage : int { + initial = 0, surfaceTarget = 1, layerTarget = 2, boundaryTarget = 3, - noTarget = 4, }; /// The navigator configuration @@ -150,36 +151,28 @@ class Navigator { /// the vector of navigation surfaces to work through NavigationSurfaces navSurfaces = {}; /// the current surface index of the navigation state - int navSurfaceIndex = -1; + std::optional navSurfaceIndex; // Navigation on layer level /// the vector of navigation layers to work through NavigationLayers navLayers = {}; /// the current layer index of the navigation state - int navLayerIndex = -1; + std::optional navLayerIndex; // Navigation on volume level /// the vector of boundary surfaces to work through NavigationBoundaries navBoundaries = {}; /// the current boundary index of the navigation state - int navBoundaryIndex = -1; + std::optional navBoundaryIndex; SurfaceIntersection& navSurface() { - return navSurfaces.at(navSurfaceIndex); + return navSurfaces.at(navSurfaceIndex.value()); } - LayerIntersection& navLayer() { return navLayers.at(navLayerIndex); } - BoundaryIntersection& navBoundary() { - return navBoundaries.at(navBoundaryIndex); - } - - bool endOfSurfaces() const { - return navSurfaceIndex >= static_cast(navSurfaces.size()); + LayerIntersection& navLayer() { + return navLayers.at(navLayerIndex.value()); } - bool endOfLayers() const { - return navLayerIndex >= static_cast(navLayers.size()); - } - bool endOfBoundaries() const { - return navBoundaryIndex >= static_cast(navBoundaries.size()); + BoundaryIntersection& navBoundary() { + return navBoundaries.at(navBoundaryIndex.value()); } const TrackingVolume* startVolume = nullptr; @@ -191,24 +184,29 @@ class Navigator { const Surface* targetSurface = nullptr; bool navigationBreak = false; - Stage navigationStage = Stage::noTarget; + Stage navigationStage = Stage::initial; NavigatorStatistics statistics; - void reset() { + void resetAfterVolumeSwitch() { navSurfaces.clear(); - navSurfaceIndex = -1; + navSurfaceIndex.reset(); navLayers.clear(); - navLayerIndex = -1; + navLayerIndex.reset(); navBoundaries.clear(); - navBoundaryIndex = -1; + navBoundaryIndex.reset(); - currentVolume = nullptr; currentLayer = nullptr; + } + + void reset() { + resetAfterVolumeSwitch(); + + currentVolume = nullptr; currentSurface = nullptr; navigationBreak = false; - navigationStage = Stage::noTarget; + navigationStage = Stage::initial; } }; @@ -309,8 +307,8 @@ class Navigator { state.startLayer = state.startVolume->associatedLayer( state.options.geoContext, position); } else { - ACTS_VERBOSE(volInfo(state) - << "No start volume resolved. Nothing left to do."); + ACTS_ERROR(volInfo(state) + << "No start volume resolved. Nothing left to do."); state.navigationBreak = true; } } @@ -341,41 +339,43 @@ class Navigator { } } - /// @brief Estimate the next target surface + /// @brief Get the next target surface /// - /// This function estimates the next target surface for the propagation. + /// This function gets the next target surface for the propagation. /// /// @param state The navigation state /// @param position The current position /// @param direction The current direction /// /// @return The next target surface - NavigationTarget estimateNextTarget(State& state, const Vector3& position, - const Vector3& direction) const { + NavigationTarget nextTarget(State& state, const Vector3& position, + const Vector3& direction) const { if (inactive(state)) { - return NavigationTarget::invalid(); + return NavigationTarget::None(); } - ACTS_VERBOSE(volInfo(state) << "Entering Navigator::estimateNextTarget."); + ACTS_VERBOSE(volInfo(state) << "Entering Navigator::nextTarget."); // Reset the current surface state.currentSurface = nullptr; - auto tryEstimateNextTarget = [&]() -> NavigationTarget { + auto tryGetNextTarget = [&]() -> NavigationTarget { // Try targeting the surfaces - then layers - then boundaries - if (state.navigationStage == Stage::noTarget) { + if (state.navigationStage == Stage::initial) { ACTS_VERBOSE(volInfo(state) << "Target surfaces."); state.navigationStage = Stage::surfaceTarget; } if (state.navigationStage == Stage::surfaceTarget) { - if (state.navSurfaceIndex == -1) { + if (!state.navSurfaceIndex.has_value()) { // First time, resolve the surfaces resolveSurfaces(state, position, direction); + state.navSurfaceIndex = 0; + } else { + ++state.navSurfaceIndex.value(); } - ++state.navSurfaceIndex; - if (!state.endOfSurfaces()) { + if (state.navSurfaceIndex.value() < state.navSurfaces.size()) { ACTS_VERBOSE(volInfo(state) << "Target set to next surface."); return NavigationTarget(*state.navSurface().object(), state.navSurface().index(), @@ -388,12 +388,14 @@ class Navigator { } if (state.navigationStage == Stage::layerTarget) { - if (state.navLayerIndex == -1) { + if (!state.navLayerIndex.has_value()) { // First time, resolve the layers resolveLayers(state, position, direction); + state.navLayerIndex = 0; + } else { + ++state.navLayerIndex.value(); } - ++state.navLayerIndex; - if (!state.endOfLayers()) { + if (state.navLayerIndex.value() < state.navLayers.size()) { ACTS_VERBOSE(volInfo(state) << "Target set to next layer."); return NavigationTarget(*state.navLayer().first.object(), state.navLayer().first.index(), @@ -406,12 +408,14 @@ class Navigator { } if (state.navigationStage == Stage::boundaryTarget) { - if (state.navBoundaryIndex == -1) { + if (!state.navBoundaryIndex.has_value()) { // First time, resolve the boundaries resolveBoundaries(state, position, direction); + state.navBoundaryIndex = 0; + } else { + ++state.navBoundaryIndex.value(); } - ++state.navBoundaryIndex; - if (!state.endOfBoundaries()) { + if (state.navBoundaryIndex.value() < state.navBoundaries.size()) { ACTS_VERBOSE(volInfo(state) << "Target set to next boundary."); return NavigationTarget(*state.navBoundary().first.object(), state.navBoundary().first.index(), @@ -426,11 +430,11 @@ class Navigator { ACTS_VERBOSE(volInfo(state) << "Unknown state. No target found. Renavigate."); - return NavigationTarget::invalid(); + return NavigationTarget::None(); }; - NavigationTarget nextTarget = tryEstimateNextTarget(); - if (nextTarget.isValid()) { + NavigationTarget nextTarget = tryGetNextTarget(); + if (!nextTarget.isNone()) { return nextTarget; } @@ -445,7 +449,7 @@ class Navigator { if (state.currentVolume == nullptr) { ACTS_VERBOSE(volInfo(state) << "No volume found, stop navigation."); state.navigationBreak = true; - return NavigationTarget::invalid(); + return NavigationTarget::None(); } state.currentLayer = state.currentVolume->associatedLayer( @@ -454,8 +458,8 @@ class Navigator { ACTS_VERBOSE(volInfo(state) << "Resolved volume and layer."); // Rerun the targeting - nextTarget = tryEstimateNextTarget(); - if (nextTarget.isValid()) { + nextTarget = tryGetNextTarget(); + if (!nextTarget.isNone()) { return nextTarget; } @@ -463,7 +467,7 @@ class Navigator { volInfo(state) << "No targets found again, we got really lost! Stop navigation."); state.navigationBreak = true; - return NavigationTarget::invalid(); + return NavigationTarget::None(); } /// @brief Check if the current target is still valid @@ -480,7 +484,7 @@ class Navigator { (void)position; (void)direction; - return state.navigationStage != Stage::noTarget; + return state.navigationStage != Stage::initial; } /// @brief Handle the surface reached @@ -533,14 +537,7 @@ class Navigator { state.currentVolume = boundary->attachedVolume(state.options.geoContext, position, direction); - // partial reset - state.navSurfaces.clear(); - state.navSurfaceIndex = -1; - state.navLayers.clear(); - state.navLayerIndex = -1; - state.navBoundaries.clear(); - state.navBoundaryIndex = -1; - state.currentLayer = nullptr; + state.resetAfterVolumeSwitch(); if (state.currentVolume != nullptr) { ACTS_VERBOSE(volInfo(state) << "Volume updated."); diff --git a/Core/include/Acts/Propagator/Propagator.ipp b/Core/include/Acts/Propagator/Propagator.ipp index 132d57e761e..37440dd1b72 100644 --- a/Core/include/Acts/Propagator/Propagator.ipp +++ b/Core/include/Acts/Propagator/Propagator.ipp @@ -22,7 +22,7 @@ namespace Acts::detail { template concept propagator_stepper_compatible_with = requires(const Stepper& s, StateType& st, const N& n) { - { s.step(st, n) } -> std::same_as>; + { s.step(st, n) } -> std::same_as>; }; } // namespace Acts::detail @@ -50,22 +50,24 @@ auto Acts::Propagator::propagate(propagator_state_t& state) const auto getNextTarget = [&]() -> Result { for (unsigned int i = 0; i < state.options.maxTargetSkipping; ++i) { - NavigationTarget nextTarget = m_navigator.estimateNextTarget( + NavigationTarget nextTarget = m_navigator.nextTarget( state.navigation, state.position, state.direction); - if (!nextTarget.isValid()) { - return NavigationTarget::invalid(); + if (nextTarget.isNone()) { + return NavigationTarget::None(); } IntersectionStatus preStepSurfaceStatus = m_stepper.updateSurfaceStatus( state.stepping, *nextTarget.surface, nextTarget.surfaceIntersectionIndex, state.options.direction, nextTarget.boundaryTolerance, state.options.surfaceTolerance, - logger()); - if (preStepSurfaceStatus >= Acts::IntersectionStatus::reachable) { + ConstrainedStep::navigator, true, logger()); + if (preStepSurfaceStatus == IntersectionStatus::reachable || + preStepSurfaceStatus == IntersectionStatus::onSurface) { return nextTarget; } } - ACTS_ERROR("getNextTarget failed to find a valid target surface."); + ACTS_ERROR("getNextTarget failed to find a valid target surface after " + << state.options.maxTargetSkipping << " attempts."); return Result::failure( PropagatorError::NextTargetLimitReached); }; @@ -113,18 +115,18 @@ auto Acts::Propagator::propagate(propagator_state_t& state) const // Post-stepping: check target status, call actors, check abort conditions state.stage = PropagatorStage::postStep; - if (nextTarget.isValid()) { + if (!nextTarget.isNone()) { IntersectionStatus postStepSurfaceStatus = m_stepper.updateSurfaceStatus( state.stepping, *nextTarget.surface, nextTarget.surfaceIntersectionIndex, state.options.direction, nextTarget.boundaryTolerance, state.options.surfaceTolerance, - logger()); + ConstrainedStep::navigator, true, logger()); if (postStepSurfaceStatus == IntersectionStatus::onSurface) { m_navigator.handleSurfaceReached(state.navigation, state.position, state.direction, *nextTarget.surface); } if (postStepSurfaceStatus != IntersectionStatus::reachable) { - nextTarget = NavigationTarget::invalid(); + nextTarget = NavigationTarget::None(); } } @@ -144,14 +146,14 @@ auto Acts::Propagator::propagate(propagator_state_t& state) const // Pre-Stepping: target setting state.stage = PropagatorStage::preStep; - if (nextTarget.isValid() && + if (!nextTarget.isNone() && !m_navigator.checkTargetValid(state.navigation, state.position, state.direction)) { ACTS_VERBOSE("Target is not valid anymore."); - nextTarget = NavigationTarget::invalid(); + nextTarget = NavigationTarget::None(); } - if (!nextTarget.isValid()) { + if (nextTarget.isNone()) { // navigator step constraint is not valid anymore m_stepper.releaseStepSize(state.stepping, ConstrainedStep::navigator); @@ -161,7 +163,7 @@ auto Acts::Propagator::propagate(propagator_state_t& state) const } nextTarget = *nextTargetResult; } - } + } // end of stepping loop // check if we didn't terminate normally via aborters if (!terminatedNormally) { @@ -252,11 +254,8 @@ auto Acts::Propagator::makeState( actor_list_t_state_t; // Initialize the internal propagator state - StateType state{ - eOptions, - m_stepper.makeState(eOptions.geoContext, eOptions.magFieldContext, start, - eOptions.stepping.maxStepSize), - m_navigator.makeState(eOptions.navigation)}; + StateType state{eOptions, m_stepper.makeState(eOptions.stepping, start), + m_navigator.makeState(eOptions.navigation)}; static_assert( detail::propagator_stepper_compatible_with, @@ -294,11 +293,8 @@ auto Acts::Propagator::makeState( using StateType = actor_list_t_state_t; - StateType state{ - eOptions, - m_stepper.makeState(eOptions.geoContext, eOptions.magFieldContext, start, - eOptions.stepping.maxStepSize), - m_navigator.makeState(eOptions.navigation)}; + StateType state{eOptions, m_stepper.makeState(eOptions.stepping, start), + m_navigator.makeState(eOptions.navigation)}; static_assert( detail::propagator_stepper_compatible_with, diff --git a/Core/include/Acts/Propagator/PropagatorOptions.hpp b/Core/include/Acts/Propagator/PropagatorOptions.hpp index 0070600ee7b..7d7f606c20d 100644 --- a/Core/include/Acts/Propagator/PropagatorOptions.hpp +++ b/Core/include/Acts/Propagator/PropagatorOptions.hpp @@ -28,9 +28,15 @@ struct PurePropagatorPlainOptions { Direction direction = Direction::Forward; /// Maximum number of steps for one propagate call + /// + /// This ensures that the propagation does not hang in the stepping loop in + /// case of misconfiguration or bugs. unsigned int maxSteps = 1000; /// Maximum number of next target calls for one step + /// + /// This ensures that the propagation does not hang in the target resolution + /// loop in case of misconfiguration or bugs. unsigned int maxTargetSkipping = 100; /// Absolute maximum path length @@ -61,7 +67,10 @@ struct PropagatorPlainOptions : public detail::PurePropagatorPlainOptions { /// PropagatorPlainOptions with context PropagatorPlainOptions(const GeometryContext& gctx, const MagneticFieldContext& mctx) - : geoContext(gctx), magFieldContext(mctx), navigation(gctx) {} + : geoContext(gctx), + magFieldContext(mctx), + stepping(gctx, mctx), + navigation(gctx) {} /// The context object for the geometry std::reference_wrapper geoContext; @@ -91,12 +100,16 @@ struct PropagatorOptions : public detail::PurePropagatorPlainOptions { /// PropagatorOptions with context PropagatorOptions(const GeometryContext& gctx, const MagneticFieldContext& mctx) - : geoContext(gctx), magFieldContext(mctx), navigation(gctx) {} + : geoContext(gctx), + magFieldContext(mctx), + stepping(gctx, mctx), + navigation(gctx) {} /// PropagatorOptions with context and plain options PropagatorOptions(const PropagatorPlainOptions& pOptions) : geoContext(pOptions.geoContext), magFieldContext(pOptions.magFieldContext), + stepping(pOptions.geoContext, pOptions.magFieldContext), navigation(pOptions.geoContext) { setPlainOptions(pOptions); } diff --git a/Core/include/Acts/Propagator/StepperConcept.hpp b/Core/include/Acts/Propagator/StepperConcept.hpp index fb4ea187bcd..d618ab11b78 100644 --- a/Core/include/Acts/Propagator/StepperConcept.hpp +++ b/Core/include/Acts/Propagator/StepperConcept.hpp @@ -54,8 +54,9 @@ concept CommonStepper = requires { }; requires requires(const Surface& sf, std::uint8_t ui, Direction d, - const BoundaryTolerance& bt, double sc, const Logger& l) { - { s.updateSurfaceStatus(t, sf, ui, d, bt, sc, l) }; + const BoundaryTolerance& bt, double sc, + ConstrainedStep::Type st, bool b, const Logger& l) { + { s.updateSurfaceStatus(t, sf, ui, d, bt, sc, st, b, l) }; }; requires requires(const ConstrainedStep::Type st) { diff --git a/Core/include/Acts/Propagator/StepperOptions.hpp b/Core/include/Acts/Propagator/StepperOptions.hpp index 8d81d6c3a2b..a0109186725 100644 --- a/Core/include/Acts/Propagator/StepperOptions.hpp +++ b/Core/include/Acts/Propagator/StepperOptions.hpp @@ -10,11 +10,25 @@ #include "Acts/Definitions/Units.hpp" -#include +#include namespace Acts { +class GeometryContext; +class MagneticFieldContext; + struct StepperPlainOptions { + /// StepperPlainOptions with context + explicit StepperPlainOptions(const GeometryContext& gctx, + const MagneticFieldContext& mctx) + : geoContext(gctx), magFieldContext(mctx) {} + + /// Context object for the geometry + std::reference_wrapper geoContext; + + /// Context object for the magnetic field + std::reference_wrapper magFieldContext; + /// Tolerance for the error of the integration double stepTolerance = 1e-4; diff --git a/Core/include/Acts/Propagator/StraightLineStepper.hpp b/Core/include/Acts/Propagator/StraightLineStepper.hpp index b43b58fbe50..4dd1e9cbb1a 100644 --- a/Core/include/Acts/Propagator/StraightLineStepper.hpp +++ b/Core/include/Acts/Propagator/StraightLineStepper.hpp @@ -13,12 +13,9 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Direction.hpp" -#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp" -#include "Acts/Geometry/GeometryContext.hpp" -#include "Acts/MagneticField/MagneticFieldContext.hpp" #include "Acts/MagneticField/NullBField.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/PropagatorTraits.hpp" @@ -33,7 +30,6 @@ #include "Acts/Utilities/Result.hpp" #include -#include #include #include #include @@ -57,6 +53,10 @@ class StraightLineStepper { struct Config {}; struct Options : public StepperPlainOptions { + explicit Options(const GeometryContext& gctx, + const MagneticFieldContext& mctx) + : StepperPlainOptions(gctx, mctx) {} + void setPlainOptions(const StepperPlainOptions& options) { static_cast(*this) = options; } @@ -65,26 +65,15 @@ class StraightLineStepper { /// State for track parameter propagation /// struct State { - State() = delete; - /// Constructor from the initial bound track parameters /// - /// @param [in] gctx is the context object for the geometry + /// @param [in] optionsIn The stepper options /// @param [in] par The track parameters at start - /// @param [in] ssize is the maximum step size - /// @param [in] stolerance is the stepping tolerance /// /// @note the covariance matrix is copied when needed - explicit State(const GeometryContext& gctx, - const MagneticFieldContext& /*mctx*/, - const BoundTrackParameters& par, - double ssize = std::numeric_limits::max(), - double stolerance = s_onSurfaceTolerance) - : particleHypothesis(par.particleHypothesis()), - stepSize(ssize), - tolerance(stolerance), - geoContext(gctx) { - Vector3 position = par.position(gctx); + State(const Options& optionsIn, const BoundTrackParameters& par) + : options(optionsIn), particleHypothesis(par.particleHypothesis()) { + Vector3 position = par.position(options.geoContext); Vector3 direction = par.direction(); pars.template segment<3>(eFreePos0) = position; pars.template segment<3>(eFreeDir0) = direction; @@ -96,10 +85,13 @@ class StraightLineStepper { // set the covariance transport flag to true and copy covTransport = true; cov = BoundSquareMatrix(*par.covariance()); - jacToGlobal = surface.boundToFreeJacobian(gctx, position, direction); + jacToGlobal = surface.boundToFreeJacobian(options.geoContext, position, + direction); } } + Options options; + /// Jacobian from local to the global frame BoundToFreeMatrix jacToGlobal = BoundToFreeMatrix::Zero(); @@ -137,24 +129,17 @@ class StraightLineStepper { // Previous step size for overstep estimation (ignored for SL stepper) double previousStepSize = 0.; - /// The tolerance for the stepping - double tolerance = s_onSurfaceTolerance; - - // Cache the geometry context of this propagation - std::reference_wrapper geoContext; - /// Statistics of the stepper StepperStatistics statistics; }; StraightLineStepper() = default; - State makeState(std::reference_wrapper gctx, - std::reference_wrapper mctx, - const BoundTrackParameters& par, - double ssize = std::numeric_limits::max(), - double stolerance = s_onSurfaceTolerance) const { - return State{gctx, mctx, par, ssize, stolerance}; + State makeState(const Options& options, + const BoundTrackParameters& par) const { + State state{options, par}; + state.stepSize = ConstrainedStep(options.maxStepSize); + return state; } /// @brief Resets the state @@ -244,11 +229,11 @@ class StraightLineStepper { IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - double surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance, ConstrainedStep::Type stype, bool release, const Logger& logger = getDummyLogger()) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, - surfaceTolerance, logger); + surfaceTolerance, stype, release, logger); } /// Update step size @@ -261,9 +246,10 @@ class StraightLineStepper { /// @param release [in] boolean to trigger step size release template void updateStepSize(State& state, const object_intersection_t& oIntersection, - Direction /*direction*/, bool release = true) const { - detail::updateSingleStepSize(state, oIntersection, - release); + Direction /*direction*/, ConstrainedStep::Type stype, + bool release) const { + double stepSize = oIntersection.pathLength(); + updateStepSize(state, stepSize, stype, release); } /// Update step size - explicitly with a double @@ -273,8 +259,7 @@ class StraightLineStepper { /// @param stype [in] The step size type to be set /// @param release [in] Do we release the step size? void updateStepSize(State& state, double stepSize, - ConstrainedStep::Type stype = ConstrainedStep::navigator, - bool release = true) const { + ConstrainedStep::Type stype, bool release) const { state.previousStepSize = state.stepSize.value(); state.stepSize.update(stepSize, stype, release); } diff --git a/Core/include/Acts/Propagator/SympyStepper.hpp b/Core/include/Acts/Propagator/SympyStepper.hpp index 7d30c24b431..9cc2af705d8 100644 --- a/Core/include/Acts/Propagator/SympyStepper.hpp +++ b/Core/include/Acts/Propagator/SympyStepper.hpp @@ -13,11 +13,8 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Direction.hpp" -#include "Acts/Definitions/Tolerance.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp" -#include "Acts/Geometry/GeometryContext.hpp" -#include "Acts/MagneticField/MagneticFieldContext.hpp" #include "Acts/MagneticField/MagneticFieldProvider.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/PropagatorTraits.hpp" @@ -41,6 +38,10 @@ class SympyStepper { }; struct Options : public StepperPlainOptions { + explicit Options(const GeometryContext& gctx, + const MagneticFieldContext& mctx) + : StepperPlainOptions(gctx, mctx) {} + void setPlainOptions(const StepperPlainOptions& options) { static_cast(*this) = options; } @@ -51,8 +52,6 @@ class SympyStepper { /// It contains the stepping information and is provided thread local /// by the propagator struct State { - State() = delete; - /// Constructor from the initial bound track parameters /// /// @param [in] gctx is the context object for the geometry @@ -61,15 +60,12 @@ class SympyStepper { /// @param [in] ssize is the maximum step size /// /// @note the covariance matrix is copied when needed - explicit State(const GeometryContext& gctx, - MagneticFieldProvider::Cache fieldCacheIn, - const BoundTrackParameters& par, - double ssize = std::numeric_limits::max()) - : particleHypothesis(par.particleHypothesis()), - stepSize(ssize), - fieldCache(std::move(fieldCacheIn)), - geoContext(gctx) { - Vector3 position = par.position(gctx); + State(const Options& optionsIn, MagneticFieldProvider::Cache fieldCacheIn, + const BoundTrackParameters& par) + : options(optionsIn), + particleHypothesis(par.particleHypothesis()), + fieldCache(std::move(fieldCacheIn)) { + Vector3 position = par.position(options.geoContext); Vector3 direction = par.direction(); pars.template segment<3>(eFreePos0) = position; pars.template segment<3>(eFreeDir0) = direction; @@ -83,10 +79,13 @@ class SympyStepper { // set the covariance transport flag to true and copy covTransport = true; cov = BoundSquareMatrix(*par.covariance()); - jacToGlobal = surface.boundToFreeJacobian(gctx, position, direction); + jacToGlobal = surface.boundToFreeJacobian(options.geoContext, position, + direction); } } + Options options; + /// Internal free vector parameters FreeVector pars = FreeVector::Zero(); @@ -130,9 +129,6 @@ class SympyStepper { /// See step() code for details. MagneticFieldProvider::Cache fieldCache; - /// The geometry context - std::reference_wrapper geoContext; - /// Statistics of the stepper StepperStatistics statistics; }; @@ -145,10 +141,8 @@ class SympyStepper { /// @param config The configuration of the stepper explicit SympyStepper(const Config& config); - State makeState(std::reference_wrapper gctx, - std::reference_wrapper mctx, - const BoundTrackParameters& par, - double ssize = std::numeric_limits::max()) const; + State makeState(const Options& options, + const BoundTrackParameters& par) const; /// @brief Resets the state /// @@ -240,11 +234,11 @@ class SympyStepper { IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, - double surfaceTolerance = s_onSurfaceTolerance, + double surfaceTolerance, ConstrainedStep::Type stype, bool release, const Logger& logger = getDummyLogger()) const { return detail::updateSingleSurfaceStatus( *this, state, surface, index, navDir, boundaryTolerance, - surfaceTolerance, logger); + surfaceTolerance, stype, release, logger); } /// Update step size @@ -259,8 +253,10 @@ class SympyStepper { /// @param release [in] boolean to trigger step size release template void updateStepSize(State& state, const object_intersection_t& oIntersection, - Direction /*direction*/, bool release = true) const { - detail::updateSingleStepSize(state, oIntersection, release); + Direction /*direction*/, ConstrainedStep::Type stype, + bool release) const { + double stepSize = oIntersection.pathLength(); + updateStepSize(state, stepSize, stype, release); } /// Update step size - explicitly with a double @@ -270,7 +266,7 @@ class SympyStepper { /// @param stype [in] The step size type to be set /// @param release [in] Do we release the step size? void updateStepSize(State& state, double stepSize, - ConstrainedStep::Type stype, bool release = true) const { + ConstrainedStep::Type stype, bool release) const { state.previousStepSize = state.stepSize.value(); state.stepSize.update(stepSize, stype, release); } diff --git a/Core/include/Acts/Propagator/TryAllNavigator.hpp b/Core/include/Acts/Propagator/TryAllNavigator.hpp index 7cde3eda2b2..84686bcee99 100644 --- a/Core/include/Acts/Propagator/TryAllNavigator.hpp +++ b/Core/include/Acts/Propagator/TryAllNavigator.hpp @@ -294,10 +294,10 @@ class TryAllNavigator : public TryAllNavigatorBase { reinitializeCandidates(state); } - /// @brief Estimate the next target surface + /// @brief Get the next target surface /// - /// This method estimates the next target surface based on the current - /// position and direction. It returns an invalid target if no target can be + /// This method gets the next target surface based on the current + /// position and direction. It returns a none target if no target can be /// found. /// /// @param state The navigation state @@ -305,14 +305,14 @@ class TryAllNavigator : public TryAllNavigatorBase { /// @param direction The current direction /// /// @return The next target surface - NavigationTarget estimateNextTarget(State& state, const Vector3& position, - const Vector3& direction) const { + NavigationTarget nextTarget(State& state, const Vector3& position, + const Vector3& direction) const { // Check if the navigator is inactive if (state.navigationBreak) { - return NavigationTarget::invalid(); + return NavigationTarget::None(); } - ACTS_VERBOSE(volInfo(state) << "estimateNextTarget"); + ACTS_VERBOSE(volInfo(state) << "nextTarget"); // Navigator preStep always resets the current surface state.currentSurface = nullptr; @@ -370,7 +370,7 @@ class TryAllNavigator : public TryAllNavigatorBase { ACTS_VERBOSE(volInfo(state) << "found " << intersectionCandidates.size() << " intersections"); - NavigationTarget nextTarget = NavigationTarget::invalid(); + NavigationTarget nextTarget = NavigationTarget::None(); state.currentCandidates.clear(); for (const auto& candidate : intersectionCandidates) { @@ -395,7 +395,7 @@ class TryAllNavigator : public TryAllNavigatorBase { state.currentCandidates = std::move(intersectionCandidates); - if (!nextTarget.isValid()) { + if (nextTarget.isNone()) { ACTS_VERBOSE(volInfo(state) << "no target found"); } else { ACTS_VERBOSE(volInfo(state) @@ -619,9 +619,9 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { state.lastPosition.reset(); } - /// @brief Estimate the next target surface + /// @brief Get the next target surface /// - /// This method estimates the next target surface based on the current + /// This method gets the next target surface based on the current /// position and direction. It returns an invalid target if no target can be /// found. /// @@ -630,15 +630,15 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { /// @param direction The current direction /// /// @return The next target surface - NavigationTarget estimateNextTarget(State& state, const Vector3& position, - const Vector3& direction) const { + NavigationTarget nextTarget(State& state, const Vector3& position, + const Vector3& direction) const { (void)direction; if (state.navigationBreak) { - return NavigationTarget::invalid(); + return NavigationTarget::None(); } - ACTS_VERBOSE(volInfo(state) << "estimateNextTarget"); + ACTS_VERBOSE(volInfo(state) << "nextTarget"); state.currentSurface = nullptr; @@ -648,7 +648,7 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { volInfo(state) << "Initial position, nothing to do, blindly stepping forward."); state.lastPosition = position; - return NavigationTarget::invalid(); + return NavigationTarget::None(); } if (state.endOfCandidates()) { @@ -706,7 +706,7 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { ACTS_VERBOSE(volInfo(state) << "No target found, blindly stepping forward."); state.lastPosition = position; - return NavigationTarget::invalid(); + return NavigationTarget::None(); } ACTS_VERBOSE(volInfo(state) << "handle active candidates"); diff --git a/Core/include/Acts/Propagator/VoidNavigator.hpp b/Core/include/Acts/Propagator/VoidNavigator.hpp index cd4df52bc31..d91b75450ec 100644 --- a/Core/include/Acts/Propagator/VoidNavigator.hpp +++ b/Core/include/Acts/Propagator/VoidNavigator.hpp @@ -68,10 +68,9 @@ class VoidNavigator { return; } - NavigationTarget estimateNextTarget(State& /*state*/, - const Vector3& /*position*/, - const Vector3& /*direction*/) const { - return NavigationTarget::invalid(); + NavigationTarget nextTarget(State& /*state*/, const Vector3& /*position*/, + const Vector3& /*direction*/) const { + return NavigationTarget::None(); } bool checkTargetValid(const State& /*state*/, const Vector3& /*position*/, diff --git a/Core/include/Acts/Propagator/detail/LoopStepperUtils.hpp b/Core/include/Acts/Propagator/detail/LoopStepperUtils.hpp index 199bc5d0113..26ddb590a8f 100644 --- a/Core/include/Acts/Propagator/detail/LoopStepperUtils.hpp +++ b/Core/include/Acts/Propagator/detail/LoopStepperUtils.hpp @@ -126,11 +126,11 @@ struct LoopComponentProxy Result boundState( const Surface& surface, bool transportCov, const FreeToBoundCorrection& freeToBoundCorrection) { - return detail::boundState(all_state.geoContext, surface, cov(), jacobian(), - jacTransport(), derivative(), jacToGlobal(), - pars(), all_state.particleHypothesis, - all_state.covTransport && transportCov, - cmp.state.pathAccumulated, freeToBoundCorrection); + return detail::boundState( + all_state.options.geoContext, surface, cov(), jacobian(), + jacTransport(), derivative(), jacToGlobal(), pars(), + all_state.particleHypothesis, all_state.covTransport && transportCov, + cmp.state.pathAccumulated, freeToBoundCorrection); } void update(const FreeVector& freeParams, const BoundVector& boundParams, diff --git a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp index b0dbf5d7fe5..aac9c74a6ab 100644 --- a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp +++ b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp @@ -8,7 +8,6 @@ #pragma once -#include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Direction.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" @@ -35,20 +34,19 @@ Acts::IntersectionStatus updateSingleSurfaceStatus( const stepper_t& stepper, typename stepper_t::State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, double surfaceTolerance, - const Logger& logger) { + ConstrainedStep::Type stype, bool release, const Logger& logger) { ACTS_VERBOSE("Update single surface status for surface: " << surface.geometryId() << " index " << static_cast(index)); auto sIntersection = - surface.intersect(state.geoContext, stepper.position(state), + surface.intersect(state.options.geoContext, stepper.position(state), navDir * stepper.direction(state), boundaryTolerance, surfaceTolerance)[index]; // The intersection is on surface already if (sIntersection.status() == IntersectionStatus::onSurface) { ACTS_VERBOSE("Intersection: state is ON SURFACE"); - stepper.updateStepSize(state, sIntersection.pathLength(), - ConstrainedStep::navigator); + stepper.updateStepSize(state, sIntersection.pathLength(), stype, release); return IntersectionStatus::onSurface; } @@ -59,8 +57,7 @@ Acts::IntersectionStatus updateSingleSurfaceStatus( detail::checkPathLength(sIntersection.pathLength(), nearLimit, farLimit, logger)) { ACTS_VERBOSE("Surface is reachable"); - stepper.updateStepSize(state, sIntersection.pathLength(), - ConstrainedStep::navigator); + stepper.updateStepSize(state, sIntersection.pathLength(), stype, release); return IntersectionStatus::reachable; } @@ -68,20 +65,4 @@ Acts::IntersectionStatus updateSingleSurfaceStatus( return IntersectionStatus::unreachable; } -/// Update the Step size - single component -/// -/// It takes a (valid) object intersection from the compatibleX(...) -/// calls in the geometry and updates the step size -/// -/// @param state [in,out] The stepping state (thread-local cache) -/// @param oIntersection [in] The object that yielded this step size -/// @param release [in] A release flag -template -void updateSingleStepSize(typename stepper_t::State& state, - const object_intersection_t& oIntersection, - bool release = true) { - double stepSize = oIntersection.pathLength(); - state.stepSize.update(stepSize, ConstrainedStep::navigator, release); -} - } // namespace Acts::detail diff --git a/Core/include/Acts/Surfaces/BoundaryTolerance.hpp b/Core/include/Acts/Surfaces/BoundaryTolerance.hpp index 603b8a2abe9..b4d9d041054 100644 --- a/Core/include/Acts/Surfaces/BoundaryTolerance.hpp +++ b/Core/include/Acts/Surfaces/BoundaryTolerance.hpp @@ -10,11 +10,8 @@ #include "Acts/Definitions/Algebra.hpp" -#include -#include #include #include -#include namespace Acts { diff --git a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp index 3c5d602acdb..0f58e5fd4df 100644 --- a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp +++ b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp @@ -372,12 +372,13 @@ struct GsfActor { // Evaluate material slab auto slab = surface.surfaceMaterial()->materialSlab( - old_bound.position(state.stepping.geoContext), state.options.direction, - MaterialUpdateStage::FullUpdate); + old_bound.position(state.stepping.options.geoContext), + state.options.direction, MaterialUpdateStage::FullUpdate); const auto pathCorrection = surface.pathCorrection( - state.stepping.geoContext, - old_bound.position(state.stepping.geoContext), old_bound.direction()); + state.stepping.options.geoContext, + old_bound.position(state.stepping.options.geoContext), + old_bound.direction()); slab.scaleThickness(pathCorrection); const double pathXOverX0 = slab.thicknessInX0(); @@ -491,8 +492,8 @@ struct GsfActor { auto proxy = tmpStates.traj.getTrackState(idx); - cmp.pars() = - MultiTrajectoryHelpers::freeFiltered(state.options.geoContext, proxy); + cmp.pars() = MultiTrajectoryHelpers::freeFiltered( + state.stepping.options.geoContext, proxy); cmp.cov() = proxy.filteredCovariance(); cmp.weight() = tmpStates.weights.at(idx); } @@ -532,7 +533,8 @@ struct GsfActor { auto& cmp = *res; auto freeParams = cmp.pars(); cmp.jacToGlobal() = surface.boundToFreeJacobian( - state.geoContext, freeParams.template segment<3>(eFreePos0), + state.stepping.options.geoContext, + freeParams.template segment<3>(eFreePos0), freeParams.template segment<3>(eFreeDir0)); cmp.pathAccumulated() = state.stepping.pathAccumulated; cmp.jacobian() = BoundMatrix::Identity(); diff --git a/Core/src/Propagator/StraightLineStepper.cpp b/Core/src/Propagator/StraightLineStepper.cpp index e98f76ee81c..57e39faafb9 100644 --- a/Core/src/Propagator/StraightLineStepper.cpp +++ b/Core/src/Propagator/StraightLineStepper.cpp @@ -18,10 +18,10 @@ StraightLineStepper::boundState( State& state, const Surface& surface, bool transportCov, const FreeToBoundCorrection& freeToBoundCorrection) const { return detail::boundState( - state.geoContext, surface, state.cov, state.jacobian, state.jacTransport, - state.derivative, state.jacToGlobal, state.pars, state.particleHypothesis, - state.covTransport && transportCov, state.pathAccumulated, - freeToBoundCorrection); + state.options.geoContext, surface, state.cov, state.jacobian, + state.jacTransport, state.derivative, state.jacToGlobal, state.pars, + state.particleHypothesis, state.covTransport && transportCov, + state.pathAccumulated, freeToBoundCorrection); } std::tuple @@ -39,7 +39,7 @@ void StraightLineStepper::update(State& state, const FreeVector& freeParams, state.pars = freeParams; state.cov = covariance; state.jacToGlobal = surface.boundToFreeJacobian( - state.geoContext, freeParams.template segment<3>(eFreePos0), + state.options.geoContext, freeParams.template segment<3>(eFreePos0), freeParams.template segment<3>(eFreeDir0)); } @@ -62,8 +62,9 @@ void StraightLineStepper::transportCovarianceToBound( State& state, const Surface& surface, const FreeToBoundCorrection& freeToBoundCorrection) const { detail::transportCovarianceToBound( - state.geoContext, surface, state.cov, state.jacobian, state.jacTransport, - state.derivative, state.jacToGlobal, state.pars, freeToBoundCorrection); + state.options.geoContext, surface, state.cov, state.jacobian, + state.jacTransport, state.derivative, state.jacToGlobal, state.pars, + freeToBoundCorrection); } void StraightLineStepper::resetState(State& state, @@ -71,8 +72,8 @@ void StraightLineStepper::resetState(State& state, const BoundSquareMatrix& cov, const Surface& surface, const double stepSize) const { - FreeVector freeParams = - transformBoundToFreeParameters(surface, state.geoContext, boundParams); + FreeVector freeParams = transformBoundToFreeParameters( + surface, state.options.geoContext, boundParams); // Update the stepping state state.pars = freeParams; @@ -82,7 +83,7 @@ void StraightLineStepper::resetState(State& state, // Reinitialize the stepping jacobian state.jacToGlobal = surface.boundToFreeJacobian( - state.geoContext, freeParams.template segment<3>(eFreePos0), + state.options.geoContext, freeParams.template segment<3>(eFreePos0), freeParams.template segment<3>(eFreeDir0)); state.jacobian = BoundMatrix::Identity(); state.jacTransport = FreeMatrix::Identity(); diff --git a/Core/src/Propagator/SympyStepper.cpp b/Core/src/Propagator/SympyStepper.cpp index b209d395a42..96bb9066740 100644 --- a/Core/src/Propagator/SympyStepper.cpp +++ b/Core/src/Propagator/SympyStepper.cpp @@ -23,18 +23,18 @@ SympyStepper::SympyStepper(std::shared_ptr bField) SympyStepper::SympyStepper(const Config& config) : m_bField(config.bField) {} SympyStepper::State SympyStepper::makeState( - std::reference_wrapper gctx, - std::reference_wrapper mctx, - const BoundTrackParameters& par, double ssize) const { - return State{gctx, m_bField->makeCache(mctx), par, ssize}; + const Options& options, const BoundTrackParameters& par) const { + State state{options, m_bField->makeCache(options.magFieldContext), par}; + state.stepSize = ConstrainedStep(options.maxStepSize); + return state; } void SympyStepper::resetState(State& state, const BoundVector& boundParams, const BoundSquareMatrix& cov, const Surface& surface, const double stepSize) const { - FreeVector freeParams = - transformBoundToFreeParameters(surface, state.geoContext, boundParams); + FreeVector freeParams = transformBoundToFreeParameters( + surface, state.options.geoContext, boundParams); // Update the stepping state state.pars = freeParams; @@ -44,7 +44,7 @@ void SympyStepper::resetState(State& state, const BoundVector& boundParams, // Reinitialize the stepping jacobian state.jacToGlobal = surface.boundToFreeJacobian( - state.geoContext, freeParams.template segment<3>(eFreePos0), + state.options.geoContext, freeParams.template segment<3>(eFreePos0), freeParams.template segment<3>(eFreeDir0)); state.jacobian = BoundMatrix::Identity(); state.jacTransport = FreeMatrix::Identity(); @@ -56,10 +56,10 @@ SympyStepper::boundState( State& state, const Surface& surface, bool transportCov, const FreeToBoundCorrection& freeToBoundCorrection) const { return detail::sympy::boundState( - state.geoContext, surface, state.cov, state.jacobian, state.jacTransport, - state.derivative, state.jacToGlobal, state.pars, state.particleHypothesis, - state.covTransport && transportCov, state.pathAccumulated, - freeToBoundCorrection); + state.options.geoContext, surface, state.cov, state.jacobian, + state.jacTransport, state.derivative, state.jacToGlobal, state.pars, + state.particleHypothesis, state.covTransport && transportCov, + state.pathAccumulated, freeToBoundCorrection); } std::tuple @@ -77,7 +77,7 @@ void SympyStepper::update(State& state, const FreeVector& freeParams, state.pars = freeParams; state.cov = covariance; state.jacToGlobal = surface.boundToFreeJacobian( - state.geoContext, freeParams.template segment<3>(eFreePos0), + state.options.geoContext, freeParams.template segment<3>(eFreePos0), freeParams.template segment<3>(eFreeDir0)); } @@ -100,8 +100,9 @@ void SympyStepper::transportCovarianceToBound( State& state, const Surface& surface, const FreeToBoundCorrection& freeToBoundCorrection) const { detail::sympy::transportCovarianceToBound( - state.geoContext, surface, state.cov, state.jacobian, state.jacTransport, - state.derivative, state.jacToGlobal, state.pars, freeToBoundCorrection); + state.options.geoContext, surface, state.cov, state.jacobian, + state.jacTransport, state.derivative, state.jacToGlobal, state.pars, + freeToBoundCorrection); } Result SympyStepper::stepImpl( diff --git a/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp b/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp index bee570485b0..9a7a0b17215 100644 --- a/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp +++ b/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp @@ -10,17 +10,15 @@ #include "Acts/Material/ISurfaceMaterial.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" -#include "Acts/Propagator/Propagator.hpp" +#include "Acts/Propagator/PropagatorState.hpp" #include "Acts/Propagator/StandardAborters.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "ActsFatras/EventData/Hit.hpp" #include "ActsFatras/EventData/Particle.hpp" #include "ActsFatras/Kernel/SimulationResult.hpp" #include #include #include -#include namespace ActsFatras::detail { @@ -125,7 +123,7 @@ struct SimulationActor { result.particle.absoluteMomentum() / result.particle.mass(); stepper.updateStepSize(state.stepping, stepSize, - Acts::ConstrainedStep::user); + Acts::ConstrainedStep::user, true); } // arm the point-like interaction limits in the first step diff --git a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp index f459feb0f24..941423f6a74 100644 --- a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp +++ b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp @@ -10,10 +10,10 @@ #include #include "Acts/Definitions/ParticleData.hpp" -#include "Acts/EventData/TrackParameters.hpp" #include "Acts/MagneticField/ConstantBField.hpp" #include "Acts/Propagator/EigenStepper.hpp" #include "Acts/Propagator/Navigator.hpp" +#include "Acts/Propagator/Propagator.hpp" #include "Acts/Propagator/StraightLineStepper.hpp" #include "Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp" #include "Acts/Utilities/Logger.hpp" diff --git a/Tests/IntegrationTests/NavigatorConsistency.cpp b/Tests/IntegrationTests/NavigatorConsistency.cpp index b989fe4a464..627c87161e4 100644 --- a/Tests/IntegrationTests/NavigatorConsistency.cpp +++ b/Tests/IntegrationTests/NavigatorConsistency.cpp @@ -378,7 +378,7 @@ CurvilinearTrackParameters createStartParameters(double pT, double phi, BOOST_DATA_TEST_CASE(NavigatorStraightLineSelfConsistency, eventGen ^ bdata::xrange(nTestsSelfConsistency), pT, phi, theta, charge, index) { - ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("NavigatorTest", logLevel)) + ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("NavigatorTest", logLevel)); CurvilinearTrackParameters start = createStartParameters(pT, phi, theta, charge); @@ -394,7 +394,7 @@ BOOST_DATA_TEST_CASE(NavigatorStraightLineSelfConsistency, BOOST_DATA_TEST_CASE(NavigatorEigenSelfConsistency, eventGen ^ bdata::xrange(nTestsSelfConsistency), pT, phi, theta, charge, index) { - ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("NavigatorTest", logLevel)) + ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("NavigatorTest", logLevel)); CurvilinearTrackParameters start = createStartParameters(pT, phi, theta, charge); @@ -410,7 +410,7 @@ BOOST_DATA_TEST_CASE(NavigatorEigenSelfConsistency, BOOST_DATA_TEST_CASE(NavigatorRef1StraightLineConsistency, eventGen ^ bdata::xrange(nTestsRefConsistency), pT, phi, theta, charge, index) { - ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("NavigatorTest", logLevel)) + ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("NavigatorTest", logLevel)); CurvilinearTrackParameters start = createStartParameters(pT, phi, theta, charge); @@ -426,7 +426,7 @@ BOOST_DATA_TEST_CASE(NavigatorRef1StraightLineConsistency, BOOST_DATA_TEST_CASE(NavigatorRef1EigenConsistency, eventGen ^ bdata::xrange(nTestsRefConsistency), pT, phi, theta, charge, index) { - ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("NavigatorTest", logLevel)) + ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("NavigatorTest", logLevel)); CurvilinearTrackParameters start = createStartParameters(pT, phi, theta, charge); @@ -442,7 +442,7 @@ BOOST_DATA_TEST_CASE(NavigatorRef1EigenConsistency, BOOST_DATA_TEST_CASE(NavigatorRef2StraightLineConsistency, eventGen ^ bdata::xrange(nTestsRefConsistency), pT, phi, theta, charge, index) { - ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("NavigatorTest", logLevel)) + ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("NavigatorTest", logLevel)); CurvilinearTrackParameters start = createStartParameters(pT, phi, theta, charge); @@ -458,7 +458,7 @@ BOOST_DATA_TEST_CASE(NavigatorRef2StraightLineConsistency, BOOST_DATA_TEST_CASE(NavigatorRef2EigenConsistency, eventGen ^ bdata::xrange(nTestsRefConsistency), pT, phi, theta, charge, index) { - ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("NavigatorTest", logLevel)) + ACTS_LOCAL_LOGGER(Acts::getDefaultLogger("NavigatorTest", logLevel)); CurvilinearTrackParameters start = createStartParameters(pT, phi, theta, charge); diff --git a/Tests/IntegrationTests/PropagationTests.hpp b/Tests/IntegrationTests/PropagationTests.hpp index fc2e2cfcfe5..b7b40c66e0c 100644 --- a/Tests/IntegrationTests/PropagationTests.hpp +++ b/Tests/IntegrationTests/PropagationTests.hpp @@ -348,8 +348,7 @@ inline void runToSurfaceTest( /// Propagate the initial parameters along their trajectory for the given path /// length using two different propagators and verify consistent output. -template > +template inline void runForwardComparisonTest( const cmp_propagator_t& cmpPropagator, const ref_propagator_t& refPropagator, const Acts::GeometryContext& geoCtx, @@ -357,9 +356,9 @@ inline void runForwardComparisonTest( const Acts::CurvilinearTrackParameters& initialParams, double pathLength, double epsPos, double epsDir, double epsMom, double tolCov) { // propagate twice using the two different propagators - auto [cmpParams, cmpPath] = transportFreely( + auto [cmpParams, cmpPath] = transportFreely( cmpPropagator, geoCtx, magCtx, initialParams, pathLength); - auto [refParams, refPath] = transportFreely( + auto [refParams, refPath] = transportFreely( refPropagator, geoCtx, magCtx, initialParams, pathLength); // check parameter comparison checkParametersConsistency(cmpParams, refParams, geoCtx, epsPos, epsDir, @@ -375,8 +374,7 @@ inline void runForwardComparisonTest( /// to define a target plane. Propagate the initial parameters using two /// different propagators and verify consistent output. template > + typename surface_builder_t> inline void runToSurfaceComparisonTest( const cmp_propagator_t& cmpPropagator, const ref_propagator_t& refPropagator, const Acts::GeometryContext& geoCtx, @@ -385,9 +383,8 @@ inline void runToSurfaceComparisonTest( surface_builder_t&& buildTargetSurface, double epsPos, double epsDir, double epsMom, double tolCov) { // free propagation with the reference propagator for the given path length - auto [freeParams, freePathLength] = - transportFreely( - refPropagator, geoCtx, magCtx, initialParams, pathLength); + auto [freeParams, freePathLength] = transportFreely( + refPropagator, geoCtx, magCtx, initialParams, pathLength); CHECK_CLOSE_ABS(freePathLength, pathLength, epsPos); // build a target surface at the propagated position @@ -396,9 +393,9 @@ inline void runToSurfaceComparisonTest( // propagate twice to the surface using the two different propagators // increase path length limit to ensure the surface can be reached - auto [cmpParams, cmpPath] = transportToSurface( + auto [cmpParams, cmpPath] = transportToSurface( cmpPropagator, geoCtx, magCtx, initialParams, *surface, 1.5 * pathLength); - auto [refParams, refPath] = transportToSurface( + auto [refParams, refPath] = transportToSurface( refPropagator, geoCtx, magCtx, initialParams, *surface, 1.5 * pathLength); // check parameter comparison checkParametersConsistency(cmpParams, refParams, geoCtx, epsPos, epsDir, diff --git a/Tests/UnitTests/Core/Navigation/DetectorNavigatorTests.cpp b/Tests/UnitTests/Core/Navigation/DetectorNavigatorTests.cpp index c5788a62009..ee137886a93 100644 --- a/Tests/UnitTests/Core/Navigation/DetectorNavigatorTests.cpp +++ b/Tests/UnitTests/Core/Navigation/DetectorNavigatorTests.cpp @@ -121,9 +121,8 @@ BOOST_AUTO_TEST_CASE(DetectorNavigatorTestsInitialization) { stepper.direction(state.stepping), state.options.direction); - navigator.estimateNextTarget(state.navigation, - stepper.position(state.stepping), - stepper.direction(state.stepping)); + navigator.nextTarget(state.navigation, stepper.position(state.stepping), + stepper.direction(state.stepping)); auto preStepState = state.navigation; BOOST_CHECK_EQUAL(preStepState.currentSurface, nullptr); BOOST_CHECK_EQUAL(preStepState.currentPortal, nullptr); diff --git a/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp b/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp index 04a049520b5..dacff8b837d 100644 --- a/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp @@ -12,9 +12,9 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Common.hpp" #include "Acts/Definitions/Direction.hpp" +#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Definitions/Units.hpp" -#include "Acts/EventData/Charge.hpp" #include "Acts/EventData/GenericBoundTrackParameters.hpp" #include "Acts/EventData/GenericCurvilinearTrackParameters.hpp" #include "Acts/EventData/ParticleHypothesis.hpp" @@ -35,17 +35,14 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Tests/CommonHelpers/Assertions.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" -#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Result.hpp" #include #include -#include #include #include #include #include -#include #include #include @@ -83,7 +80,6 @@ static constexpr auto eps = 1024 * std::numeric_limits::epsilon(); // propagation settings static constexpr auto stepSize = 10_mm; -static constexpr auto tolerance = 10_um; static constexpr Direction navDir = Direction::Backward; static auto magneticField = std::make_shared(Vector3(0.1_T, -0.2_T, 2_T)); @@ -102,15 +98,16 @@ static const Covariance cov = Covariance::Identity(); static const GeometryContext geoCtx; static const MagneticFieldContext magCtx; +static const Stepper::Options options(geoCtx, magCtx); + BOOST_AUTO_TEST_SUITE(AtlasStepper) // test state construction from parameters w/o covariance BOOST_AUTO_TEST_CASE(ConstructState) { Stepper::State state( - geoCtx, magneticField->makeCache(magCtx), + options, magneticField->makeCache(magCtx), CurvilinearTrackParameters(pos4, unitDir, charge / absMom, std::nullopt, - particleHypothesis), - stepSize, tolerance); + particleHypothesis)); BOOST_CHECK(!state.covTransport); BOOST_CHECK_EQUAL(state.covariance, nullptr); @@ -125,16 +122,14 @@ BOOST_AUTO_TEST_CASE(ConstructState) { BOOST_CHECK_EQUAL(state.pathAccumulated, 0.); BOOST_CHECK_EQUAL(state.stepSize.value(), stepSize); BOOST_CHECK_EQUAL(state.previousStepSize, 0.); - BOOST_CHECK_EQUAL(state.tolerance, tolerance); } // test state construction from parameters w/ covariance BOOST_AUTO_TEST_CASE(ConstructStateWithCovariance) { Stepper::State state( - geoCtx, magneticField->makeCache(magCtx), + options, magneticField->makeCache(magCtx), CurvilinearTrackParameters(pos4, unitDir, charge / absMom, cov, - particleHypothesis), - stepSize, tolerance); + particleHypothesis)); BOOST_CHECK(state.covTransport); BOOST_CHECK_EQUAL(*state.covariance, cov); @@ -149,17 +144,15 @@ BOOST_AUTO_TEST_CASE(ConstructStateWithCovariance) { BOOST_CHECK_EQUAL(state.pathAccumulated, 0.); BOOST_CHECK_EQUAL(state.stepSize.value(), stepSize); BOOST_CHECK_EQUAL(state.previousStepSize, 0.); - BOOST_CHECK_EQUAL(state.tolerance, tolerance); } // test stepper getters for particle state BOOST_AUTO_TEST_CASE(Getters) { Stepper stepper(magneticField); Stepper::State state( - geoCtx, magneticField->makeCache(magCtx), + options, magneticField->makeCache(magCtx), CurvilinearTrackParameters(pos4, unitDir, charge / absMom, cov, - particleHypothesis), - stepSize, tolerance); + particleHypothesis)); CHECK_CLOSE_ABS(stepper.position(state), pos, eps); CHECK_CLOSE_ABS(stepper.time(state), time, eps); @@ -172,10 +165,9 @@ BOOST_AUTO_TEST_CASE(Getters) { BOOST_AUTO_TEST_CASE(UpdateFromBound) { Stepper stepper(magneticField); Stepper::State state( - geoCtx, magneticField->makeCache(magCtx), + options, magneticField->makeCache(magCtx), CurvilinearTrackParameters(pos4, unitDir, charge / absMom, cov, - particleHypothesis), - stepSize, tolerance); + particleHypothesis)); auto newPos4 = (pos4 + Vector4(1_mm, 2_mm, 3_mm, 20_ns)).eval(); auto newPos = newPos4.segment<3>(ePos0); @@ -216,10 +208,9 @@ BOOST_AUTO_TEST_CASE(UpdateFromBound) { BOOST_AUTO_TEST_CASE(UpdateFromComponents) { Stepper stepper(magneticField); Stepper::State state( - geoCtx, magneticField->makeCache(magCtx), + options, magneticField->makeCache(magCtx), CurvilinearTrackParameters(pos4, unitDir, charge / absMom, cov, - particleHypothesis), - stepSize, tolerance); + particleHypothesis)); auto newPos = (pos + Vector3(1_mm, 2_mm, 3_mm)).eval(); auto newTime = time + 20_ns; @@ -238,10 +229,9 @@ BOOST_AUTO_TEST_CASE(UpdateFromComponents) { BOOST_AUTO_TEST_CASE(BuildBound) { Stepper stepper(magneticField); Stepper::State state( - geoCtx, magneticField->makeCache(magCtx), + options, magneticField->makeCache(magCtx), CurvilinearTrackParameters(pos4, unitDir, charge / absMom, cov, - particleHypothesis), - stepSize, tolerance); + particleHypothesis)); // example surface at the current state position auto plane = CurvilinearSurface(pos, unitDir).planeSurface(); @@ -263,10 +253,9 @@ BOOST_AUTO_TEST_CASE(BuildBound) { BOOST_AUTO_TEST_CASE(BuildCurvilinear) { Stepper stepper(magneticField); Stepper::State state( - geoCtx, magneticField->makeCache(magCtx), + options, magneticField->makeCache(magCtx), CurvilinearTrackParameters(pos4, unitDir, charge / absMom, cov, - particleHypothesis), - stepSize, tolerance); + particleHypothesis)); auto&& [pars, jac, pathLength] = stepper.curvilinearState(state); // check parameters @@ -286,10 +275,9 @@ BOOST_AUTO_TEST_CASE(BuildCurvilinear) { BOOST_AUTO_TEST_CASE(Step) { Stepper stepper(magneticField); MockPropagatorState state( - Stepper::State(geoCtx, magneticField->makeCache(magCtx), + Stepper::State(options, magneticField->makeCache(magCtx), CurvilinearTrackParameters(pos4, unitDir, charge / absMom, - cov, particleHypothesis), - stepSize, tolerance)); + cov, particleHypothesis))); state.stepping.covTransport = false; // ensure step does not result in an error @@ -320,10 +308,9 @@ BOOST_AUTO_TEST_CASE(Step) { BOOST_AUTO_TEST_CASE(StepWithCovariance) { Stepper stepper(magneticField); MockPropagatorState state( - Stepper::State(geoCtx, magneticField->makeCache(magCtx), + Stepper::State(options, magneticField->makeCache(magCtx), CurvilinearTrackParameters(pos4, unitDir, charge / absMom, - cov, particleHypothesis), - stepSize, tolerance)); + cov, particleHypothesis))); state.stepping.covTransport = true; // ensure step does not result in an error @@ -357,10 +344,9 @@ BOOST_AUTO_TEST_CASE(StepWithCovariance) { BOOST_AUTO_TEST_CASE(Reset) { Stepper stepper(magneticField); MockPropagatorState state( - Stepper::State(geoCtx, magneticField->makeCache(magCtx), + Stepper::State(options, magneticField->makeCache(magCtx), CurvilinearTrackParameters(pos4, unitDir, charge / absMom, - cov, particleHypothesis), - stepSize, tolerance)); + cov, particleHypothesis))); state.stepping.covTransport = true; // ensure step does not result in an error @@ -382,8 +368,7 @@ BOOST_AUTO_TEST_CASE(Reset) { auto copyState = [&](auto& field, const auto& other) { using field_t = std::decay_t; - std::decay_t copy(geoCtx, field.makeCache(magCtx), cp, - stepSize, tolerance); + std::decay_t copy(options, field.makeCache(magCtx), cp); copy.state_ready = other.state_ready; copy.useJacobian = other.useJacobian; @@ -403,13 +388,11 @@ BOOST_AUTO_TEST_CASE(Reset) { copy.pathAccumulated = other.pathAccumulated; copy.stepSize = other.stepSize; copy.previousStepSize = other.previousStepSize; - copy.tolerance = other.tolerance; copy.fieldCache = MagneticFieldProvider::Cache( std::in_place_type, other.fieldCache.template as()); - copy.geoContext = other.geoContext; copy.debug = other.debug; copy.debugString = other.debugString; copy.debugPfxWidth = other.debugPfxWidth; @@ -438,7 +421,6 @@ BOOST_AUTO_TEST_CASE(Reset) { BOOST_CHECK_EQUAL(stateCopy.stepSize.value(), navDir * stepSize); BOOST_CHECK_EQUAL(stateCopy.previousStepSize, state.stepping.previousStepSize); - BOOST_CHECK_EQUAL(stateCopy.tolerance, state.stepping.tolerance); // Reset all possible parameters except the step size stateCopy = copyState(*magneticField, state.stepping); @@ -460,7 +442,6 @@ BOOST_AUTO_TEST_CASE(Reset) { std::numeric_limits::max()); BOOST_CHECK_EQUAL(stateCopy.previousStepSize, state.stepping.previousStepSize); - BOOST_CHECK_EQUAL(stateCopy.tolerance, state.stepping.tolerance); // Reset the least amount of parameters stateCopy = copyState(*magneticField, state.stepping); @@ -482,7 +463,6 @@ BOOST_AUTO_TEST_CASE(Reset) { std::numeric_limits::max()); BOOST_CHECK_EQUAL(stateCopy.previousStepSize, state.stepping.previousStepSize); - BOOST_CHECK_EQUAL(stateCopy.tolerance, state.stepping.tolerance); // Reset using different surface shapes // 1) Disc surface @@ -556,12 +536,11 @@ BOOST_AUTO_TEST_CASE(Reset) { BOOST_AUTO_TEST_CASE(StepSize) { Stepper stepper(magneticField); Stepper::State state( - geoCtx, magneticField->makeCache(magCtx), + options, magneticField->makeCache(magCtx), CurvilinearTrackParameters(pos4, unitDir, charge / absMom, cov, - particleHypothesis), - stepSize, tolerance); + particleHypothesis)); - stepper.updateStepSize(state, -5_cm, ConstrainedStep::navigator); + stepper.updateStepSize(state, -5_cm, ConstrainedStep::navigator, true); BOOST_CHECK_EQUAL(state.previousStepSize, stepSize); BOOST_CHECK_EQUAL(state.stepSize.value(), -5_cm); @@ -573,40 +552,38 @@ BOOST_AUTO_TEST_CASE(StepSize) { BOOST_AUTO_TEST_CASE(StepSizeSurface) { Stepper stepper(magneticField); Stepper::State state( - geoCtx, magneticField->makeCache(magCtx), + options, magneticField->makeCache(magCtx), CurvilinearTrackParameters(pos4, unitDir, charge / absMom, cov, - particleHypothesis), - stepSize, tolerance); + particleHypothesis)); auto distance = 10_mm; auto target = CurvilinearSurface(pos + navDir * distance * unitDir, unitDir) .planeSurface(); - stepper.updateSurfaceStatus(state, *target, 0, navDir, - BoundaryTolerance::Infinite()); + stepper.updateSurfaceStatus( + state, *target, 0, navDir, BoundaryTolerance::Infinite(), + s_onSurfaceTolerance, ConstrainedStep::navigator, true); BOOST_CHECK_EQUAL(state.stepSize.value(ConstrainedStep::navigator), distance); // test the step size modification in the context of a surface - stepper.updateStepSize( - state, - target - ->intersect(state.geoContext, stepper.position(state), - navDir * stepper.direction(state), - BoundaryTolerance::Infinite()) - .closest(), - navDir, false); + stepper.updateStepSize(state, + target + ->intersect(geoCtx, stepper.position(state), + navDir * stepper.direction(state), + BoundaryTolerance::Infinite()) + .closest(), + navDir, ConstrainedStep::navigator, false); BOOST_CHECK_EQUAL(state.stepSize.value(), distance); // start with a different step size state.stepSize.setUser(navDir * stepSize); - stepper.updateStepSize( - state, - target - ->intersect(state.geoContext, stepper.position(state), - navDir * stepper.direction(state), - BoundaryTolerance::Infinite()) - .closest(), - navDir, true); + stepper.updateStepSize(state, + target + ->intersect(geoCtx, stepper.position(state), + navDir * stepper.direction(state), + BoundaryTolerance::Infinite()) + .closest(), + navDir, ConstrainedStep::navigator, true); BOOST_CHECK_EQUAL(state.stepSize.value(), navDir * stepSize); } diff --git a/Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp b/Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp index 56ec00b6c8a..d2e6e63952a 100644 --- a/Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp @@ -10,6 +10,7 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Direction.hpp" +#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Definitions/Units.hpp" #include "Acts/EventData/GenericBoundTrackParameters.hpp" @@ -33,7 +34,6 @@ #include "Acts/Propagator/ActorList.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/EigenStepper.hpp" -#include "Acts/Propagator/EigenStepperDefaultExtension.hpp" #include "Acts/Propagator/EigenStepperDenseExtension.hpp" #include "Acts/Propagator/EigenStepperError.hpp" #include "Acts/Propagator/MaterialInteractor.hpp" @@ -61,11 +61,6 @@ #include #include -namespace Acts { -class ISurfaceMaterial; -class Logger; -} // namespace Acts - using namespace Acts::UnitLiterals; using Acts::VectorHelpers::makeVector4; @@ -185,7 +180,6 @@ struct StepCollector { /// These tests are aiming to test whether the state setup is working properly BOOST_AUTO_TEST_CASE(eigen_stepper_state_test) { // Set up some variables - double stepSize = 123.; auto bField = std::make_shared(Vector3(1., 2.5, 33.33)); Vector3 pos(1., 2., 3.); @@ -197,8 +191,8 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_state_test) { // Test charged parameters without covariance matrix CurvilinearTrackParameters cp(makeVector4(pos, time), dir, charge / absMom, std::nullopt, ParticleHypothesis::pion()); - EigenStepper<>::State esState(tgContext, bField->makeCache(mfContext), cp, - stepSize); + EigenStepper<>::State esState(EigenStepper<>::Options(tgContext, mfContext), + bField->makeCache(mfContext), cp); EigenStepper<> es(bField); @@ -209,22 +203,21 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_state_test) { BOOST_CHECK(!esState.covTransport); BOOST_CHECK_EQUAL(esState.cov, Covariance::Zero()); BOOST_CHECK_EQUAL(esState.pathAccumulated, 0.); - BOOST_CHECK_EQUAL(esState.stepSize.value(), stepSize); BOOST_CHECK_EQUAL(esState.previousStepSize, 0.); // Test without charge and covariance matrix CurvilinearTrackParameters ncp(makeVector4(pos, time), dir, 1 / absMom, std::nullopt, ParticleHypothesis::pion0()); - esState = EigenStepper<>::State(tgContext, bField->makeCache(mfContext), ncp, - stepSize); + esState = EigenStepper<>::State(EigenStepper<>::Options(tgContext, mfContext), + bField->makeCache(mfContext), ncp); BOOST_CHECK_EQUAL(es.charge(esState), 0.); // Test with covariance matrix Covariance cov = 8. * Covariance::Identity(); ncp = CurvilinearTrackParameters(makeVector4(pos, time), dir, 1 / absMom, cov, ParticleHypothesis::pion0()); - esState = EigenStepper<>::State(tgContext, bField->makeCache(mfContext), ncp, - stepSize); + esState = EigenStepper<>::State(EigenStepper<>::Options(tgContext, mfContext), + bField->makeCache(mfContext), ncp); BOOST_CHECK_NE(esState.jacToGlobal, BoundToFreeMatrix::Zero()); BOOST_CHECK(esState.covTransport); BOOST_CHECK_EQUAL(esState.cov, cov); @@ -249,9 +242,11 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { CurvilinearTrackParameters cp(makeVector4(pos, time), dir, charge / absMom, cov, ParticleHypothesis::pion()); + EigenStepper<>::Options options(tgContext, mfContext); + options.maxStepSize = stepSize; + // Build the state and the stepper - EigenStepper<>::State esState(tgContext, bField->makeCache(mfContext), cp, - stepSize); + EigenStepper<>::State esState(options, bField->makeCache(mfContext), cp); EigenStepper<> es(bField); // Test the getters @@ -266,7 +261,7 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { // Step size modifies const std::string originalStepSize = esState.stepSize.toString(); - es.updateStepSize(esState, -1337., ConstrainedStep::navigator); + es.updateStepSize(esState, -1337., ConstrainedStep::navigator, true); BOOST_CHECK_EQUAL(esState.previousStepSize, stepSize); BOOST_CHECK_EQUAL(esState.stepSize.value(), -1337.); @@ -349,8 +344,9 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { auto copyState = [&](auto& field, const auto& state) { using field_t = std::decay_t; - std::decay_t copy(tgContext, field.makeCache(mfContext), - cp, stepSize); + std::decay_t copy( + EigenStepper<>::Options(tgContext, mfContext), + field.makeCache(mfContext), cp); copy.pars = state.pars; copy.covTransport = state.covTransport; copy.cov = state.cov; @@ -366,7 +362,6 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { std::in_place_type, state.fieldCache.template as()); - copy.geoContext = state.geoContext; copy.extension = state.extension; copy.stepData = state.stepData; @@ -451,34 +446,35 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { plane, tgContext, makeVector4(pos, time), dir, charge / absMom, cov, ParticleHypothesis::pion()) .value(); - esState = EigenStepper<>::State(tgContext, bField->makeCache(mfContext), cp, - stepSize); + esState = EigenStepper<>::State(EigenStepper<>::Options(tgContext, mfContext), + bField->makeCache(mfContext), cp); // Test the intersection in the context of a surface auto targetSurface = CurvilinearSurface(pos + navDir * 2. * dir, dir).planeSurface(); es.updateSurfaceStatus(esState, *targetSurface, 0, navDir, - BoundaryTolerance::Infinite()); + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator, true); CHECK_CLOSE_ABS(esState.stepSize.value(ConstrainedStep::navigator), navDir * 2., eps); // Test the step size modification in the context of a surface es.updateStepSize(esState, targetSurface - ->intersect(esState.geoContext, es.position(esState), + ->intersect(tgContext, es.position(esState), navDir * es.direction(esState), BoundaryTolerance::Infinite()) .closest(), - navDir, false); + navDir, ConstrainedStep::navigator, false); CHECK_CLOSE_ABS(esState.stepSize.value(), 2., eps); esState.stepSize.setUser(navDir * stepSize); es.updateStepSize(esState, targetSurface - ->intersect(esState.geoContext, es.position(esState), + ->intersect(tgContext, es.position(esState), navDir * es.direction(esState), BoundaryTolerance::Infinite()) .closest(), - navDir, true); + navDir, ConstrainedStep::navigator, true); CHECK_CLOSE_ABS(esState.stepSize.value(), 2., eps); // Test the bound state construction @@ -523,8 +519,8 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { // Produce some errors auto nBfield = std::make_shared(); EigenStepper<> nes(nBfield); - EigenStepper<>::State nesState(tgContext, nBfield->makeCache(mfContext), cp, - stepSize); + EigenStepper<>::State nesState(EigenStepper<>::Options(tgContext, mfContext), + nBfield->makeCache(mfContext), cp); PropState nps(navDir, copyState(*nBfield, nesState)); // Test that we can reach the minimum step size nps.options.stepping.stepTolerance = 1e-21; diff --git a/Tests/UnitTests/Core/Propagator/JacobianTests.cpp b/Tests/UnitTests/Core/Propagator/JacobianTests.cpp index 0761d5860eb..3782e74a4ef 100644 --- a/Tests/UnitTests/Core/Propagator/JacobianTests.cpp +++ b/Tests/UnitTests/Core/Propagator/JacobianTests.cpp @@ -11,7 +11,6 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Definitions/Units.hpp" -#include "Acts/EventData/GenericCurvilinearTrackParameters.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/MagneticField/ConstantBField.hpp" @@ -27,12 +26,10 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" -#include #include #include #include #include -#include #include using namespace Acts::UnitLiterals; @@ -135,11 +132,13 @@ template void testJacobianToGlobal(const Parameters& pars) { // Jacobian creation for Propagator/Steppers // a) ATLAS stepper - AtlasStepperType::State astepState(tgContext, bField->makeCache(mfContext), - pars); + AtlasStepperType::State astepState( + AtlasStepperType::Options(tgContext, mfContext), + bField->makeCache(mfContext), pars); // b) Eigen stepper - EigenStepperType::State estepState(tgContext, bField->makeCache(mfContext), - pars); + EigenStepperType::State estepState( + EigenStepperType::Options(tgContext, mfContext), + bField->makeCache(mfContext), pars); // create the matrices auto asMatrix = convertToMatrix(astepState.pVector); diff --git a/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp b/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp index a851d7592d9..50687b4e528 100644 --- a/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp @@ -10,8 +10,8 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Direction.hpp" +#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Definitions/TrackParametrization.hpp" -#include "Acts/EventData/Charge.hpp" #include "Acts/EventData/GenericBoundTrackParameters.hpp" #include "Acts/EventData/MultiComponentTrackParameters.hpp" #include "Acts/EventData/TrackParameters.hpp" @@ -20,6 +20,7 @@ #include "Acts/MagneticField/ConstantBField.hpp" #include "Acts/MagneticField/MagneticFieldContext.hpp" #include "Acts/MagneticField/NullBField.hpp" +#include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/EigenStepper.hpp" #include "Acts/Propagator/EigenStepperDefaultExtension.hpp" #include "Acts/Propagator/MultiEigenStepperLoop.hpp" @@ -28,14 +29,11 @@ #include "Acts/Surfaces/CurvilinearSurface.hpp" #include "Acts/Surfaces/PlaneSurface.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Logger.hpp" -#include "Acts/Utilities/Result.hpp" #include #include -#include #include #include #include @@ -164,11 +162,15 @@ auto makeDefaultBoundPars(bool cov = true, std::size_t n = 4, BOOST_AUTO_TEST_CASE(test_max_weight_reducer) { // Can use this multistepper since we only care about the state which is // invariant - using MultiState = typename MultiStepperLoop::State; + using MultiOptions = MultiStepperLoop::Options; + using MultiState = MultiStepperLoop::State; + + MultiOptions options(geoCtx, magCtx); + options.maxStepSize = defaultStepSize; constexpr std::size_t N = 4; const auto multi_pars = makeDefaultBoundPars(false, N); - MultiState state(geoCtx, magCtx, defaultBField, multi_pars, defaultStepSize); + MultiState state(options, defaultBField, multi_pars); SingleStepper singleStepper(defaultBField); double w = 0.1; @@ -191,11 +193,15 @@ BOOST_AUTO_TEST_CASE(test_max_weight_reducer) { BOOST_AUTO_TEST_CASE(test_max_momentum_reducer) { // Can use this multistepper since we only care about the state which is // invariant + using MultiOptions = MultiStepperLoop::Options; using MultiState = typename MultiStepperLoop::State; + MultiOptions options(geoCtx, magCtx); + options.maxStepSize = defaultStepSize; + constexpr std::size_t N = 4; const auto multi_pars = makeDefaultBoundPars(false, N); - MultiState state(geoCtx, magCtx, defaultBField, multi_pars, defaultStepSize); + MultiState state(options, defaultBField, multi_pars); SingleStepper singleStepper(defaultBField); double p = 1.0; @@ -218,13 +224,17 @@ BOOST_AUTO_TEST_CASE(test_max_momentum_reducer) { ////////////////////////////////////////////////////// template void test_multi_stepper_state() { + using MultiOptions = typename multi_stepper_t::Options; using MultiState = typename multi_stepper_t::State; using MultiStepper = multi_stepper_t; + MultiOptions options(geoCtx, magCtx); + options.maxStepSize = defaultStepSize; + constexpr std::size_t N = 4; const auto multi_pars = makeDefaultBoundPars(Cov, N, BoundVector::Ones()); - MultiState state(geoCtx, magCtx, defaultBField, multi_pars, defaultStepSize); + MultiState state(options, defaultBField, multi_pars); MultiStepper ms(defaultBField); @@ -263,14 +273,17 @@ BOOST_AUTO_TEST_CASE(multi_stepper_state_no_cov) { template void test_multi_stepper_state_invalid() { + using MultiOptions = typename multi_stepper_t::Options; using MultiState = typename multi_stepper_t::State; + MultiOptions options(geoCtx, magCtx); + options.maxStepSize = defaultStepSize; + // Empty component vector const auto multi_pars = makeDefaultBoundPars(false, 0); - BOOST_CHECK_THROW( - MultiState(geoCtx, magCtx, defaultBField, multi_pars, defaultStepSize), - std::invalid_argument); + BOOST_CHECK_THROW(MultiState(options, defaultBField, multi_pars), + std::invalid_argument); } BOOST_AUTO_TEST_CASE(multi_eigen_stepper_state_invalid) { @@ -282,9 +295,13 @@ BOOST_AUTO_TEST_CASE(multi_eigen_stepper_state_invalid) { //////////////////////////////////////////////////////////////////////// template void test_multi_stepper_vs_eigen_stepper() { + using MultiOptions = typename multi_stepper_t::Options; using MultiState = typename multi_stepper_t::State; using MultiStepper = multi_stepper_t; + MultiOptions options(geoCtx, magCtx); + options.maxStepSize = defaultStepSize; + const BoundVector pars = BoundVector::Ones(); const BoundSquareMatrix cov = BoundSquareMatrix::Identity(); @@ -299,10 +316,9 @@ void test_multi_stepper_vs_eigen_stepper() { particleHypothesis); BoundTrackParameters single_pars(surface, pars, cov, particleHypothesis); - MultiState multi_state(geoCtx, magCtx, defaultBField, multi_pars, - defaultStepSize); - SingleStepper::State single_state(geoCtx, defaultBField->makeCache(magCtx), - single_pars, defaultStepSize); + MultiState multi_state(options, defaultBField, multi_pars); + SingleStepper::State single_state(options, defaultBField->makeCache(magCtx), + single_pars); MultiStepper multi_stepper(defaultBField); SingleStepper single_stepper(defaultBField); @@ -356,15 +372,17 @@ BOOST_AUTO_TEST_CASE(multi_eigen_vs_single_eigen) { //////////////////////////////////////////////////// template void test_components_modifying_accessors() { + using MultiOptions = typename multi_stepper_t::Options; using MultiState = typename multi_stepper_t::State; using MultiStepper = multi_stepper_t; + MultiOptions options(geoCtx, magCtx); + options.maxStepSize = defaultStepSize; + const auto multi_pars = makeDefaultBoundPars(); - MultiState mutable_multi_state(geoCtx, magCtx, defaultBField, multi_pars, - defaultStepSize); - const MultiState const_multi_state(geoCtx, magCtx, defaultBField, multi_pars, - defaultStepSize); + MultiState mutable_multi_state(options, defaultBField, multi_pars); + const MultiState const_multi_state(options, defaultBField, multi_pars); MultiStepper multi_stepper(defaultBField); @@ -439,9 +457,13 @@ BOOST_AUTO_TEST_CASE(multi_eigen_component_iterable_with_modification) { ///////////////////////////////////////////// template void test_multi_stepper_surface_status_update() { + using MultiOptions = typename multi_stepper_t::Options; using MultiState = typename multi_stepper_t::State; using MultiStepper = multi_stepper_t; + MultiOptions options(geoCtx, magCtx); + options.maxStepSize = defaultStepSize; + auto start_surface = Acts::CurvilinearSurface(Vector3::Zero(), Vector3{1.0, 0.0, 0.0}) .planeSurface(); @@ -468,11 +490,10 @@ void test_multi_stepper_surface_status_update() { .direction() .isApprox(Vector3{-1.0, 0.0, 0.0}, 1.e-10)); - MultiState multi_state(geoCtx, magCtx, defaultNullBField, multi_pars, - defaultStepSize); - SingleStepper::State single_state( - geoCtx, defaultNullBField->makeCache(magCtx), std::get<1>(multi_pars[0]), - defaultStepSize); + MultiState multi_state(options, defaultNullBField, multi_pars); + SingleStepper::State single_state(options, + defaultNullBField->makeCache(magCtx), + std::get<1>(multi_pars[0])); MultiStepper multi_stepper(defaultNullBField); SingleStepper single_stepper(defaultNullBField); @@ -481,7 +502,8 @@ void test_multi_stepper_surface_status_update() { { auto status = multi_stepper.updateSurfaceStatus( multi_state, *right_surface, 0, Direction::Forward, - BoundaryTolerance::Infinite()); + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator, true); BOOST_CHECK_EQUAL(status, IntersectionStatus::reachable); @@ -510,7 +532,8 @@ void test_multi_stepper_surface_status_update() { { auto status = multi_stepper.updateSurfaceStatus( multi_state, *right_surface, 0, Direction::Forward, - BoundaryTolerance::Infinite()); + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator, true); BOOST_CHECK_EQUAL(status, IntersectionStatus::onSurface); @@ -526,7 +549,8 @@ void test_multi_stepper_surface_status_update() { { auto status = multi_stepper.updateSurfaceStatus( multi_state, *start_surface, 0, Direction::Forward, - BoundaryTolerance::Infinite()); + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator, true); BOOST_CHECK_EQUAL(status, IntersectionStatus::reachable); @@ -551,9 +575,13 @@ BOOST_AUTO_TEST_CASE(test_surface_status_and_cmpwise_bound_state) { ////////////////////////////////// template void test_component_bound_state() { + using MultiOptions = typename multi_stepper_t::Options; using MultiState = typename multi_stepper_t::State; using MultiStepper = multi_stepper_t; + MultiOptions options(geoCtx, magCtx); + options.maxStepSize = defaultStepSize; + auto start_surface = Acts::CurvilinearSurface(Vector3::Zero(), Vector3{1.0, 0.0, 0.0}) .planeSurface(); @@ -580,27 +608,28 @@ void test_component_bound_state() { .direction() .isApprox(Vector3{-1.0, 0.0, 0.0}, 1.e-10)); - MultiState multi_state(geoCtx, magCtx, defaultNullBField, multi_pars, - defaultStepSize); - SingleStepper::State single_state( - geoCtx, defaultNullBField->makeCache(magCtx), std::get<1>(multi_pars[0]), - defaultStepSize); + MultiState multi_state(options, defaultNullBField, multi_pars); + SingleStepper::State single_state(options, + defaultNullBField->makeCache(magCtx), + std::get<1>(multi_pars[0])); MultiStepper multi_stepper(defaultNullBField); SingleStepper single_stepper(defaultNullBField); // Step forward now { - multi_stepper.updateSurfaceStatus(multi_state, *right_surface, 0, - Direction::Forward, - BoundaryTolerance::Infinite()); + multi_stepper.updateSurfaceStatus( + multi_state, *right_surface, 0, Direction::Forward, + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator, true); auto multi_prop_state = DummyPropState(Direction::Forward, multi_state); multi_stepper.step(multi_prop_state, mockNavigator); // Single stepper - single_stepper.updateSurfaceStatus(single_state, *right_surface, 0, - Direction::Forward, - BoundaryTolerance::Infinite()); + single_stepper.updateSurfaceStatus( + single_state, *right_surface, 0, Direction::Forward, + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator, true); auto single_prop_state = DummyPropState(Direction::Forward, single_state); single_stepper.step(single_prop_state, mockNavigator); } @@ -632,9 +661,13 @@ BOOST_AUTO_TEST_CASE(test_component_wise_bound_state) { template void test_combined_bound_state_function() { + using MultiOptions = typename multi_stepper_t::Options; using MultiState = typename multi_stepper_t::State; using MultiStepper = multi_stepper_t; + MultiOptions options(geoCtx, magCtx); + options.maxStepSize = defaultStepSize; + auto surface = Acts::CurvilinearSurface(Vector3::Zero(), Vector3{1.0, 0.0, 0.0}) .planeSurface(); @@ -652,8 +685,7 @@ void test_combined_bound_state_function() { MultiComponentBoundTrackParameters multi_pars(surface, cmps, particleHypothesis); - MultiState multi_state(geoCtx, magCtx, defaultBField, multi_pars, - defaultStepSize); + MultiState multi_state(options, defaultBField, multi_pars); MultiStepper multi_stepper(defaultBField); auto res = multi_stepper.boundState(multi_state, *surface, true, @@ -678,9 +710,13 @@ BOOST_AUTO_TEST_CASE(test_combined_bound_state) { ////////////////////////////////////////////////// template void test_combined_curvilinear_state_function() { + using MultiOptions = typename multi_stepper_t::Options; using MultiState = typename multi_stepper_t::State; using MultiStepper = multi_stepper_t; + MultiOptions options(geoCtx, magCtx); + options.maxStepSize = defaultStepSize; + auto surface = Acts::CurvilinearSurface(Vector3::Zero(), Vector3{1.0, 0.0, 0.0}) .planeSurface(); @@ -699,16 +735,14 @@ void test_combined_curvilinear_state_function() { MultiComponentBoundTrackParameters multi_pars(surface, cmps, particleHypothesis); - MultiState multi_state(geoCtx, magCtx, defaultBField, multi_pars, - defaultStepSize); + MultiState multi_state(options, defaultBField, multi_pars); MultiStepper multi_stepper(defaultBField); const auto [curv_pars, jac, pathLength] = multi_stepper.curvilinearState(multi_state); - BOOST_CHECK( - curv_pars.fourPosition(multi_state.geoContext) - .isApprox(check_pars.fourPosition(multi_state.geoContext), 1.e-8)); + BOOST_CHECK(curv_pars.fourPosition(geoCtx).isApprox( + check_pars.fourPosition(geoCtx), 1.e-8)); BOOST_CHECK(curv_pars.direction().isApprox(check_pars.direction(), 1.e-8)); BOOST_CHECK_CLOSE(curv_pars.absoluteMomentum(), check_pars.absoluteMomentum(), 1.e-8); @@ -725,13 +759,16 @@ BOOST_AUTO_TEST_CASE(test_curvilinear_state) { template void test_single_component_interface_function() { + using MultiOptions = typename multi_stepper_t::Options; using MultiState = typename multi_stepper_t::State; using MultiStepper = multi_stepper_t; + MultiOptions options(geoCtx, magCtx); + options.maxStepSize = defaultStepSize; + MultiComponentBoundTrackParameters multi_pars = makeDefaultBoundPars(true, 4); - MultiState multi_state(geoCtx, magCtx, defaultBField, multi_pars, - defaultStepSize); + MultiState multi_state(options, defaultBField, multi_pars); MultiStepper multi_stepper(defaultBField); @@ -770,13 +807,15 @@ BOOST_AUTO_TEST_CASE(test_single_component_interface) { template void remove_add_components_function() { + using MultiOptions = typename multi_stepper_t::Options; using MultiState = typename multi_stepper_t::State; using MultiStepper = multi_stepper_t; + MultiOptions options(geoCtx, magCtx); + const auto multi_pars = makeDefaultBoundPars(4); - MultiState multi_state(geoCtx, magCtx, defaultBField, multi_pars, - defaultStepSize); + MultiState multi_state(options, defaultBField, multi_pars); MultiStepper multi_stepper(defaultBField); diff --git a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp index a4d3c3d0ad9..64f37fc426e 100644 --- a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp +++ b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp @@ -169,14 +169,14 @@ BOOST_AUTO_TEST_CASE(Navigator_status_methods) { ACTS_INFO(" i) Because target is reached"); state.navigationBreak = true; - navigator.estimateNextTarget(state, position, direction); + navigator.nextTarget(state, position, direction); BOOST_CHECK(testNavigatorStateVectors(state, 0u, 0u, 0u)); BOOST_CHECK(testNavigatorStatePointers(state, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)); ACTS_INFO(" ii) Because of no target surface"); state.targetSurface = nullptr; - navigator.estimateNextTarget(state, position, direction); + navigator.nextTarget(state, position, direction); BOOST_CHECK(testNavigatorStateVectors(state, 0u, 0u, 0u)); BOOST_CHECK(testNavigatorStatePointers(state, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)); @@ -260,12 +260,11 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) { BOOST_CHECK_EQUAL(state.navLayers.size(), 0u); // Estimate the next target - NavigationTarget target = - navigator.estimateNextTarget(state, position, direction); + NavigationTarget target = navigator.nextTarget(state, position, direction); // A layer has been found BOOST_CHECK_EQUAL(state.navLayers.size(), 1u); // The index should points to the begin - BOOST_CHECK_EQUAL(state.navLayerIndex, 0); + BOOST_CHECK_EQUAL(state.navLayerIndex.value(), 0); // Check the target is correct BOOST_CHECK_EQUAL(target.surface, state.navLayer().first.object()); // Intersect the target @@ -291,12 +290,12 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) { // The layer number has not changed BOOST_CHECK_EQUAL(state.navLayers.size(), 1u); // The index still points to the begin - BOOST_CHECK_EQUAL(state.navLayerIndex, 0); + BOOST_CHECK_EQUAL(state.navLayerIndex.value(), 0); ACTS_INFO("<<< Test 1b >>> step to the BeamPipe at " << toString(position)); // Estimate the next target - target = navigator.estimateNextTarget(state, position, direction); + target = navigator.nextTarget(state, position, direction); // Do the step towards the boundary step(position, direction, target); @@ -308,7 +307,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) { ACTS_INFO("<<< Test 1c >>> step to the Boundary at " << toString(position)); // Estimate the next target - target = navigator.estimateNextTarget(state, position, direction); + target = navigator.nextTarget(state, position, direction); // Intersect the target targetIntersection = target.surface->intersect(tgContext, position, direction) .closestForward(); @@ -323,7 +322,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) { ACTS_INFO("<<< Test 1d >>> step to 1st layer at " << toString(position)); // Estimate the next target - target = navigator.estimateNextTarget(state, position, direction); + target = navigator.nextTarget(state, position, direction); // Step through the surfaces on first layer for (std::size_t isf = 0; isf < 5; ++isf) { @@ -332,7 +331,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) { // POST STEP navigator.handleSurfaceReached(state, position, direction, *target.surface); // ACTORS - ABORTERS - PRE STEP - target = navigator.estimateNextTarget(state, position, direction); + target = navigator.nextTarget(state, position, direction); ACTS_INFO("<<< Test 1e-1i >>> step within 1st layer at " << toString(position)); @@ -344,7 +343,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) { // POST STEP navigator.handleSurfaceReached(state, position, direction, *target.surface); // ACTORS - ABORTERS - PRE STEP - target = navigator.estimateNextTarget(state, position, direction); + target = navigator.nextTarget(state, position, direction); ACTS_INFO("<<< Test 1j >>> step to 2nd layer at " << toString(position)); @@ -355,7 +354,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) { // POST STEP navigator.handleSurfaceReached(state, position, direction, *target.surface); // ACTORS - ABORTERS - PRE STEP - target = navigator.estimateNextTarget(state, position, direction); + target = navigator.nextTarget(state, position, direction); ACTS_INFO("<<< Test 1k-1o >>> step within 2nd layer at " << toString(position)); @@ -367,7 +366,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) { // POST STEP navigator.handleSurfaceReached(state, position, direction, *target.surface); // ACTORS - ABORTERS - PRE STEP - target = navigator.estimateNextTarget(state, position, direction); + target = navigator.nextTarget(state, position, direction); ACTS_INFO("<<< Test 1p >>> step to 3rd layer at " << toString(position)); @@ -378,7 +377,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) { // POST STEP navigator.handleSurfaceReached(state, position, direction, *target.surface); // ACTORS - ABORTERS - PRE STEP - target = navigator.estimateNextTarget(state, position, direction); + target = navigator.nextTarget(state, position, direction); ACTS_INFO("<<< Test 1q-1s >>> step within 3rd layer at " << toString(position)); @@ -390,7 +389,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) { // POST STEP navigator.handleSurfaceReached(state, position, direction, *target.surface); // ACTORS - ABORTERS - PRE STEP - target = navigator.estimateNextTarget(state, position, direction); + target = navigator.nextTarget(state, position, direction); ACTS_INFO("<<< Test 1t >>> step to 4th layer at " << toString(position)); @@ -401,7 +400,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) { // POST STEP navigator.handleSurfaceReached(state, position, direction, *target.surface); // ACTORS - ABORTERS - PRE STEP - target = navigator.estimateNextTarget(state, position, direction); + target = navigator.nextTarget(state, position, direction); ACTS_INFO("<<< Test 1t-1v >>> step within 4th layer at " << toString(position)); @@ -413,7 +412,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) { // POST STEP navigator.handleSurfaceReached(state, position, direction, *target.surface); // ACTORS - ABORTERS - PRE STEP - target = navigator.estimateNextTarget(state, position, direction); + target = navigator.nextTarget(state, position, direction); ACTS_INFO("<<< Test 1w >>> step to boundary at " << toString(position)); } diff --git a/Tests/UnitTests/Core/Propagator/PropagatorTests.cpp b/Tests/UnitTests/Core/Propagator/PropagatorTests.cpp index 777c9d27a5f..8140af55be9 100644 --- a/Tests/UnitTests/Core/Propagator/PropagatorTests.cpp +++ b/Tests/UnitTests/Core/Propagator/PropagatorTests.cpp @@ -10,7 +10,6 @@ #include #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/Direction.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Definitions/Units.hpp" #include "Acts/EventData/GenericBoundTrackParameters.hpp" @@ -24,10 +23,8 @@ #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/EigenStepper.hpp" #include "Acts/Propagator/EigenStepperDenseExtension.hpp" -#include "Acts/Propagator/Navigator.hpp" #include "Acts/Propagator/NavigatorOptions.hpp" #include "Acts/Propagator/Propagator.hpp" -#include "Acts/Propagator/StandardAborters.hpp" #include "Acts/Propagator/StraightLineStepper.hpp" #include "Acts/Surfaces/CurvilinearSurface.hpp" #include "Acts/Surfaces/CylinderBounds.hpp" @@ -35,11 +32,8 @@ #include "Acts/Surfaces/PlaneSurface.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" -#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Result.hpp" -#include -#include #include #include #include @@ -47,14 +41,9 @@ #include #include #include -#include #include #include -namespace Acts { -class Logger; -} // namespace Acts - namespace bdata = boost::unit_test::data; using namespace Acts::UnitLiterals; using Acts::VectorHelpers::makeVector4; @@ -408,9 +397,10 @@ BOOST_AUTO_TEST_CASE(BasicPropagatorInterface) { GeometryContext gctx; MagneticFieldContext mctx; - EigenPropagatorType::Options<> options{gctx, mctx}; { + EigenPropagatorType::Options<> options{gctx, mctx}; + Propagator propagator{eigenStepper, navigator}; static_assert(std::is_base_of_v, "Propagator does not inherit from BasePropagator"); @@ -442,6 +432,8 @@ BOOST_AUTO_TEST_CASE(BasicPropagatorInterface) { StraightLineStepper slStepper{}; { + Propagator::Options<> options{gctx, mctx}; + Propagator propagator{slStepper, navigator}; static_assert(std::is_base_of_v, "Propagator does not inherit from BasePropagator"); diff --git a/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp b/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp index fdcb9225f7f..d6d8694087b 100644 --- a/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp @@ -10,8 +10,8 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Direction.hpp" +#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Definitions/TrackParametrization.hpp" -#include "Acts/EventData/Charge.hpp" #include "Acts/EventData/GenericBoundTrackParameters.hpp" #include "Acts/EventData/GenericCurvilinearTrackParameters.hpp" #include "Acts/EventData/TrackParameters.hpp" @@ -24,17 +24,13 @@ #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/CurvilinearSurface.hpp" #include "Acts/Surfaces/PlaneSurface.hpp" -#include "Acts/Surfaces/Surface.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" -#include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Result.hpp" -#include #include #include #include #include -#include #include using Acts::VectorHelpers::makeVector4; @@ -70,7 +66,6 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_state_test) { GeometryContext tgContext = GeometryContext(); MagneticFieldContext mfContext = MagneticFieldContext(); double stepSize = 123.; - double tolerance = 234.; Vector3 pos(1., 2., 3.); Vector3 dir(4., 5., 6.); @@ -78,11 +73,13 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_state_test) { double absMom = 8.; double charge = -1.; + StraightLineStepper::Options options(tgContext, mfContext); + options.maxStepSize = stepSize; + // Test charged parameters without covariance matrix CurvilinearTrackParameters cp(makeVector4(pos, time), dir, charge / absMom, std::nullopt, ParticleHypothesis::pion()); - StraightLineStepper::State slsState(tgContext, mfContext, cp, stepSize, - tolerance); + StraightLineStepper::State slsState(options, cp); StraightLineStepper sls; @@ -100,20 +97,19 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_state_test) { BOOST_CHECK_EQUAL(slsState.pathAccumulated, 0.); BOOST_CHECK_EQUAL(slsState.stepSize.value(), stepSize); BOOST_CHECK_EQUAL(slsState.previousStepSize, 0.); - BOOST_CHECK_EQUAL(slsState.tolerance, tolerance); // Test without charge and covariance matrix CurvilinearTrackParameters ncp(makeVector4(pos, time), dir, 1 / absMom, std::nullopt, ParticleHypothesis::pion0()); - slsState = StraightLineStepper::State(tgContext, mfContext, ncp, stepSize, - tolerance); + slsState = StraightLineStepper::State( + StraightLineStepper::Options(tgContext, mfContext), ncp); // Test with covariance matrix Covariance cov = 8. * Covariance::Identity(); ncp = CurvilinearTrackParameters(makeVector4(pos, time), dir, 1 / absMom, cov, ParticleHypothesis::pion0()); - slsState = StraightLineStepper::State(tgContext, mfContext, ncp, stepSize, - tolerance); + slsState = StraightLineStepper::State( + StraightLineStepper::Options(tgContext, mfContext), ncp); BOOST_CHECK_NE(slsState.jacToGlobal, BoundToFreeMatrix::Zero()); BOOST_CHECK(slsState.covTransport); BOOST_CHECK_EQUAL(slsState.cov, cov); @@ -127,7 +123,6 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { MagneticFieldContext mfContext = MagneticFieldContext(); Direction navDir = Direction::Backward; double stepSize = 123.; - double tolerance = 234.; // Construct the parameters Vector3 pos(1., 2., 3.); @@ -139,9 +134,11 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { CurvilinearTrackParameters cp(makeVector4(pos, time), dir, charge / absMom, cov, ParticleHypothesis::pion()); + StraightLineStepper::Options options(tgContext, mfContext); + options.maxStepSize = stepSize; + // Build the state and the stepper - StraightLineStepper::State slsState(tgContext, mfContext, cp, stepSize, - tolerance); + StraightLineStepper::State slsState(options, cp); StraightLineStepper sls; // Test the getters @@ -154,7 +151,7 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { // Step size modifies const std::string originalStepSize = slsState.stepSize.toString(); - sls.updateStepSize(slsState, -1337., ConstrainedStep::navigator); + sls.updateStepSize(slsState, -1337., ConstrainedStep::navigator, true); BOOST_CHECK_EQUAL(slsState.previousStepSize, stepSize); BOOST_CHECK_EQUAL(slsState.stepSize.value(), -1337.); @@ -265,7 +262,6 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { BOOST_CHECK_EQUAL(slsStateCopy.stepSize.value(), navDir * stepSize2); BOOST_CHECK_EQUAL(slsStateCopy.previousStepSize, ps.stepping.previousStepSize); - BOOST_CHECK_EQUAL(slsStateCopy.tolerance, ps.stepping.tolerance); // Reset all possible parameters except the step size slsStateCopy = ps.stepping; @@ -291,7 +287,6 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { std::numeric_limits::max()); BOOST_CHECK_EQUAL(slsStateCopy.previousStepSize, ps.stepping.previousStepSize); - BOOST_CHECK_EQUAL(slsStateCopy.tolerance, ps.stepping.tolerance); // Reset the least amount of parameters slsStateCopy = ps.stepping; @@ -317,7 +312,6 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { std::numeric_limits::max()); BOOST_CHECK_EQUAL(slsStateCopy.previousStepSize, ps.stepping.previousStepSize); - BOOST_CHECK_EQUAL(slsStateCopy.tolerance, ps.stepping.tolerance); /// Repeat with surface related methods auto plane = CurvilinearSurface(pos, dir).planeSurface(); @@ -325,36 +319,35 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { plane, tgContext, makeVector4(pos, time), dir, charge / absMom, cov, ParticleHypothesis::pion()) .value(); - slsState = - StraightLineStepper::State(tgContext, mfContext, cp, stepSize, tolerance); + slsState = StraightLineStepper::State( + StraightLineStepper::Options(tgContext, mfContext), cp); // Test the intersection in the context of a surface auto targetSurface = CurvilinearSurface(pos + navDir * 2. * dir, dir).planeSurface(); sls.updateSurfaceStatus(slsState, *targetSurface, 0, navDir, - BoundaryTolerance::Infinite()); + BoundaryTolerance::Infinite(), s_onSurfaceTolerance, + ConstrainedStep::navigator, true); CHECK_CLOSE_ABS(slsState.stepSize.value(ConstrainedStep::navigator), navDir * 2., 1e-6); // Test the step size modification in the context of a surface - sls.updateStepSize( - slsState, - targetSurface - ->intersect(slsState.geoContext, sls.position(slsState), - navDir * sls.direction(slsState), - BoundaryTolerance::Infinite()) - .closest(), - navDir, false); + sls.updateStepSize(slsState, + targetSurface + ->intersect(tgContext, sls.position(slsState), + navDir * sls.direction(slsState), + BoundaryTolerance::Infinite()) + .closest(), + navDir, ConstrainedStep::navigator, false); CHECK_CLOSE_ABS(slsState.stepSize.value(), 2, 1e-6); slsState.stepSize.setUser(navDir * stepSize); - sls.updateStepSize( - slsState, - targetSurface - ->intersect(slsState.geoContext, sls.position(slsState), - navDir * sls.direction(slsState), - BoundaryTolerance::Infinite()) - .closest(), - navDir, true); + sls.updateStepSize(slsState, + targetSurface + ->intersect(tgContext, sls.position(slsState), + navDir * sls.direction(slsState), + BoundaryTolerance::Infinite()) + .closest(), + navDir, ConstrainedStep::navigator, true); CHECK_CLOSE_ABS(slsState.stepSize.value(), 2, 1e-6); // Test the bound state construction diff --git a/Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp b/Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp index a71c1758c8f..d6f0a2adaef 100644 --- a/Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/SympyStepperTests.cpp @@ -10,10 +10,10 @@ #include "Acts/Definitions/Algebra.hpp" #include "Acts/Definitions/Direction.hpp" +#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Definitions/TrackParametrization.hpp" #include "Acts/Definitions/Units.hpp" #include "Acts/EventData/GenericBoundTrackParameters.hpp" -#include "Acts/EventData/GenericCurvilinearTrackParameters.hpp" #include "Acts/EventData/ParticleHypothesis.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/EventData/TransformationHelpers.hpp" @@ -40,11 +40,6 @@ #include #include -namespace Acts { -class ISurfaceMaterial; -class Logger; -} // namespace Acts - using namespace Acts::UnitLiterals; using Acts::VectorHelpers::makeVector4; @@ -159,7 +154,6 @@ struct StepCollector { /// These tests are aiming to test whether the state setup is working properly BOOST_AUTO_TEST_CASE(sympy_stepper_state_test) { // Set up some variables - double stepSize = 123.; auto bField = std::make_shared(Vector3(1., 2.5, 33.33)); Vector3 pos(1., 2., 3.); @@ -171,8 +165,8 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_state_test) { // Test charged parameters without covariance matrix CurvilinearTrackParameters cp(makeVector4(pos, time), dir, charge / absMom, std::nullopt, ParticleHypothesis::pion()); - SympyStepper::State esState(tgContext, bField->makeCache(mfContext), cp, - stepSize); + SympyStepper::State esState(SympyStepper::Options(tgContext, mfContext), + bField->makeCache(mfContext), cp); SympyStepper es(bField); @@ -183,22 +177,21 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_state_test) { BOOST_CHECK(!esState.covTransport); BOOST_CHECK_EQUAL(esState.cov, Covariance::Zero()); BOOST_CHECK_EQUAL(esState.pathAccumulated, 0.); - BOOST_CHECK_EQUAL(esState.stepSize.value(), stepSize); BOOST_CHECK_EQUAL(esState.previousStepSize, 0.); // Test without charge and covariance matrix CurvilinearTrackParameters ncp(makeVector4(pos, time), dir, 1 / absMom, std::nullopt, ParticleHypothesis::pion0()); - esState = SympyStepper::State(tgContext, bField->makeCache(mfContext), ncp, - stepSize); + esState = SympyStepper::State(SympyStepper::Options(tgContext, mfContext), + bField->makeCache(mfContext), ncp); BOOST_CHECK_EQUAL(es.charge(esState), 0.); // Test with covariance matrix Covariance cov = 8. * Covariance::Identity(); ncp = CurvilinearTrackParameters(makeVector4(pos, time), dir, 1 / absMom, cov, ParticleHypothesis::pion0()); - esState = SympyStepper::State(tgContext, bField->makeCache(mfContext), ncp, - stepSize); + esState = SympyStepper::State(SympyStepper::Options(tgContext, mfContext), + bField->makeCache(mfContext), ncp); BOOST_CHECK_NE(esState.jacToGlobal, BoundToFreeMatrix::Zero()); BOOST_CHECK(esState.covTransport); BOOST_CHECK_EQUAL(esState.cov, cov); @@ -224,8 +217,8 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_test) { cov, ParticleHypothesis::pion()); // Build the state and the stepper - SympyStepper::State esState(tgContext, bField->makeCache(mfContext), cp, - stepSize); + SympyStepper::State esState(SympyStepper::Options(tgContext, mfContext), + bField->makeCache(mfContext), cp); SympyStepper es(bField); // Test the getters @@ -240,7 +233,7 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_test) { // Step size modifies const std::string originalStepSize = esState.stepSize.toString(); - es.updateStepSize(esState, -1337., ConstrainedStep::navigator); + es.updateStepSize(esState, -1337., ConstrainedStep::navigator, true); BOOST_CHECK_EQUAL(esState.previousStepSize, stepSize); BOOST_CHECK_EQUAL(esState.stepSize.value(), -1337.); @@ -323,8 +316,9 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_test) { auto copyState = [&](auto& field, const auto& state) { using field_t = std::decay_t; - std::decay_t copy(tgContext, field.makeCache(mfContext), - cp, stepSize); + std::decay_t copy( + SympyStepper::Options(tgContext, mfContext), field.makeCache(mfContext), + cp); copy.pars = state.pars; copy.covTransport = state.covTransport; copy.cov = state.cov; @@ -340,8 +334,6 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_test) { std::in_place_type, state.fieldCache.template as()); - copy.geoContext = state.geoContext; - return copy; }; @@ -423,14 +415,15 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_test) { plane, tgContext, makeVector4(pos, time), dir, charge / absMom, cov, ParticleHypothesis::pion()) .value(); - esState = SympyStepper::State(tgContext, bField->makeCache(mfContext), cp, - stepSize); + esState = SympyStepper::State(SympyStepper::Options(tgContext, mfContext), + bField->makeCache(mfContext), cp); // Test the intersection in the context of a surface auto targetSurface = CurvilinearSurface(pos + navDir * 2. * dir, dir).planeSurface(); es.updateSurfaceStatus(esState, *targetSurface, 0, navDir, - BoundaryTolerance::None()); + BoundaryTolerance::None(), s_onSurfaceTolerance, + ConstrainedStep::navigator, true); CHECK_CLOSE_ABS(esState.stepSize.value(ConstrainedStep::navigator), navDir * 2., eps); @@ -438,19 +431,19 @@ BOOST_AUTO_TEST_CASE(sympy_stepper_test) { es.updateStepSize( esState, targetSurface - ->intersect(esState.geoContext, es.position(esState), + ->intersect(tgContext, es.position(esState), navDir * es.direction(esState), BoundaryTolerance::None()) .closest(), - navDir, false); + navDir, ConstrainedStep::navigator, false); CHECK_CLOSE_ABS(esState.stepSize.value(), 2., eps); esState.stepSize.setUser(navDir * stepSize); es.updateStepSize( esState, targetSurface - ->intersect(esState.geoContext, es.position(esState), + ->intersect(tgContext, es.position(esState), navDir * es.direction(esState), BoundaryTolerance::None()) .closest(), - navDir, true); + navDir, ConstrainedStep::navigator, true); CHECK_CLOSE_ABS(esState.stepSize.value(), 2., eps); // Test the bound state construction diff --git a/Tests/UnitTests/Core/Vertexing/ImpactPointEstimatorTests.cpp b/Tests/UnitTests/Core/Vertexing/ImpactPointEstimatorTests.cpp index d26ba186e84..0e034082e4c 100644 --- a/Tests/UnitTests/Core/Vertexing/ImpactPointEstimatorTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/ImpactPointEstimatorTests.cpp @@ -267,14 +267,17 @@ BOOST_DATA_TEST_CASE(TimeAtPca, tracksWithoutIPs* vertices, t0, phi, theta, p, pOptions.direction = Direction::fromScalarZeroAsPositive(intersection.pathLength()); + StraightPropagator::Options<> straightPOptions(geoContext, magFieldContext); + straightPOptions.direction = pOptions.direction; + // Propagate to the 2D PCA of the reference point in a constant B field auto result = propagator->propagate(params, *refPerigeeSurface, pOptions); BOOST_CHECK(result.ok()); const auto& refParams = *result->endParameters; // Propagate to the 2D PCA of the reference point when B = 0 - auto zeroFieldResult = - straightLinePropagator->propagate(params, *refPerigeeSurface, pOptions); + auto zeroFieldResult = straightLinePropagator->propagate( + params, *refPerigeeSurface, straightPOptions); BOOST_CHECK(zeroFieldResult.ok()); const auto& zeroFieldRefParams = *zeroFieldResult->endParameters; diff --git a/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp b/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp index 3e01760839e..9960632eaa9 100644 --- a/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp +++ b/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp @@ -117,7 +117,8 @@ struct MockStepper { state.p = 1 / qop; } void updateStepSize(State & /*state*/, double /*stepSize*/, - Acts::ConstrainedStep::Type /*stype*/) const {} + Acts::ConstrainedStep::Type /*stype*/, + bool /*release*/) const {} }; struct MockNavigatorState {