diff --git a/Core/include/Acts/Navigation/SurfaceCandidatesUpdators.hpp b/Core/include/Acts/Navigation/SurfaceCandidatesUpdators.hpp index b644d7c1a42..fb3fb611915 100644 --- a/Core/include/Acts/Navigation/SurfaceCandidatesUpdators.hpp +++ b/Core/include/Acts/Navigation/SurfaceCandidatesUpdators.hpp @@ -45,8 +45,9 @@ inline static void updateCandidates(const GeometryContext& gctx, (c.surface != nullptr) ? (*c.surface) : (c.portal->surface()); // Get the intersection @todo make a templated intersector - auto sIntersection = - sRep.intersect(gctx, position, direction, c.boundaryCheck); + // TODO surface tolerance + auto sIntersection = sRep.intersect(gctx, position, direction, + c.boundaryCheck, s_onSurfaceTolerance); // Re-order and swap if necessary if (sIntersection.intersection.pathLength + s_onSurfaceTolerance < nState.overstepTolerance and diff --git a/Core/include/Acts/Propagator/AtlasStepper.hpp b/Core/include/Acts/Propagator/AtlasStepper.hpp index 062485914c3..b27f53df873 100644 --- a/Core/include/Acts/Propagator/AtlasStepper.hpp +++ b/Core/include/Acts/Propagator/AtlasStepper.hpp @@ -74,10 +74,10 @@ class AtlasStepper { const auto pos = pars.position(gctx); const auto Vp = pars.parameters(); - double Sf = sin(Vp[eBoundPhi]); - double Cf = cos(Vp[eBoundPhi]); - double Se = sin(Vp[eBoundTheta]); - double Ce = cos(Vp[eBoundTheta]); + double Sf = std::sin(Vp[eBoundPhi]); + double Cf = std::cos(Vp[eBoundPhi]); + double Se = std::sin(Vp[eBoundTheta]); + double Ce = std::cos(Vp[eBoundTheta]); pVector[0] = pos[ePos0]; pVector[1] = pos[ePos1]; @@ -168,8 +168,8 @@ class AtlasStepper { const auto& surface = pars.referenceSurface(); // the disc needs polar coordinate adaptations if (surface.type() == Surface::Disc) { - double lCf = cos(Vp[1]); - double lSf = sin(Vp[1]); + double lCf = std::cos(Vp[1]); + double lSf = std::sin(Vp[1]); double Ax[3] = {transform(0, 0), transform(1, 0), transform(2, 0)}; double Ay[3] = {transform(0, 1), transform(1, 1), transform(2, 1)}; double d0 = lCf * Ax[0] + lSf * Ay[0]; @@ -385,11 +385,13 @@ class AtlasStepper { /// @param [in] surface The surface provided /// @param [in] bcheck The boundary check for this status update /// @param [in] logger Logger instance to use + /// @param [in] surfaceTolerance Surface tolerance used for intersection Intersection3D::Status updateSurfaceStatus( State& state, const Surface& surface, const BoundaryCheck& bcheck, - const Logger& logger = getDummyLogger()) const { + const Logger& logger = getDummyLogger(), + ActsScalar surfaceTolerance = s_onSurfaceTolerance) const { return detail::updateSingleSurfaceStatus( - *this, state, surface, bcheck, logger); + *this, state, surface, bcheck, logger, surfaceTolerance); } /// Update step size @@ -568,10 +570,10 @@ class AtlasStepper { Vector3 pos(state.pVector[0], state.pVector[1], state.pVector[2]); Vector3 mom(state.pVector[4], state.pVector[5], state.pVector[6]); - double Sf = sin(boundParams[eBoundPhi]); - double Cf = cos(boundParams[eBoundPhi]); - double Se = sin(boundParams[eBoundTheta]); - double Ce = cos(boundParams[eBoundTheta]); + double Sf = std::sin(boundParams[eBoundPhi]); + double Cf = std::cos(boundParams[eBoundPhi]); + double Se = std::sin(boundParams[eBoundTheta]); + double Ce = std::cos(boundParams[eBoundTheta]); const auto transform = surface.referenceFrame(state.geoContext, pos, mom); @@ -639,8 +641,8 @@ class AtlasStepper { // special treatment for surface types // the disc needs polar coordinate adaptations if (surface.type() == Surface::Disc) { - double lCf = cos(boundParams[eBoundLoc1]); - double lSf = sin(boundParams[eBoundLoc1]); + double lCf = std::cos(boundParams[eBoundLoc1]); + double lSf = std::sin(boundParams[eBoundLoc1]); double Ax[3] = {transform(0, 0), transform(1, 0), transform(2, 0)}; double Ay[3] = {transform(0, 1), transform(1, 1), transform(2, 1)}; double d0 = lCf * Ax[0] + lSf * Ay[0]; @@ -1220,7 +1222,7 @@ class AtlasStepper { 2. * h * (std::abs((A1 + A6) - (A3 + A4)) + std::abs((B1 + B6) - (B3 + B4)) + std::abs((C1 + C6) - (C3 + C4))); - if (EST > state.options.tolerance) { + if (std::abs(EST) > std::abs(state.options.tolerance)) { h = h * .5; state.stepping.stepSize.setValue(h); // dltm = 0.; diff --git a/Core/include/Acts/Propagator/DirectNavigator.hpp b/Core/include/Acts/Propagator/DirectNavigator.hpp index 1955b92e688..7f593c48de6 100644 --- a/Core/include/Acts/Propagator/DirectNavigator.hpp +++ b/Core/include/Acts/Propagator/DirectNavigator.hpp @@ -222,7 +222,8 @@ class DirectNavigator { if (state.navigation.navSurfaceIter != state.navigation.navSurfaces.end()) { // Establish & update the surface status auto surfaceStatus = stepper.updateSurfaceStatus( - state.stepping, **state.navigation.navSurfaceIter, false); + state.stepping, **state.navigation.navSurfaceIter, false, *m_logger, + state.options.targetTolerance); if (surfaceStatus == Intersection3D::Status::unreachable) { ACTS_VERBOSE( "Surface not reachable anymore, switching to next one in " @@ -269,7 +270,8 @@ class DirectNavigator { if (state.navigation.navSurfaceIter != state.navigation.navSurfaces.end()) { // Establish the surface status auto surfaceStatus = stepper.updateSurfaceStatus( - state.stepping, **state.navigation.navSurfaceIter, false); + state.stepping, **state.navigation.navSurfaceIter, false, *m_logger, + state.options.targetTolerance); if (surfaceStatus == Intersection3D::Status::onSurface) { // Set the current surface state.navigation.currentSurface = *state.navigation.navSurfaceIter; diff --git a/Core/include/Acts/Propagator/EigenStepper.hpp b/Core/include/Acts/Propagator/EigenStepper.hpp index bb3f98c4eae..ddff9ca821d 100644 --- a/Core/include/Acts/Propagator/EigenStepper.hpp +++ b/Core/include/Acts/Propagator/EigenStepper.hpp @@ -11,6 +11,8 @@ // Workaround for building on clang+libstdc++ #include "Acts/Utilities/detail/ReferenceWrapperAnyCompat.hpp" +#include "Acts/Definitions/Algebra.hpp" +#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Definitions/Units.hpp" #include "Acts/EventData/TrackParameters.hpp" #include "Acts/MagneticField/MagneticFieldProvider.hpp" @@ -68,7 +70,6 @@ class EigenStepper { /// @param [in] par The track parameters at start /// @param [in] ndir The navigation direction w.r.t momentum /// @param [in] ssize is the maximum step size - /// @param [in] stolerance is the stepping tolerance /// /// @note the covariance matrix is copied when needed template @@ -76,12 +77,10 @@ class EigenStepper { MagneticFieldProvider::Cache fieldCacheIn, const SingleBoundTrackParameters& par, Direction ndir = Direction::Forward, - double ssize = std::numeric_limits::max(), - double stolerance = s_onSurfaceTolerance) + double ssize = std::numeric_limits::max()) : absCharge(std::abs(par.charge())), navDir(ndir), stepSize(ndir * std::abs(ssize)), - tolerance(stolerance), fieldCache(std::move(fieldCacheIn)), geoContext(gctx) { pars.template segment<3>(eFreePos0) = par.position(gctx); @@ -135,9 +134,6 @@ class EigenStepper { /// Last performed step (for overstep limit calculation) double previousStepSize = 0.; - /// The tolerance for the stepping - double tolerance = s_onSurfaceTolerance; - /// This caches the current magnetic field cell and stays /// (and interpolates) within it as long as this is valid. /// See step() code for details. @@ -172,8 +168,7 @@ class EigenStepper { std::reference_wrapper mctx, const SingleBoundTrackParameters& par, Direction navDir = Direction::Forward, - double ssize = std::numeric_limits::max(), - double stolerance = s_onSurfaceTolerance) const; + double ssize = std::numeric_limits::max()) const; /// @brief Resets the state /// @@ -254,11 +249,13 @@ class EigenStepper { /// @param [in] surface The surface provided /// @param [in] bcheck The boundary check for this status update /// @param [in] logger A @c Logger instance + /// @param [in] surfaceTolerance Surface tolerance used for intersection Intersection3D::Status updateSurfaceStatus( State& state, const Surface& surface, const BoundaryCheck& bcheck, - const Logger& logger = getDummyLogger()) const { + const Logger& logger = getDummyLogger(), + ActsScalar surfaceTolerance = s_onSurfaceTolerance) const { return detail::updateSingleSurfaceStatus( - *this, state, surface, bcheck, logger); + *this, state, surface, bcheck, logger, surfaceTolerance); } /// Update step size diff --git a/Core/include/Acts/Propagator/EigenStepper.ipp b/Core/include/Acts/Propagator/EigenStepper.ipp index e15f0982dae..5ddeeff3eb5 100644 --- a/Core/include/Acts/Propagator/EigenStepper.ipp +++ b/Core/include/Acts/Propagator/EigenStepper.ipp @@ -20,8 +20,8 @@ auto Acts::EigenStepper::makeState( std::reference_wrapper gctx, std::reference_wrapper mctx, const SingleBoundTrackParameters& par, Direction navDir, - double ssize, double stolerance) const -> State { - return State{gctx, m_bField->makeCache(mctx), par, navDir, ssize, stolerance}; + double ssize) const -> State { + return State{gctx, m_bField->makeCache(mctx), par, navDir, ssize}; } template diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp index 6f81fd77e3d..d53c278e2e0 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp @@ -299,7 +299,6 @@ class MultiEigenStepperLoop /// @param [in] multipars The track multi-component track-parameters at start /// @param [in] ndir The navigation direction w.r.t momentum /// @param [in] ssize is the maximum step size - /// @param [in] stolerance is the stepping tolerance /// /// @note the covariance matrix is copied when needed template @@ -308,8 +307,7 @@ class MultiEigenStepperLoop const std::shared_ptr& bfield, const MultiComponentBoundTrackParameters& multipars, Direction ndir = Direction::Forward, - double ssize = std::numeric_limits::max(), - double stolerance = s_onSurfaceTolerance) + double ssize = std::numeric_limits::max()) : navDir(ndir), geoContext(gctx), magContext(mctx) { if (multipars.components().empty()) { throw std::invalid_argument( @@ -321,10 +319,9 @@ class MultiEigenStepperLoop for (auto i = 0ul; i < multipars.components().size(); ++i) { const auto [weight, singlePars] = multipars[i]; - components.push_back( - {SingleState(gctx, bfield->makeCache(mctx), std::move(singlePars), - ndir, ssize, stolerance), - weight, Intersection3D::Status::onSurface}); + components.push_back({SingleState(gctx, bfield->makeCache(mctx), + std::move(singlePars), ndir, ssize), + weight, Intersection3D::Status::onSurface}); } if (std::get<2>(multipars.components().front())) { @@ -339,10 +336,8 @@ class MultiEigenStepperLoop std::reference_wrapper mctx, const MultiComponentBoundTrackParameters& par, Direction navDir = Direction::Forward, - double ssize = std::numeric_limits::max(), - double stolerance = s_onSurfaceTolerance) const { - return State(gctx, mctx, SingleStepper::m_bField, par, navDir, ssize, - stolerance); + double ssize = std::numeric_limits::max()) const { + return State(gctx, mctx, SingleStepper::m_bField, par, navDir, ssize); } /// @brief Resets the state @@ -690,17 +685,19 @@ class MultiEigenStepperLoop /// @param state [in,out] The stepping state (thread-local cache) /// @param surface [in] The surface provided /// @param bcheck [in] The boundary check for this status update - /// @param logger [in] A @c Loggerinstance + /// @param logger [in] A @c Logger instance + /// @param [in] surfaceTolerance Surface tolerance used for intersection Intersection3D::Status updateSurfaceStatus( State& state, const Surface& surface, const BoundaryCheck& bcheck, - const Logger& logger = getDummyLogger()) const { + const Logger& logger = getDummyLogger(), + ActsScalar surfaceTolerance = s_onSurfaceTolerance) const { using Status = Intersection3D::Status; std::array counts = {0, 0, 0, 0}; for (auto& component : state.components) { component.status = detail::updateSingleSurfaceStatus( - *this, component.state, surface, bcheck, logger); + *this, component.state, surface, bcheck, logger, surfaceTolerance); ++counts[static_cast(component.status)]; } diff --git a/Core/include/Acts/Propagator/MultiStepperAborters.hpp b/Core/include/Acts/Propagator/MultiStepperAborters.hpp index c92d1adf1f8..5b691995900 100644 --- a/Core/include/Acts/Propagator/MultiStepperAborters.hpp +++ b/Core/include/Acts/Propagator/MultiStepperAborters.hpp @@ -80,11 +80,11 @@ struct MultiStepperSurfaceReached { if (averageOnSurface) { const auto sIntersection = targetSurface.intersect( state.geoContext, stepper.position(state.stepping), - state.stepping.navDir * stepper.direction(state.stepping), true); + state.stepping.navDir * stepper.direction(state.stepping), true, + averageOnSurfaceTolerance); if (sIntersection.intersection.status == - Intersection3D::Status::onSurface or - sIntersection.intersection.pathLength < averageOnSurfaceTolerance) { + Intersection3D::Status::onSurface) { ACTS_VERBOSE("Reached target in average mode"); navigator.currentSurface(state.navigation, &targetSurface); navigator.targetReached(state.navigation, true); diff --git a/Core/include/Acts/Propagator/Navigator.hpp b/Core/include/Acts/Propagator/Navigator.hpp index 0ee68466553..6f7b561c5fb 100644 --- a/Core/include/Acts/Propagator/Navigator.hpp +++ b/Core/include/Acts/Propagator/Navigator.hpp @@ -623,7 +623,8 @@ class Navigator { // If we are on the surface pointed at by the index, we can make // it the current one to pass it to the other actors auto surfaceStatus = - stepper.updateSurfaceStatus(state.stepping, *surface, true, logger()); + stepper.updateSurfaceStatus(state.stepping, *surface, true, logger(), + state.options.targetTolerance); if (surfaceStatus == Intersection3D::Status::onSurface) { ACTS_VERBOSE(volInfo(state) << "Status Surface successfully hit, storing it."); @@ -712,8 +713,9 @@ class Navigator { break; } } - auto surfaceStatus = stepper.updateSurfaceStatus(state.stepping, *surface, - boundaryCheck, logger()); + auto surfaceStatus = + stepper.updateSurfaceStatus(state.stepping, *surface, boundaryCheck, + logger(), state.options.targetTolerance); if (surfaceStatus == Intersection3D::Status::reachable) { ACTS_VERBOSE(volInfo(state) << "Surface reachable, step size updated to " @@ -876,8 +878,9 @@ class Navigator { } } // Try to step towards it - auto layerStatus = stepper.updateSurfaceStatus( - state.stepping, *layerSurface, true, logger()); + auto layerStatus = + stepper.updateSurfaceStatus(state.stepping, *layerSurface, true, + logger(), state.options.targetTolerance); if (layerStatus == Intersection3D::Status::reachable) { ACTS_VERBOSE(volInfo(state) << "Layer reachable, step size updated to " << stepper.outputStepSize(state.stepping)); @@ -1017,8 +1020,9 @@ class Navigator { // That is the current boundary surface auto boundarySurface = state.navigation.navBoundary().representation; // Step towards the boundary surfrace - auto boundaryStatus = stepper.updateSurfaceStatus( - state.stepping, *boundarySurface, true, logger()); + auto boundaryStatus = + stepper.updateSurfaceStatus(state.stepping, *boundarySurface, true, + logger(), state.options.targetTolerance); if (boundaryStatus == Intersection3D::Status::reachable) { ACTS_VERBOSE(volInfo(state) << "Boundary reachable, step size updated to " @@ -1169,7 +1173,7 @@ class Navigator { stepper.getStepSize(state.stepping, ConstrainedStep::aborter); // No overstepping on start layer, otherwise ask the stepper navOpts.overstepLimit = (cLayer != nullptr) - ? s_onSurfaceTolerance + ? state.options.targetTolerance : stepper.overstepLimit(state.stepping); // get the surfaces @@ -1315,7 +1319,8 @@ class Navigator { return true; } auto targetStatus = stepper.updateSurfaceStatus( - state.stepping, *state.navigation.targetSurface, true, logger()); + state.stepping, *state.navigation.targetSurface, true, logger(), + state.options.targetTolerance); // the only advance could have been to the target if (targetStatus == Intersection3D::Status::onSurface) { // set the target surface diff --git a/Core/include/Acts/Propagator/Propagator.ipp b/Core/include/Acts/Propagator/Propagator.ipp index 2fc87fc92fd..6bd69a628d7 100644 --- a/Core/include/Acts/Propagator/Propagator.ipp +++ b/Core/include/Acts/Propagator/Propagator.ipp @@ -146,8 +146,7 @@ auto Acts::Propagator::propagate( StateType state{ eOptions, m_stepper.makeState(eOptions.geoContext, eOptions.magFieldContext, start, - eOptions.direction, eOptions.maxStepSize, - eOptions.tolerance), + eOptions.direction, eOptions.maxStepSize), m_navigator.makeState(&start.referenceSurface(), nullptr)}; static_assert( @@ -233,8 +232,7 @@ auto Acts::Propagator::propagate( StateType state{ eOptions, m_stepper.makeState(eOptions.geoContext, eOptions.magFieldContext, start, - eOptions.direction, eOptions.maxStepSize, - eOptions.tolerance), + eOptions.direction, eOptions.maxStepSize), m_navigator.makeState(&start.referenceSurface(), &target)}; static_assert( diff --git a/Core/include/Acts/Propagator/StepperConcept.hpp b/Core/include/Acts/Propagator/StepperConcept.hpp index 4a65fc1579b..88430a44171 100644 --- a/Core/include/Acts/Propagator/StepperConcept.hpp +++ b/Core/include/Acts/Propagator/StepperConcept.hpp @@ -128,7 +128,7 @@ constexpr bool MultiStepperStateConcept= require< constexpr static bool covariance_transport_exists = require, has_method>; static_assert(covariance_transport_exists, "covarianceTransport method not found"); - constexpr static bool update_surface_exists = has_method; + constexpr static bool update_surface_exists = has_method; static_assert(update_surface_exists, "updateSurfaceStatus method not found"); constexpr static bool set_step_size_exists = has_method; static_assert(set_step_size_exists, "setStepSize method not found"); diff --git a/Core/include/Acts/Propagator/StraightLineStepper.hpp b/Core/include/Acts/Propagator/StraightLineStepper.hpp index 3b7bb9d1f6a..d9a01fcb979 100644 --- a/Core/include/Acts/Propagator/StraightLineStepper.hpp +++ b/Core/include/Acts/Propagator/StraightLineStepper.hpp @@ -244,11 +244,13 @@ class StraightLineStepper { /// @param [in] surface The surface provided /// @param [in] bcheck The boundary check for this status update /// @param [in] logger A logger instance + /// @param [in] surfaceTolerance Surface tolerance used for intersection Intersection3D::Status updateSurfaceStatus( State& state, const Surface& surface, const BoundaryCheck& bcheck, - const Logger& logger = getDummyLogger()) const { + const Logger& logger = getDummyLogger(), + ActsScalar surfaceTolerance = s_onSurfaceTolerance) const { return detail::updateSingleSurfaceStatus( - *this, state, surface, bcheck, logger); + *this, state, surface, bcheck, logger, surfaceTolerance); } /// Update step size diff --git a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp index aaa9fd8c67a..53d95cd995d 100644 --- a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp +++ b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp @@ -9,6 +9,7 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" +#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Surfaces/BoundaryCheck.hpp" #include "Acts/Surfaces/Surface.hpp" @@ -32,13 +33,14 @@ namespace detail { template Acts::Intersection3D::Status updateSingleSurfaceStatus( const stepper_t& stepper, typename stepper_t::State& state, - const Surface& surface, const BoundaryCheck& bcheck, const Logger& logger) { + const Surface& surface, const BoundaryCheck& bcheck, const Logger& logger, + ActsScalar surfaceTolerance) { ACTS_VERBOSE( "Update single surface status for surface: " << surface.geometryId()); - auto sIntersection = - surface.intersect(state.geoContext, stepper.position(state), - state.navDir * stepper.direction(state), bcheck); + auto sIntersection = surface.intersect( + state.geoContext, stepper.position(state), + state.navDir * stepper.direction(state), bcheck, surfaceTolerance); // The intersection is on surface already if (sIntersection.intersection.status == Intersection3D::Status::onSurface) { @@ -53,7 +55,7 @@ Acts::Intersection3D::Status updateSingleSurfaceStatus( // If either of the two intersections are viable return reachable if (detail::checkIntersection(sIntersection.intersection, pLimit, oLimit, - s_onSurfaceTolerance, logger)) { + surfaceTolerance, logger)) { ACTS_VERBOSE("Surface is reachable"); stepper.setStepSize(state, state.navDir * sIntersection.intersection.pathLength); @@ -62,7 +64,7 @@ Acts::Intersection3D::Status updateSingleSurfaceStatus( if (sIntersection.alternative and detail::checkIntersection(sIntersection.alternative, pLimit, oLimit, - s_onSurfaceTolerance, logger)) { + surfaceTolerance, logger)) { ACTS_VERBOSE("Surface is reachable"); stepper.setStepSize(state, state.navDir * sIntersection.alternative.pathLength); diff --git a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp index 9642e04aa9f..015e9bce520 100644 --- a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp +++ b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp @@ -1167,7 +1167,8 @@ class CombinatorialKalmanFilter { auto target = [&](const FreeVector& freeVector) -> SurfaceIntersection { return targetSurface->intersect( state.geoContext, freeVector.segment<3>(eFreePos0), - state.stepping.navDir * freeVector.segment<3>(eFreeDir0), true); + state.stepping.navDir * freeVector.segment<3>(eFreeDir0), true, + state.options.targetTolerance); }; // The smoothed free params at the first/last measurement state diff --git a/Core/include/Acts/TrackFitting/KalmanFitter.hpp b/Core/include/Acts/TrackFitting/KalmanFitter.hpp index cd9e547acaa..f5ce5306332 100644 --- a/Core/include/Acts/TrackFitting/KalmanFitter.hpp +++ b/Core/include/Acts/TrackFitting/KalmanFitter.hpp @@ -924,7 +924,8 @@ class KalmanFitter { auto target = [&](const FreeVector& freeVector) -> SurfaceIntersection { return targetSurface->intersect( state.geoContext, freeVector.segment<3>(eFreePos0), - state.stepping.navDir * freeVector.segment<3>(eFreeDir0), true); + state.stepping.navDir * freeVector.segment<3>(eFreeDir0), true, + state.options.targetTolerance); }; // The smoothed free params at the first/last measurement state. diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp index 30e1788f7fb..efffdff8232 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -157,6 +157,7 @@ Acts::Polyhedron Acts::DiscSurface::polyhedronRepresentation( bool toCenter = m_bounds->rMin() < s_onSurfaceTolerance; // If you have bounds you can create a polyhedron representation bool exactPolyhedron = (m_bounds->type() == SurfaceBounds::eDiscTrapezoid); + bool addCentreFromConvexFace = (m_bounds->type() != SurfaceBounds::eAnnulus); if (m_bounds) { auto vertices2D = m_bounds->vertices(lseg); vertices.reserve(vertices2D.size() + 1); @@ -167,11 +168,12 @@ Acts::Polyhedron Acts::DiscSurface::polyhedronRepresentation( } // These are convex shapes, use the helper method // For rings there's a sweet spot when this stops working - if (m_bounds->type() == SurfaceBounds::eDiscTrapezoid or toCenter or - not fullDisc) { + if (exactPolyhedron or toCenter or not fullDisc) { // Transform them into the vertex frame wCenter *= 1. / vertices.size(); - vertices.push_back(wCenter); + if (addCentreFromConvexFace) { + vertices.push_back(wCenter); + } auto facesMesh = detail::FacesHelper::convexFaceMesh(vertices, true); faces = facesMesh.first; triangularMesh = facesMesh.second; diff --git a/Examples/Python/tests/root_file_hashes.txt b/Examples/Python/tests/root_file_hashes.txt index 9e3979408b2..f3f8ad65001 100644 --- a/Examples/Python/tests/root_file_hashes.txt +++ b/Examples/Python/tests/root_file_hashes.txt @@ -35,9 +35,9 @@ test_truth_tracking_kalman[odd-1000.0]__trackstates_fitter.root: 11f863960ba24d3 test_truth_tracking_kalman[odd-1000.0]__tracksummary_fitter.root: fcad595e4062157fa6f2c871ca31d203aa85dced26ed92dc286b61c571314123 test_truth_tracking_kalman[odd-1000.0]__performance_track_finder.root: 39aec6316cceb90e314e16b02947faa691c18f57c3a851a25e547a8fc05a4593 test_truth_tracking_gsf[generic]__trackstates_gsf.root: 787294f42fadbd14827ae47133ba90d657999fa815df3fa01e3ddc3c0709d880 -test_truth_tracking_gsf[generic]__tracksummary_gsf.root: 02716bc62040c6aeca132a515351a8247f56915faedca71abfb15d142cb2409f +test_truth_tracking_gsf[generic]__tracksummary_gsf.root: 3229442f127c05f9f1d9111c85df65147a5ef285ff473f102da4221e6354bd73 test_truth_tracking_gsf[odd]__trackstates_gsf.root: 8ea8bdeda5ba2d4fbedd5b25b1d9f01a47980f9ae5398ad157b40ec5fa070cda -test_truth_tracking_gsf[odd]__tracksummary_gsf.root: b09a5f16d77527e5c26185325b1fdcb63a96b6fdf23648c76d6f55050c7402a4 +test_truth_tracking_gsf[odd]__tracksummary_gsf.root: 2e57260b989a973153050d8931d05451b7b5f7aabbfa56fa40d964734a7f5d82 test_particle_gun__particles.root: 8549ba6e20338004ab8ba299fc65e1ee5071985b46df8f77f887cb6fef56a8ec test_material_mapping__material-map_tracks.root: 4e1c866038f0c06b099aa74fd01c3d875f07b89f54898f90debd9b558d8e4025 test_material_mapping__propagation-material.root: 646b8e2bbacec40d0bc4132236f9ab3f03b088e656e6e9b80c47ae03eaf6eab5 diff --git a/Tests/IntegrationTests/PropagationAtlasConstant.cpp b/Tests/IntegrationTests/PropagationAtlasConstant.cpp index a72462e4d57..912f604aa65 100644 --- a/Tests/IntegrationTests/PropagationAtlasConstant.cpp +++ b/Tests/IntegrationTests/PropagationAtlasConstant.cpp @@ -15,6 +15,7 @@ #include "Acts/Propagator/AtlasStepper.hpp" #include "Acts/Propagator/Propagator.hpp" #include "Acts/Propagator/RiddersPropagator.hpp" +#include "Acts/Utilities/Logger.hpp" #include diff --git a/Tests/IntegrationTests/PropagationTests.hpp b/Tests/IntegrationTests/PropagationTests.hpp index 6e7bf6d7729..3d0ab9a9092 100644 --- a/Tests/IntegrationTests/PropagationTests.hpp +++ b/Tests/IntegrationTests/PropagationTests.hpp @@ -253,7 +253,8 @@ inline std::pair transportFreely( options_t options(geoCtx, magCtx); options.direction = Acts::Direction::fromScalar(pathLength); options.pathLimit = pathLength; - options.maxStepSize = 1_cm; + options.targetTolerance = 1_nm; + options.tolerance = 1_nm; auto result = propagator.propagate(initialParams, options); BOOST_CHECK(result.ok()); @@ -280,7 +281,8 @@ inline std::pair transportToSurface( options_t options(geoCtx, magCtx); options.direction = Acts::Direction::Forward; options.pathLimit = pathLimit; - options.maxStepSize = 0.9_cm; + options.targetTolerance = 1_nm; + options.tolerance = 1_nm; auto result = propagator.propagate(initialParams, targetSurface, options); BOOST_CHECK(result.ok()); diff --git a/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp b/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp index 96bf702aec5..49aff99e094 100644 --- a/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp @@ -63,7 +63,6 @@ using MultiStepperLoop = using SingleStepper = EigenStepper>; const double defaultStepSize = 123.; -const double defaultTolerance = 234.; const auto defaultNDir = Direction::Backward; const auto defaultBField = @@ -144,7 +143,7 @@ void test_multi_stepper_state() { makeDefaultBoundPars(Cov, N, BoundVector::Ones()); MultiState state(geoCtx, magCtx, defaultBField, multi_pars, defaultNDir, - defaultStepSize, defaultTolerance); + defaultStepSize); MultiStepper ms(defaultBField); @@ -202,7 +201,7 @@ void test_multi_stepper_state_invalid() { const auto multi_pars = makeDefaultBoundPars(false, 0); BOOST_CHECK_THROW(MultiState(geoCtx, magCtx, defaultBField, multi_pars, - defaultNDir, defaultStepSize, defaultTolerance), + defaultNDir, defaultStepSize), std::invalid_argument); } @@ -231,10 +230,9 @@ void test_multi_stepper_vs_eigen_stepper() { SingleBoundTrackParameters single_pars(surface, pars, cov); MultiState multi_state(geoCtx, magCtx, defaultBField, multi_pars, defaultNDir, - defaultStepSize, defaultTolerance); + defaultStepSize); SingleStepper::State single_state(geoCtx, defaultBField->makeCache(magCtx), - single_pars, defaultNDir, defaultStepSize, - defaultTolerance); + single_pars, defaultNDir, defaultStepSize); MultiStepper multi_stepper(defaultBField); SingleStepper single_stepper(defaultBField); @@ -294,11 +292,9 @@ void test_components_modifying_accessors() { const auto multi_pars = makeDefaultBoundPars(); MultiState mutable_multi_state(geoCtx, magCtx, defaultBField, multi_pars, - defaultNDir, defaultStepSize, - defaultTolerance); + defaultNDir, defaultStepSize); const MultiState const_multi_state(geoCtx, magCtx, defaultBField, multi_pars, - defaultNDir, defaultStepSize, - defaultTolerance); + defaultNDir, defaultStepSize); MultiStepper multi_stepper(defaultBField); @@ -400,10 +396,10 @@ void test_multi_stepper_surface_status_update() { .isApprox(Vector3{-1.0, 0.0, 0.0}, 1.e-10)); MultiState multi_state(geoCtx, magCtx, defaultNullBField, multi_pars, - Direction::Forward, defaultStepSize, defaultTolerance); + Direction::Forward, defaultStepSize); SingleStepper::State single_state( geoCtx, defaultNullBField->makeCache(magCtx), std::get<1>(multi_pars[0]), - Direction::Forward, defaultStepSize, defaultTolerance); + Direction::Forward, defaultStepSize); MultiStepper multi_stepper(defaultNullBField); SingleStepper single_stepper(defaultNullBField); @@ -500,10 +496,10 @@ void test_component_bound_state() { .isApprox(Vector3{-1.0, 0.0, 0.0}, 1.e-10)); MultiState multi_state(geoCtx, magCtx, defaultNullBField, multi_pars, - Direction::Forward, defaultStepSize, defaultTolerance); + Direction::Forward, defaultStepSize); SingleStepper::State single_state( geoCtx, defaultNullBField->makeCache(magCtx), std::get<1>(multi_pars[0]), - Direction::Forward, defaultStepSize, defaultTolerance); + Direction::Forward, defaultStepSize); MultiStepper multi_stepper(defaultNullBField); SingleStepper single_stepper(defaultNullBField); @@ -566,7 +562,7 @@ void test_combined_bound_state_function() { MultiComponentBoundTrackParameters multi_pars(surface, cmps); MultiState multi_state(geoCtx, magCtx, defaultBField, multi_pars, defaultNDir, - defaultStepSize, defaultTolerance); + defaultStepSize); MultiStepper multi_stepper(defaultBField); auto res = multi_stepper.boundState(multi_state, *surface, true, @@ -611,7 +607,7 @@ void test_combined_curvilinear_state_function() { MultiComponentBoundTrackParameters multi_pars(surface, cmps); MultiState multi_state(geoCtx, magCtx, defaultBField, multi_pars, defaultNDir, - defaultStepSize, defaultTolerance); + defaultStepSize); MultiStepper multi_stepper(defaultBField); const auto [curv_pars, jac, pathLength] = @@ -652,7 +648,7 @@ void test_single_component_interface_function() { MultiComponentBoundTrackParameters multi_pars(surface, cmps); MultiState multi_state(geoCtx, magCtx, defaultBField, multi_pars, defaultNDir, - defaultStepSize, defaultTolerance); + defaultStepSize); MultiStepper multi_stepper(defaultBField); @@ -697,7 +693,7 @@ void remove_add_components_function() { const auto multi_pars = makeDefaultBoundPars(4); MultiState multi_state(geoCtx, magCtx, defaultBField, multi_pars, defaultNDir, - defaultStepSize, defaultTolerance); + defaultStepSize); MultiStepper multi_stepper(defaultBField); diff --git a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp index 5ffdd359774..6e386cc58f6 100644 --- a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp +++ b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp @@ -145,12 +145,11 @@ struct PropagatorState { return s_onSurfaceTolerance; } - Intersection3D::Status updateSurfaceStatus(State& state, - const Surface& surface, - const BoundaryCheck& bcheck, - const Logger& logger) const { - return detail::updateSingleSurfaceStatus(*this, state, surface, - bcheck, logger); + Intersection3D::Status updateSurfaceStatus( + State& state, const Surface& surface, const BoundaryCheck& bcheck, + const Logger& logger, ActsScalar surfaceTolerance) const { + return detail::updateSingleSurfaceStatus( + *this, state, surface, bcheck, logger, surfaceTolerance); } template diff --git a/Tests/UnitTests/Core/Propagator/StepperTests.cpp b/Tests/UnitTests/Core/Propagator/StepperTests.cpp index 02ee7daf2ec..7de4d4e674c 100644 --- a/Tests/UnitTests/Core/Propagator/StepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/StepperTests.cpp @@ -184,7 +184,6 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_state_test) { // Set up some variables Direction navDir = Direction::Backward; double stepSize = 123.; - double tolerance = 234.; auto bField = std::make_shared(Vector3(1., 2.5, 33.33)); Vector3 pos(1., 2., 3.); @@ -196,7 +195,7 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_state_test) { // Test charged parameters without covariance matrix CurvilinearTrackParameters cp(makeVector4(pos, time), dir, charge / absMom); EigenStepper<>::State esState(tgContext, bField->makeCache(mfContext), cp, - navDir, stepSize, tolerance); + navDir, stepSize); EigenStepper<> es(bField); @@ -210,13 +209,12 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_state_test) { BOOST_CHECK_EQUAL(esState.pathAccumulated, 0.); BOOST_CHECK_EQUAL(esState.stepSize.value(), navDir * stepSize); BOOST_CHECK_EQUAL(esState.previousStepSize, 0.); - BOOST_CHECK_EQUAL(esState.tolerance, tolerance); // Test without charge and covariance matrix NeutralCurvilinearTrackParameters ncp(makeVector4(pos, time), dir, 1 / absMom); esState = EigenStepper<>::State(tgContext, bField->makeCache(mfContext), ncp, - navDir, stepSize, tolerance); + navDir, stepSize); BOOST_CHECK_EQUAL(es.charge(esState), 0.); // Test with covariance matrix @@ -224,7 +222,7 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_state_test) { ncp = NeutralCurvilinearTrackParameters(makeVector4(pos, time), dir, 1 / absMom, cov); esState = EigenStepper<>::State(tgContext, bField->makeCache(mfContext), ncp, - navDir, stepSize, tolerance); + navDir, stepSize); BOOST_CHECK_NE(esState.jacToGlobal, BoundToFreeMatrix::Zero()); BOOST_CHECK(esState.covTransport); BOOST_CHECK_EQUAL(esState.cov, cov); @@ -236,7 +234,6 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { // Set up some variables for the state Direction navDir = Direction::Backward; double stepSize = 123.; - double tolerance = 234.; auto bField = std::make_shared(Vector3(1., 2.5, 33.33)); auto bCache = bField->makeCache(mfContext); @@ -252,7 +249,7 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { // Build the state and the stepper EigenStepper<>::State esState(tgContext, bField->makeCache(mfContext), cp, - navDir, stepSize, tolerance); + navDir, stepSize); EigenStepper<> es(bField); // Test the getters @@ -261,7 +258,6 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { CHECK_CLOSE_ABS(es.absoluteMomentum(esState), absMom, eps); CHECK_CLOSE_ABS(es.charge(esState), charge, eps); CHECK_CLOSE_ABS(es.time(esState), time, eps); - //~ BOOST_CHECK_EQUAL(es.overstepLimit(esState), tolerance); BOOST_CHECK_EQUAL(es.getField(esState, pos).value(), bField->getField(pos, bCache).value()); @@ -351,7 +347,7 @@ 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, navDir, stepSize, tolerance); + cp, navDir, stepSize); copy.pars = state.pars; copy.absCharge = state.absCharge; copy.covTransport = state.covTransport; @@ -364,7 +360,6 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { copy.pathAccumulated = state.pathAccumulated; copy.stepSize = state.stepSize; copy.previousStepSize = state.previousStepSize; - copy.tolerance = state.tolerance; copy.fieldCache = MagneticFieldProvider::Cache::make( @@ -402,7 +397,6 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { BOOST_CHECK_EQUAL(esStateCopy.pathAccumulated, 0.); BOOST_CHECK_EQUAL(esStateCopy.stepSize.value(), navDir * stepSize2); BOOST_CHECK_EQUAL(esStateCopy.previousStepSize, ps.stepping.previousStepSize); - BOOST_CHECK_EQUAL(esStateCopy.tolerance, ps.stepping.tolerance); // Reset all possible parameters except the step size esStateCopy = copyState(*bField, ps.stepping); @@ -428,7 +422,6 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { BOOST_CHECK_EQUAL(esStateCopy.stepSize.value(), std::numeric_limits::max()); BOOST_CHECK_EQUAL(esStateCopy.previousStepSize, ps.stepping.previousStepSize); - BOOST_CHECK_EQUAL(esStateCopy.tolerance, ps.stepping.tolerance); // Reset the least amount of parameters esStateCopy = copyState(*bField, ps.stepping); @@ -454,7 +447,6 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { BOOST_CHECK_EQUAL(esStateCopy.stepSize.value(), std::numeric_limits::max()); BOOST_CHECK_EQUAL(esStateCopy.previousStepSize, ps.stepping.previousStepSize); - BOOST_CHECK_EQUAL(esStateCopy.tolerance, ps.stepping.tolerance); /// Repeat with surface related methods auto plane = Surface::makeShared(pos, dir.normalized()); @@ -463,7 +455,7 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { dir, charge / absMom, cov) .value(); esState = EigenStepper<>::State(tgContext, bField->makeCache(mfContext), cp, - navDir, stepSize, tolerance); + navDir, stepSize); // Test the intersection in the context of a surface auto targetSurface = @@ -533,7 +525,7 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { auto nBfield = std::make_shared(); EigenStepper<> nes(nBfield); EigenStepper<>::State nesState(tgContext, nBfield->makeCache(mfContext), cp, - navDir, stepSize, tolerance); + navDir, stepSize); PropState nps(copyState(*nBfield, nesState)); // Test that we can reach the minimum step size nps.options.tolerance = 1e-21;