From 195dca3f46b12800f3f2ea408c905fa840be42fe Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Sat, 23 Nov 2024 22:54:43 +0100 Subject: [PATCH] refactor!: Single type/alias for intersection status (#3898) Seems more concise and consistent --- .../Acts/Navigation/DetectorNavigator.hpp | 4 +- .../Acts/Navigation/NavigationStream.hpp | 2 +- Core/include/Acts/Propagator/AtlasStepper.hpp | 2 +- .../Acts/Propagator/DirectNavigator.hpp | 12 ++-- Core/include/Acts/Propagator/EigenStepper.hpp | 2 +- .../Acts/Propagator/MultiEigenStepperLoop.hpp | 12 ++-- .../Acts/Propagator/MultiEigenStepperLoop.ipp | 9 ++- .../Acts/Propagator/MultiStepperAborters.hpp | 8 +-- Core/include/Acts/Propagator/Navigator.hpp | 10 +-- .../Acts/Propagator/StandardAborters.hpp | 2 +- .../Acts/Propagator/StraightLineStepper.hpp | 2 +- Core/include/Acts/Propagator/SympyStepper.hpp | 2 +- .../Acts/Propagator/TryAllNavigator.hpp | 8 +-- .../Acts/Propagator/detail/SteppingHelper.hpp | 10 +-- .../Acts/Surfaces/detail/PlanarHelper.hpp | 6 +- .../Acts/TrackFitting/GaussianSumFitter.hpp | 3 +- .../Acts/TrackFitting/detail/GsfActor.hpp | 31 ++++----- Core/include/Acts/Utilities/Intersection.hpp | 23 +++---- Core/src/Surfaces/ConeSurface.cpp | 16 ++--- Core/src/Surfaces/CylinderSurface.cpp | 22 +++--- Core/src/Surfaces/DiscSurface.cpp | 6 +- Core/src/Surfaces/IntersectionHelper2D.cpp | 18 ++--- Core/src/Surfaces/LineSurface.cpp | 8 +-- Core/src/Surfaces/PlaneSurface.cpp | 4 +- Core/src/Utilities/Intersection.cpp | 2 + .../Core/Propagator/MultiStepperTests.cpp | 20 +++--- .../Core/Propagator/NavigatorTests.cpp | 2 +- .../Core/Surfaces/CylinderSurfaceTests.cpp | 2 +- .../Core/Surfaces/DiscSurfaceTests.cpp | 2 +- .../Core/Surfaces/PlaneSurfaceTests.cpp | 2 +- .../Surfaces/SurfaceIntersectionTests.cpp | 67 +++++++------------ Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp | 2 +- .../Core/Utilities/IntersectionTests.cpp | 55 +++++++-------- 33 files changed, 169 insertions(+), 207 deletions(-) diff --git a/Core/include/Acts/Navigation/DetectorNavigator.hpp b/Core/include/Acts/Navigation/DetectorNavigator.hpp index 0ffcf1446bc..3bc324e187f 100644 --- a/Core/include/Acts/Navigation/DetectorNavigator.hpp +++ b/Core/include/Acts/Navigation/DetectorNavigator.hpp @@ -223,7 +223,7 @@ class DetectorNavigator { ACTS_VERBOSE(volInfo(state) << posInfo(state, stepper) << "surface status is " << surfaceStatus); - if (surfaceStatus == Intersection3D::Status::reachable) { + if (surfaceStatus == IntersectionStatus::reachable) { ACTS_VERBOSE(volInfo(state) << posInfo(state, stepper) << "surface " << surface.center(state.geoContext).transpose() @@ -292,7 +292,7 @@ class DetectorNavigator { state.options.surfaceTolerance, logger()); // Check if we are at a surface - if (surfaceStatus == Intersection3D::Status::onSurface) { + if (surfaceStatus == IntersectionStatus::onSurface) { ACTS_VERBOSE(volInfo(state) << posInfo(state, stepper) << "landed on surface"); diff --git a/Core/include/Acts/Navigation/NavigationStream.hpp b/Core/include/Acts/Navigation/NavigationStream.hpp index 97e154214d7..d579c0d7392 100644 --- a/Core/include/Acts/Navigation/NavigationStream.hpp +++ b/Core/include/Acts/Navigation/NavigationStream.hpp @@ -9,13 +9,13 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" +#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/Geometry/Portal.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Utilities/Intersection.hpp" #include -#include #include namespace Acts { diff --git a/Core/include/Acts/Propagator/AtlasStepper.hpp b/Core/include/Acts/Propagator/AtlasStepper.hpp index 88cfd39e548..50fd78de145 100644 --- a/Core/include/Acts/Propagator/AtlasStepper.hpp +++ b/Core/include/Acts/Propagator/AtlasStepper.hpp @@ -419,7 +419,7 @@ class AtlasStepper { /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection /// @param [in] logger Logger instance to use - Intersection3D::Status updateSurfaceStatus( + IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance = s_onSurfaceTolerance, diff --git a/Core/include/Acts/Propagator/DirectNavigator.hpp b/Core/include/Acts/Propagator/DirectNavigator.hpp index 3356ab395c4..d2f66468168 100644 --- a/Core/include/Acts/Propagator/DirectNavigator.hpp +++ b/Core/include/Acts/Propagator/DirectNavigator.hpp @@ -9,20 +9,18 @@ #pragma once #include "Acts/Definitions/Direction.hpp" -#include "Acts/Geometry/BoundarySurfaceT.hpp" +#include "Acts/Definitions/Units.hpp" #include "Acts/Geometry/Layer.hpp" #include "Acts/Geometry/TrackingGeometry.hpp" #include "Acts/Geometry/TrackingVolume.hpp" +#include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/NavigatorOptions.hpp" #include "Acts/Propagator/NavigatorStatistics.hpp" -#include "Acts/Propagator/Propagator.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Logger.hpp" -#include -#include #include #include #include @@ -259,7 +257,7 @@ class DirectNavigator { state.stepping, surface, index, state.options.direction, BoundaryTolerance::Infinite(), state.options.surfaceTolerance, *m_logger); - if (surfaceStatus == Intersection3D::Status::unreachable) { + if (surfaceStatus == IntersectionStatus::unreachable) { ACTS_VERBOSE( "Surface not reachable anymore, switching to next one in " "sequence"); @@ -313,7 +311,7 @@ class DirectNavigator { state.stepping, surface, index, state.options.direction, BoundaryTolerance::Infinite(), state.options.surfaceTolerance, *m_logger); - if (surfaceStatus == Intersection3D::Status::onSurface) { + if (surfaceStatus == IntersectionStatus::onSurface) { // Set the current surface state.navigation.currentSurface = state.navigation.navSurface(); ACTS_VERBOSE("Current surface set to " @@ -326,7 +324,7 @@ class DirectNavigator { .at(state.navigation.surfaceIndex) ->geometryId()); } - } else if (surfaceStatus == Intersection3D::Status::reachable) { + } else if (surfaceStatus == IntersectionStatus::reachable) { ACTS_VERBOSE("Next surface reachable at distance " << stepper.outputStepSize(state.stepping)); } diff --git a/Core/include/Acts/Propagator/EigenStepper.hpp b/Core/include/Acts/Propagator/EigenStepper.hpp index 09df3ce3167..47f2db687b6 100644 --- a/Core/include/Acts/Propagator/EigenStepper.hpp +++ b/Core/include/Acts/Propagator/EigenStepper.hpp @@ -270,7 +270,7 @@ class EigenStepper { /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection /// @param [in] logger A @c Logger instance - Intersection3D::Status updateSurfaceStatus( + IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance = s_onSurfaceTolerance, diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp index e21bdb2365e..dff30746cf6 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp @@ -197,7 +197,7 @@ class MultiEigenStepperLoop : public EigenStepper { struct Component { SingleState state; ActsScalar weight; - Intersection3D::Status status; + IntersectionStatus status; }; /// Particle hypothesis @@ -255,7 +255,7 @@ class MultiEigenStepperLoop : public EigenStepper { const auto& [weight, singlePars] = multipars[i]; components.push_back( {SingleState(gctx, bfield->makeCache(mctx), singlePars, ssize), - weight, Intersection3D::Status::onSurface}); + weight, IntersectionStatus::onSurface}); } if (std::get<2>(multipars.components().front())) { @@ -398,7 +398,7 @@ class MultiEigenStepperLoop : public EigenStepper { void removeMissedComponents(State& state) const { auto new_end = std::remove_if( state.components.begin(), state.components.end(), [](const auto& cmp) { - return cmp.status == Intersection3D::Status::missed; + return cmp.status == IntersectionStatus::missed; }); state.components.erase(new_end, state.components.end()); @@ -441,7 +441,7 @@ class MultiEigenStepperLoop : public EigenStepper { {SingleState(state.geoContext, SingleStepper::m_bField->makeCache(state.magContext), pars), - weight, Intersection3D::Status::onSurface}); + weight, IntersectionStatus::onSurface}); return ComponentProxy{state.components.back(), state}; } @@ -520,12 +520,12 @@ class MultiEigenStepperLoop : public EigenStepper { /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection /// @param [in] logger A @c Logger instance - Intersection3D::Status updateSurfaceStatus( + IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance = s_onSurfaceTolerance, const Logger& logger = getDummyLogger()) const { - using Status = Intersection3D::Status; + using Status = IntersectionStatus; std::array counts = {0, 0, 0}; diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp index fab3e3f0779..67aa98e94bb 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.ipp @@ -93,7 +93,7 @@ template template Result MultiEigenStepperLoop::step( propagator_state_t& state, const navigator_t& navigator) const { - using Status = Acts::Intersection3D::Status; + using Status = Acts::IntersectionStatus; State& stepping = state.stepping; auto& components = stepping.components; @@ -137,10 +137,9 @@ Result MultiEigenStepperLoop::step( // If at least one component is on a surface, we can remove all missed // components before the step. If not, we must keep them for the case that all // components miss and we need to retarget - const auto cmpsOnSurface = - std::count_if(components.cbegin(), components.cend(), [&](auto& cmp) { - return cmp.status == Intersection3D::Status::onSurface; - }); + const auto cmpsOnSurface = std::count_if( + components.cbegin(), components.cend(), + [&](auto& cmp) { return cmp.status == IntersectionStatus::onSurface; }); if (cmpsOnSurface > 0) { removeMissedComponents(stepping); diff --git a/Core/include/Acts/Propagator/MultiStepperAborters.hpp b/Core/include/Acts/Propagator/MultiStepperAborters.hpp index 0e28375df94..e42d3387e2f 100644 --- a/Core/include/Acts/Propagator/MultiStepperAborters.hpp +++ b/Core/include/Acts/Propagator/MultiStepperAborters.hpp @@ -59,12 +59,12 @@ struct MultiStepperSurfaceReached : public SurfaceReached { averageOnSurfaceTolerance) .closest(); - if (sIntersection.status() == Intersection3D::Status::onSurface) { + if (sIntersection.status() == IntersectionStatus::onSurface) { ACTS_VERBOSE( "MultiStepperSurfaceReached aborter | " "Reached target in average mode"); for (auto cmp : stepper.componentIterable(state.stepping)) { - cmp.status() = Intersection3D::Status::onSurface; + cmp.status() = IntersectionStatus::onSurface; } return true; @@ -84,10 +84,10 @@ struct MultiStepperSurfaceReached : public SurfaceReached { if (!SurfaceReached::checkAbort(singleState, singleStepper, navigator, logger)) { - cmp.status() = Acts::Intersection3D::Status::reachable; + cmp.status() = Acts::IntersectionStatus::reachable; reached = false; } else { - cmp.status() = Acts::Intersection3D::Status::onSurface; + cmp.status() = Acts::IntersectionStatus::onSurface; } } diff --git a/Core/include/Acts/Propagator/Navigator.hpp b/Core/include/Acts/Propagator/Navigator.hpp index a02e0958160..504912b507f 100644 --- a/Core/include/Acts/Propagator/Navigator.hpp +++ b/Core/include/Acts/Propagator/Navigator.hpp @@ -649,7 +649,7 @@ class Navigator { auto surfaceStatus = stepper.updateSurfaceStatus( state.stepping, *surface, intersection.index(), state.options.direction, BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); - if (surfaceStatus == Intersection3D::Status::onSurface) { + if (surfaceStatus == IntersectionStatus::onSurface) { ACTS_VERBOSE(volInfo(state) << "Status Surface successfully hit, storing it."); // Set in navigation state, so actors and aborters can access it @@ -725,7 +725,7 @@ class Navigator { state.stepping, *surface, intersection.index(), state.options.direction, boundaryTolerance, state.options.surfaceTolerance, logger()); - if (surfaceStatus == Intersection3D::Status::reachable) { + if (surfaceStatus == IntersectionStatus::reachable) { ACTS_VERBOSE(volInfo(state) << "Surface reachable, step size updated to " << stepper.outputStepSize(state.stepping)); @@ -815,7 +815,7 @@ class Navigator { state.stepping, *layerSurface, intersection.index(), state.options.direction, BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); - if (layerStatus == Intersection3D::Status::reachable) { + if (layerStatus == IntersectionStatus::reachable) { ACTS_VERBOSE(volInfo(state) << "Layer reachable, step size updated to " << stepper.outputStepSize(state.stepping)); return true; @@ -937,7 +937,7 @@ class Navigator { state.stepping, *boundarySurface, intersection.index(), state.options.direction, BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); - if (boundaryStatus == Intersection3D::Status::reachable) { + if (boundaryStatus == IntersectionStatus::reachable) { ACTS_VERBOSE(volInfo(state) << "Boundary reachable, step size updated to " << stepper.outputStepSize(state.stepping)); @@ -1160,7 +1160,7 @@ class Navigator { state.options.direction, BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); // the only advance could have been to the target - if (targetStatus == Intersection3D::Status::onSurface) { + if (targetStatus == IntersectionStatus::onSurface) { // set the target surface state.navigation.currentSurface = state.navigation.targetSurface; ACTS_VERBOSE(volInfo(state) diff --git a/Core/include/Acts/Propagator/StandardAborters.hpp b/Core/include/Acts/Propagator/StandardAborters.hpp index 706b0ce0697..271ebd85239 100644 --- a/Core/include/Acts/Propagator/StandardAborters.hpp +++ b/Core/include/Acts/Propagator/StandardAborters.hpp @@ -118,7 +118,7 @@ struct SurfaceReached { bool reached = false; - if (closest.status() == Intersection3D::Status::onSurface) { + if (closest.status() == IntersectionStatus::onSurface) { const double distance = closest.pathLength(); ACTS_VERBOSE( "SurfaceReached aborter | " diff --git a/Core/include/Acts/Propagator/StraightLineStepper.hpp b/Core/include/Acts/Propagator/StraightLineStepper.hpp index 18904797fdd..59f10b1d980 100644 --- a/Core/include/Acts/Propagator/StraightLineStepper.hpp +++ b/Core/include/Acts/Propagator/StraightLineStepper.hpp @@ -242,7 +242,7 @@ class StraightLineStepper { /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection /// @param [in] logger A logger instance - Intersection3D::Status updateSurfaceStatus( + IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance = s_onSurfaceTolerance, diff --git a/Core/include/Acts/Propagator/SympyStepper.hpp b/Core/include/Acts/Propagator/SympyStepper.hpp index 3b1a2125a41..f5773a8a409 100644 --- a/Core/include/Acts/Propagator/SympyStepper.hpp +++ b/Core/include/Acts/Propagator/SympyStepper.hpp @@ -237,7 +237,7 @@ class SympyStepper { /// @param [in] boundaryTolerance The boundary check for this status update /// @param [in] surfaceTolerance Surface tolerance used for intersection /// @param [in] logger A @c Logger instance - Intersection3D::Status updateSurfaceStatus( + IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance = s_onSurfaceTolerance, diff --git a/Core/include/Acts/Propagator/TryAllNavigator.hpp b/Core/include/Acts/Propagator/TryAllNavigator.hpp index 09f6fb25e25..7470fa0da0c 100644 --- a/Core/include/Acts/Propagator/TryAllNavigator.hpp +++ b/Core/include/Acts/Propagator/TryAllNavigator.hpp @@ -434,7 +434,7 @@ class TryAllNavigator : public TryAllNavigatorBase { const auto& intersection = candidate.intersection; const Surface& surface = *intersection.object(); - Intersection3D::Status surfaceStatus = stepper.updateSurfaceStatus( + IntersectionStatus surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, BoundaryTolerance::Infinite(), state.options.surfaceTolerance, logger()); @@ -463,7 +463,7 @@ class TryAllNavigator : public TryAllNavigatorBase { const auto& intersection = candidate.intersection; const Surface& surface = *intersection.object(); - Intersection3D::Status surfaceStatus = stepper.updateSurfaceStatus( + IntersectionStatus surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); @@ -788,7 +788,7 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { const auto& intersection = candidate.intersection; const Surface& surface = *intersection.object(); - Intersection3D::Status surfaceStatus = stepper.updateSurfaceStatus( + IntersectionStatus surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, BoundaryTolerance::Infinite(), state.options.surfaceTolerance, logger()); @@ -815,7 +815,7 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { const auto& intersection = candidate.intersection; const Surface& surface = *intersection.object(); - Intersection3D::Status surfaceStatus = stepper.updateSurfaceStatus( + IntersectionStatus surfaceStatus = stepper.updateSurfaceStatus( state.stepping, surface, intersection.index(), state.options.direction, BoundaryTolerance::None(), state.options.surfaceTolerance, logger()); diff --git a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp index c78f0ea1f51..c0589d739c7 100644 --- a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp +++ b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp @@ -32,7 +32,7 @@ namespace Acts::detail { /// @param surface [in] The surface provided /// @param boundaryTolerance [in] The boundary check for this status update template -Acts::Intersection3D::Status updateSingleSurfaceStatus( +Acts::IntersectionStatus updateSingleSurfaceStatus( const stepper_t& stepper, typename stepper_t::State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance, @@ -46,11 +46,11 @@ Acts::Intersection3D::Status updateSingleSurfaceStatus( surfaceTolerance)[index]; // The intersection is on surface already - if (sIntersection.status() == Intersection3D::Status::onSurface) { + if (sIntersection.status() == IntersectionStatus::onSurface) { // Release navigation step size state.stepSize.release(ConstrainedStep::actor); ACTS_VERBOSE("Intersection: state is ON SURFACE"); - return Intersection3D::Status::onSurface; + return IntersectionStatus::onSurface; } const double nearLimit = std::numeric_limits::lowest(); @@ -62,11 +62,11 @@ Acts::Intersection3D::Status updateSingleSurfaceStatus( ACTS_VERBOSE("Surface is reachable"); stepper.updateStepSize(state, sIntersection.pathLength(), ConstrainedStep::actor); - return Intersection3D::Status::reachable; + return IntersectionStatus::reachable; } ACTS_VERBOSE("Surface is NOT reachable"); - return Intersection3D::Status::unreachable; + return IntersectionStatus::unreachable; } /// Update the Step size - single component diff --git a/Core/include/Acts/Surfaces/detail/PlanarHelper.hpp b/Core/include/Acts/Surfaces/detail/PlanarHelper.hpp index f7b21a960aa..99e1803126f 100644 --- a/Core/include/Acts/Surfaces/detail/PlanarHelper.hpp +++ b/Core/include/Acts/Surfaces/detail/PlanarHelper.hpp @@ -35,9 +35,9 @@ inline Intersection3D intersect(const Transform3& transform, // Translate that into a path ActsScalar path = (pnormal.dot((pcenter - position))) / (denom); // Is valid hence either on surface or reachable - Intersection3D::Status status = std::abs(path) < std::abs(tolerance) - ? Intersection3D::Status::onSurface - : Intersection3D::Status::reachable; + IntersectionStatus status = std::abs(path) < std::abs(tolerance) + ? IntersectionStatus::onSurface + : IntersectionStatus::reachable; // Return the intersection return Intersection3D{(position + path * direction), path, status}; } diff --git a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp index f6c990a696d..4efcd82e4c4 100644 --- a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp +++ b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp @@ -14,6 +14,7 @@ #include "Acts/Propagator/Navigator.hpp" #include "Acts/Propagator/StandardAborters.hpp" #include "Acts/Surfaces/BoundaryTolerance.hpp" +#include "Acts/TrackFitting/GsfError.hpp" #include "Acts/TrackFitting/GsfOptions.hpp" #include "Acts/TrackFitting/detail/GsfActor.hpp" #include "Acts/Utilities/Helpers.hpp" @@ -217,7 +218,7 @@ struct GaussianSumFitter { .closest() .status(); - if (intersectionStatusStartSurface != Intersection3D::Status::onSurface) { + if (intersectionStatusStartSurface != IntersectionStatus::onSurface) { ACTS_DEBUG( "Surface intersection of start parameters WITH bound-check failed"); } diff --git a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp index 92c5529d319..eeb7636103b 100644 --- a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp +++ b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp @@ -12,14 +12,9 @@ #include "Acts/EventData/MultiComponentTrackParameters.hpp" #include "Acts/EventData/MultiTrajectory.hpp" #include "Acts/EventData/MultiTrajectoryHelpers.hpp" -#include "Acts/MagneticField/MagneticFieldProvider.hpp" -#include "Acts/Material/ISurfaceMaterial.hpp" -#include "Acts/Surfaces/CylinderSurface.hpp" +#include "Acts/Propagator/detail/PointwiseMaterialInteraction.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/TrackFitting/BetheHeitlerApprox.hpp" -#include "Acts/TrackFitting/GsfError.hpp" #include "Acts/TrackFitting/GsfOptions.hpp" -#include "Acts/TrackFitting/KalmanFitter.hpp" #include "Acts/TrackFitting/detail/GsfComponentMerging.hpp" #include "Acts/TrackFitting/detail/GsfUtils.hpp" #include "Acts/TrackFitting/detail/KalmanUpdateHelpers.hpp" @@ -28,7 +23,6 @@ #include #include -#include namespace Acts::detail { @@ -53,8 +47,8 @@ struct GsfResult { std::size_t measurementHoles = 0; std::size_t processedStates = 0; - std::vector visitedSurfaces; - std::vector surfacesVisitedBwdAgain; + std::vector visitedSurfaces; + std::vector surfacesVisitedBwdAgain; /// Statistics about material encounterings Updatable nInvalidBetheHeitler; @@ -74,7 +68,7 @@ struct GsfActor { /// Enforce default construction GsfActor() = default; - using ComponentCache = Acts::GsfComponent; + using ComponentCache = GsfComponent; /// Broadcast the result_type using result_type = GsfResult; @@ -189,7 +183,7 @@ struct GsfActor { // All components must have status "on surface". It is however possible, // that currentSurface is nullptr and all components are "on surface" (e.g., // for surfaces excluded from the navigation) - using Status [[maybe_unused]] = Acts::Intersection3D::Status; + using Status [[maybe_unused]] = IntersectionStatus; assert(std::all_of( stepperComponents.begin(), stepperComponents.end(), [](const auto& cmp) { return cmp.status() == Status::onSurface; })); @@ -484,7 +478,7 @@ struct GsfActor { // we set ignored components to missed, so we can remove them after // the loop if (tmpStates.weights.at(idx) < m_cfg.weightCutoff) { - cmp.status() = Intersection3D::Status::missed; + cmp.status() = IntersectionStatus::missed; continue; } @@ -534,9 +528,9 @@ struct GsfActor { state.geoContext, freeParams.template segment<3>(eFreePos0), freeParams.template segment<3>(eFreeDir0)); cmp.pathAccumulated() = state.stepping.pathAccumulated; - cmp.jacobian() = Acts::BoundMatrix::Identity(); - cmp.derivative() = Acts::FreeVector::Zero(); - cmp.jacTransport() = Acts::FreeMatrix::Identity(); + cmp.jacobian() = BoundMatrix::Identity(); + cmp.derivative() = FreeVector::Zero(); + cmp.jacTransport() = FreeMatrix::Identity(); } } @@ -574,8 +568,7 @@ struct GsfActor { // If at least one component is no outlier, we consider the whole thing // as a measurementState - if (trackStateProxy.typeFlags().test( - Acts::TrackStateFlag::MeasurementFlag)) { + if (trackStateProxy.typeFlags().test(TrackStateFlag::MeasurementFlag)) { is_valid_measurement = true; } @@ -621,7 +614,7 @@ struct GsfActor { stepper.particleHypothesis(state.stepping)); // Return success - return Acts::Result::success(); + return Result::success(); } template & options) { + void setOptions(const GsfOptions& options) { m_cfg.maxComponents = options.maxComponents; m_cfg.extensions = options.extensions; m_cfg.abortOnError = options.abortOnError; diff --git a/Core/include/Acts/Utilities/Intersection.hpp b/Core/include/Acts/Utilities/Intersection.hpp index 6276538ed5e..11adf0bdece 100644 --- a/Core/include/Acts/Utilities/Intersection.hpp +++ b/Core/include/Acts/Utilities/Intersection.hpp @@ -9,7 +9,6 @@ #pragma once #include "Acts/Definitions/Algebra.hpp" -#include "Acts/Definitions/Tolerance.hpp" #include "Acts/Utilities/Logger.hpp" #include @@ -47,8 +46,6 @@ class Intersection { public: /// Position type using Position = ActsVector; - /// Status enum - using Status = IntersectionStatus; /// Constructor with arguments /// @@ -56,11 +53,13 @@ class Intersection { /// @param pathLength is the path length to the intersection /// @param status is an enum indicating the status of the intersection constexpr Intersection(const Position& position, double pathLength, - Status status) + IntersectionStatus status) : m_position(position), m_pathLength(pathLength), m_status(status) {} /// Returns whether the intersection was successful or not - constexpr bool isValid() const { return m_status != Status::missed; } + constexpr bool isValid() const { + return m_status != IntersectionStatus::missed; + } /// Returns the position of the interseciton constexpr const Position& position() const { return m_position; } @@ -69,7 +68,7 @@ class Intersection { constexpr ActsScalar pathLength() const { return m_pathLength; } /// Returns the intersection status enum - constexpr Status status() const { return m_status; } + constexpr IntersectionStatus status() const { return m_status; } /// Static factory to creae an invalid instesection constexpr static Intersection invalid() { return Intersection(); } @@ -87,12 +86,12 @@ class Intersection { /// be first. constexpr static bool closestOrder(const Intersection& aIntersection, const Intersection& bIntersection) { - if ((aIntersection.status() == Status::unreachable) && - (bIntersection.status() != Status::unreachable)) { + if ((aIntersection.status() == IntersectionStatus::unreachable) && + (bIntersection.status() != IntersectionStatus::unreachable)) { return false; } - if ((aIntersection.status() != Status::unreachable) && - (bIntersection.status() == Status::unreachable)) { + if ((aIntersection.status() != IntersectionStatus::unreachable) && + (bIntersection.status() == IntersectionStatus::unreachable)) { return true; } // both are reachable or onSurface now @@ -117,7 +116,7 @@ class Intersection { /// Signed path length to the intersection (if valid) ActsScalar m_pathLength = std::numeric_limits::infinity(); /// The Status of the intersection - Status m_status = Status::unreachable; + IntersectionStatus m_status = IntersectionStatus::unreachable; constexpr Intersection() = default; }; @@ -161,7 +160,7 @@ class ObjectIntersection { } /// Returns the status of the interseciton - constexpr Intersection3D::Status status() const { + constexpr IntersectionStatus status() const { return m_intersection.status(); } diff --git a/Core/src/Surfaces/ConeSurface.cpp b/Core/src/Surfaces/ConeSurface.cpp index b6d04e87e06..0ad869f2a4e 100644 --- a/Core/src/Surfaces/ConeSurface.cpp +++ b/Core/src/Surfaces/ConeSurface.cpp @@ -295,23 +295,23 @@ Acts::SurfaceMultiIntersection Acts::ConeSurface::intersect( // Check the validity of the first solution Vector3 solution1 = position + qe.first * direction; - Intersection3D::Status status1 = std::abs(qe.first) < std::abs(tolerance) - ? Intersection3D::Status::onSurface - : Intersection3D::Status::reachable; + IntersectionStatus status1 = std::abs(qe.first) < std::abs(tolerance) + ? IntersectionStatus::onSurface + : IntersectionStatus::reachable; if (!boundaryTolerance.isInfinite() && !isOnSurface(gctx, solution1, direction, boundaryTolerance)) { - status1 = Intersection3D::Status::missed; + status1 = IntersectionStatus::missed; } // Check the validity of the second solution Vector3 solution2 = position + qe.first * direction; - Intersection3D::Status status2 = std::abs(qe.second) < std::abs(tolerance) - ? Intersection3D::Status::onSurface - : Intersection3D::Status::reachable; + IntersectionStatus status2 = std::abs(qe.second) < std::abs(tolerance) + ? IntersectionStatus::onSurface + : IntersectionStatus::reachable; if (!boundaryTolerance.isInfinite() && !isOnSurface(gctx, solution2, direction, boundaryTolerance)) { - status2 = Intersection3D::Status::missed; + status2 = IntersectionStatus::missed; } const auto& tf = transform(gctx); diff --git a/Core/src/Surfaces/CylinderSurface.cpp b/Core/src/Surfaces/CylinderSurface.cpp index 4b3cd2db7be..d34726c2a7f 100644 --- a/Core/src/Surfaces/CylinderSurface.cpp +++ b/Core/src/Surfaces/CylinderSurface.cpp @@ -243,14 +243,13 @@ Acts::SurfaceMultiIntersection Acts::CylinderSurface::intersect( // Check the validity of the first solution Vector3 solution1 = position + qe.first * direction; - Intersection3D::Status status1 = std::abs(qe.first) < std::abs(tolerance) - ? Intersection3D::Status::onSurface - : Intersection3D::Status::reachable; + IntersectionStatus status1 = std::abs(qe.first) < std::abs(tolerance) + ? IntersectionStatus::onSurface + : IntersectionStatus::reachable; // Helper method for boundary check - auto boundaryCheck = - [&](const Vector3& solution, - Intersection3D::Status status) -> Intersection3D::Status { + auto boundaryCheck = [&](const Vector3& solution, + IntersectionStatus status) -> IntersectionStatus { // No check to be done, return current status if (boundaryTolerance.isInfinite()) { return status; @@ -266,12 +265,11 @@ Acts::SurfaceMultiIntersection Acts::CylinderSurface::intersect( double cZ = vecLocal.dot(tMatrix.block<3, 1>(0, 2)); double modifiedTolerance = tolerance + absoluteBound->tolerance1; double hZ = cBounds.get(CylinderBounds::eHalfLengthZ) + modifiedTolerance; - return std::abs(cZ) < std::abs(hZ) ? status - : Intersection3D::Status::missed; + return std::abs(cZ) < std::abs(hZ) ? status : IntersectionStatus::missed; } return isOnSurface(gctx, solution, direction, boundaryTolerance) ? status - : Intersection3D::Status::missed; + : IntersectionStatus::missed; }; // Check first solution for boundary compatibility status1 = boundaryCheck(solution1, status1); @@ -282,9 +280,9 @@ Acts::SurfaceMultiIntersection Acts::CylinderSurface::intersect( } // Check the validity of the second solution Vector3 solution2 = position + qe.second * direction; - Intersection3D::Status status2 = std::abs(qe.second) < std::abs(tolerance) - ? Intersection3D::Status::onSurface - : Intersection3D::Status::reachable; + IntersectionStatus status2 = std::abs(qe.second) < std::abs(tolerance) + ? IntersectionStatus::onSurface + : IntersectionStatus::reachable; // Check first solution for boundary compatibility status2 = boundaryCheck(solution2, status2); Intersection3D second(solution2, qe.second, status2); diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp index da1aa2b54bc..9e957346965 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -286,7 +286,7 @@ Acts::SurfaceMultiIntersection Acts::DiscSurface::intersect( PlanarHelper::intersect(gctxTransform, position, direction, tolerance); auto status = intersection.status(); // Evaluate boundary check if requested (and reachable) - if (intersection.status() != Intersection3D::Status::unreachable && + if (intersection.status() != IntersectionStatus::unreachable && m_bounds != nullptr && !boundaryTolerance.isInfinite()) { // Built-in local to global for speed reasons const auto& tMatrix = gctxTransform.matrix(); @@ -297,11 +297,11 @@ Acts::SurfaceMultiIntersection Acts::DiscSurface::intersect( double modifiedTolerance = tolerance + absoluteBound->tolerance0; if (!m_bounds->insideRadialBounds(VectorHelpers::perp(lcartesian), modifiedTolerance)) { - status = Intersection3D::Status::missed; + status = IntersectionStatus::missed; } } else if (!insideBounds(localCartesianToPolar(lcartesian), boundaryTolerance)) { - status = Intersection3D::Status::missed; + status = IntersectionStatus::missed; } } return {{Intersection3D(intersection.position(), intersection.pathLength(), diff --git a/Core/src/Surfaces/IntersectionHelper2D.cpp b/Core/src/Surfaces/IntersectionHelper2D.cpp index 1053021034f..c196b1a4131 100644 --- a/Core/src/Surfaces/IntersectionHelper2D.cpp +++ b/Core/src/Surfaces/IntersectionHelper2D.cpp @@ -30,11 +30,11 @@ Acts::Intersection2D Acts::detail::IntersectionHelper2D::intersectSegment( auto d = line.intersectionParameter(Plane::Through(s0, s1)); Vector2 intersection(origin + d * dir); - Intersection2D::Status status = Intersection2D::Status::reachable; + IntersectionStatus status = IntersectionStatus::reachable; if (boundCheck) { auto edgeToSol = intersection - s0; if (edgeToSol.dot(edge) < 0. || edgeToSol.norm() > (edge).norm()) { - status = Intersection2D::Status::unreachable; + status = IntersectionStatus::unreachable; } } return Intersection2D(intersection, d, status); @@ -55,11 +55,11 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, ActsScalar altD = std::copysign(toAltD.norm(), toAltD.dot(dir)); if (std::abs(solD) < std::abs(altD)) { - return {Intersection2D(sol, solD, Intersection2D::Status::reachable), - Intersection2D(alt, altD, Intersection2D::Status::reachable)}; + return {Intersection2D(sol, solD, IntersectionStatus::reachable), + Intersection2D(alt, altD, IntersectionStatus::reachable)}; } - return {Intersection2D(alt, altD, Intersection2D::Status::reachable), - Intersection2D(sol, solD, Intersection2D::Status::reachable)}; + return {Intersection2D(alt, altD, IntersectionStatus::reachable), + Intersection2D(sol, solD, IntersectionStatus::reachable)}; }; // Special cases first @@ -73,7 +73,7 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, return createSolution(sol, alt); } else if (std::abs(D) < s_epsilon) { return {Intersection2D(Vector2(solx, 0.), -origin.y(), - Intersection2D::Status::reachable), + IntersectionStatus::reachable), Intersection2D::invalid()}; } return {Intersection2D::invalid(), Intersection2D::invalid()}; @@ -87,7 +87,7 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, return createSolution(sol, alt); } else if (std::abs(D) < s_epsilon) { return {Intersection2D(Vector2(0., soly), -origin.x(), - Intersection2D::Status::reachable), + IntersectionStatus::reachable), Intersection2D::invalid()}; } return {Intersection2D::invalid(), Intersection2D::invalid()}; @@ -105,7 +105,7 @@ Acts::detail::IntersectionHelper2D::intersectEllipse(ActsScalar Rx, Vector2 sol(x, k * x + d); Vector2 toSolD(sol - origin); ActsScalar solD = std::copysign(toSolD.norm(), toSolD.dot(dir)); - return {Intersection2D(sol, solD, Intersection2D::Status::reachable), + return {Intersection2D(sol, solD, IntersectionStatus::reachable), Intersection2D::invalid()}; } else if (solver.solutions > 1) { ActsScalar x0 = solver.first; diff --git a/Core/src/Surfaces/LineSurface.cpp b/Core/src/Surfaces/LineSurface.cpp index f67fe038aa9..00d1fc6dd17 100644 --- a/Core/src/Surfaces/LineSurface.cpp +++ b/Core/src/Surfaces/LineSurface.cpp @@ -174,9 +174,9 @@ Acts::SurfaceMultiIntersection Acts::LineSurface::intersect( double u = (mab.dot(ea) - mab.dot(eb) * eaTeb) / denom; // Check if we are on the surface already - Intersection3D::Status status = std::abs(u) > std::abs(tolerance) - ? Intersection3D::Status::reachable - : Intersection3D::Status::onSurface; + IntersectionStatus status = std::abs(u) > std::abs(tolerance) + ? IntersectionStatus::reachable + : IntersectionStatus::onSurface; Vector3 result = ma + u * ea; // Evaluate the boundary check if requested // m_bounds == nullptr prevents unnecessary calculations for PerigeeSurface @@ -185,7 +185,7 @@ Acts::SurfaceMultiIntersection Acts::LineSurface::intersect( double cZ = vecLocal.dot(eb); double cR = (vecLocal - cZ * eb).norm(); if (!m_bounds->inside({cR, cZ}, boundaryTolerance)) { - status = Intersection3D::Status::missed; + status = IntersectionStatus::missed; } } diff --git a/Core/src/Surfaces/PlaneSurface.cpp b/Core/src/Surfaces/PlaneSurface.cpp index 658920e6686..db21709a192 100644 --- a/Core/src/Surfaces/PlaneSurface.cpp +++ b/Core/src/Surfaces/PlaneSurface.cpp @@ -168,14 +168,14 @@ Acts::SurfaceMultiIntersection Acts::PlaneSurface::intersect( PlanarHelper::intersect(gctxTransform, position, direction, tolerance); auto status = intersection.status(); // Evaluate boundary check if requested (and reachable) - if (intersection.status() != Intersection3D::Status::unreachable) { + if (intersection.status() != IntersectionStatus::unreachable) { // Built-in local to global for speed reasons const auto& tMatrix = gctxTransform.matrix(); // Create the reference vector in local const Vector3 vecLocal(intersection.position() - tMatrix.block<3, 1>(0, 3)); if (!insideBounds(tMatrix.block<3, 2>(0, 0).transpose() * vecLocal, boundaryTolerance)) { - status = Intersection3D::Status::missed; + status = IntersectionStatus::missed; } } return {{Intersection3D(intersection.position(), intersection.pathLength(), diff --git a/Core/src/Utilities/Intersection.cpp b/Core/src/Utilities/Intersection.cpp index 23378f0b381..8a99870b282 100644 --- a/Core/src/Utilities/Intersection.cpp +++ b/Core/src/Utilities/Intersection.cpp @@ -8,6 +8,8 @@ #include "Acts/Utilities/Intersection.hpp" +#include "Acts/Definitions/Tolerance.hpp" + namespace Acts { bool detail::checkPathLength(double pathLength, double nearLimit, diff --git a/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp b/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp index 3fee9d4b6dd..a851d7592d9 100644 --- a/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/MultiStepperTests.cpp @@ -308,7 +308,7 @@ void test_multi_stepper_vs_eigen_stepper() { SingleStepper single_stepper(defaultBField); for (auto cmp : multi_stepper.componentIterable(multi_state)) { - cmp.status() = Acts::Intersection3D::Status::reachable; + cmp.status() = Acts::IntersectionStatus::reachable; } // Do some steps and check that the results match @@ -483,14 +483,14 @@ void test_multi_stepper_surface_status_update() { multi_state, *right_surface, 0, Direction::Forward, BoundaryTolerance::Infinite()); - BOOST_CHECK_EQUAL(status, Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(status, IntersectionStatus::reachable); auto cmp_iterable = multi_stepper.constComponentIterable(multi_state); auto cmp_1 = *cmp_iterable.begin(); auto cmp_2 = *(++cmp_iterable.begin()); - BOOST_CHECK_EQUAL(cmp_1.status(), Intersection3D::Status::reachable); - BOOST_CHECK_EQUAL(cmp_2.status(), Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(cmp_1.status(), IntersectionStatus::reachable); + BOOST_CHECK_EQUAL(cmp_2.status(), IntersectionStatus::reachable); BOOST_CHECK_EQUAL(cmp_1.cmp.state.stepSize.value(), 1.0); BOOST_CHECK_EQUAL(cmp_2.cmp.state.stepSize.value(), -1.0); @@ -512,14 +512,14 @@ void test_multi_stepper_surface_status_update() { multi_state, *right_surface, 0, Direction::Forward, BoundaryTolerance::Infinite()); - BOOST_CHECK_EQUAL(status, Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(status, IntersectionStatus::onSurface); auto cmp_iterable = multi_stepper.constComponentIterable(multi_state); auto cmp_1 = *cmp_iterable.begin(); auto cmp_2 = *(++cmp_iterable.begin()); - BOOST_CHECK_EQUAL(cmp_1.status(), Intersection3D::Status::onSurface); - BOOST_CHECK_EQUAL(cmp_2.status(), Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(cmp_1.status(), IntersectionStatus::onSurface); + BOOST_CHECK_EQUAL(cmp_2.status(), IntersectionStatus::onSurface); } // Start surface should be reachable @@ -528,14 +528,14 @@ void test_multi_stepper_surface_status_update() { multi_state, *start_surface, 0, Direction::Forward, BoundaryTolerance::Infinite()); - BOOST_CHECK_EQUAL(status, Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(status, IntersectionStatus::reachable); auto cmp_iterable = multi_stepper.constComponentIterable(multi_state); auto cmp_1 = *cmp_iterable.begin(); auto cmp_2 = *(++cmp_iterable.begin()); - BOOST_CHECK_EQUAL(cmp_1.status(), Intersection3D::Status::reachable); - BOOST_CHECK_EQUAL(cmp_2.status(), Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(cmp_1.status(), IntersectionStatus::reachable); + BOOST_CHECK_EQUAL(cmp_2.status(), IntersectionStatus::reachable); BOOST_CHECK_EQUAL(cmp_1.cmp.state.stepSize.value(), -1.0); BOOST_CHECK_EQUAL(cmp_2.cmp.state.stepSize.value(), 1.0); diff --git a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp index b9c6fdf87df..e47589c7c63 100644 --- a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp +++ b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp @@ -140,7 +140,7 @@ struct PropagatorState { return s_onSurfaceTolerance; } - Intersection3D::Status updateSurfaceStatus( + IntersectionStatus updateSurfaceStatus( State& state, const Surface& surface, std::uint8_t index, Direction navDir, const BoundaryTolerance& boundaryTolerance, ActsScalar surfaceTolerance, const Logger& logger) const { diff --git a/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp index 4dd6f7f6905..152ec791201 100644 --- a/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/CylinderSurfaceTests.cpp @@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceProperties) { auto sfIntersection = cylinderSurfaceObject->intersect( testContext, offSurface, direction, BoundaryTolerance::Infinite()); Intersection3D expectedIntersect{Vector3{1, 1, 2}, 99., - Intersection3D::Status::reachable}; + IntersectionStatus::reachable}; BOOST_CHECK(sfIntersection[0].isValid()); CHECK_CLOSE_ABS(sfIntersection[0].position(), expectedIntersect.position(), 1e-9); diff --git a/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp index b5d1eec5f43..401b6e5bf12 100644 --- a/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/DiscSurfaceTests.cpp @@ -217,7 +217,7 @@ BOOST_AUTO_TEST_CASE(DiscSurfaceProperties) { BoundaryTolerance::Infinite()) .closest(); Intersection3D expectedIntersect{Vector3{1.2, 0., 0.}, 10., - Intersection3D::Status::reachable}; + IntersectionStatus::reachable}; BOOST_CHECK(sfIntersection.isValid()); CHECK_CLOSE_ABS(sfIntersection.position(), expectedIntersect.position(), 1e-9); diff --git a/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp b/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp index 99d0569b9d2..de2a87483e0 100644 --- a/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/PlaneSurfaceTests.cpp @@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceProperties) { BoundaryTolerance::None()) .closest(); Intersection3D expectedIntersect{Vector3{0, 1, 2}, 4., - Intersection3D::Status::reachable}; + IntersectionStatus::reachable}; BOOST_CHECK(sfIntersection.isValid()); BOOST_CHECK_EQUAL(sfIntersection.position(), expectedIntersect.position()); BOOST_CHECK_EQUAL(sfIntersection.pathLength(), diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceIntersectionTests.cpp b/Tests/UnitTests/Core/Surfaces/SurfaceIntersectionTests.cpp index e6294fc27ca..0fcabe9ad81 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceIntersectionTests.cpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceIntersectionTests.cpp @@ -71,15 +71,13 @@ BOOST_AUTO_TEST_CASE(CylinderIntersectionTests) { // Check the validity of the intersection BOOST_CHECK(aIntersection[0].isValid()); // The status of this one should be on surface - BOOST_CHECK_EQUAL(aIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(aIntersection[0].status(), IntersectionStatus::reachable); // The intersection is at 2 meter distance CHECK_CLOSE_ABS(aIntersection[0].pathLength(), -2_m, s_onSurfaceTolerance); // There MUST be a second solution BOOST_CHECK(aIntersection[1].isValid()); // The other intersection MUST be reachable - BOOST_CHECK_EQUAL(aIntersection[1].status(), - Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(aIntersection[1].status(), IntersectionStatus::onSurface); // Intersect from the center auto cIntersection = aCylinder->intersect(tgContext, atCenter, alongX, @@ -88,13 +86,11 @@ BOOST_AUTO_TEST_CASE(CylinderIntersectionTests) { // Check the validity of the intersection BOOST_CHECK(cIntersection[0].isValid()); // The status of this one MUST be reachable - BOOST_CHECK_EQUAL(cIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(cIntersection[0].status(), IntersectionStatus::reachable); // There MUST be a second solution BOOST_CHECK(cIntersection[1].isValid()); // The other intersection MUST be reachable - BOOST_CHECK_EQUAL(cIntersection[1].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(cIntersection[1].status(), IntersectionStatus::reachable); // There MUST be one forward one backwards solution BOOST_CHECK_LT( cIntersection[1].pathLength() * cIntersection[0].pathLength(), 0); @@ -106,13 +102,11 @@ BOOST_AUTO_TEST_CASE(CylinderIntersectionTests) { // Check the validity of the intersection BOOST_CHECK(oIntersection[0].isValid()); // The status of this one MUST be reachable - BOOST_CHECK_EQUAL(oIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(oIntersection[0].status(), IntersectionStatus::reachable); // There MUST be a second solution BOOST_CHECK(oIntersection[1].isValid()); // The other intersection MUST be reachable - BOOST_CHECK_EQUAL(oIntersection[1].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(oIntersection[1].status(), IntersectionStatus::reachable); // There MUST be one forward one backwards solution BOOST_CHECK_GT( oIntersection[1].pathLength() * oIntersection[0].pathLength(), 0); @@ -133,13 +127,11 @@ BOOST_AUTO_TEST_CASE(CylinderIntersectionTests) { // This should be the positive one BOOST_CHECK_LT(eIntersection[0].pathLength(), 0.); // The status of this one should be reachable - BOOST_CHECK_EQUAL(eIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(eIntersection[0].status(), IntersectionStatus::reachable); // There MUST be a second solution BOOST_CHECK(eIntersection[1].isValid()); // The other intersection MUST be reachable - BOOST_CHECK_EQUAL(eIntersection[1].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(eIntersection[1].status(), IntersectionStatus::reachable); // And be the negative one BOOST_CHECK_GT(eIntersection[1].pathLength(), 0.); @@ -149,13 +141,11 @@ BOOST_AUTO_TEST_CASE(CylinderIntersectionTests) { // This should be the negative one BOOST_CHECK_LT(eIntersection[0].pathLength(), 0.); // The status of this one should be reachable - BOOST_CHECK_EQUAL(eIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(eIntersection[0].status(), IntersectionStatus::reachable); // There MUST be a second solution BOOST_CHECK(!eIntersection[1].isValid()); // The other intersection MUST NOT be reachable - BOOST_CHECK_EQUAL(eIntersection[1].status(), - Intersection3D::Status::missed); + BOOST_CHECK_EQUAL(eIntersection[1].status(), IntersectionStatus::missed); // And be the positive one BOOST_CHECK_GT(eIntersection[1].pathLength(), 0.); }; @@ -196,15 +186,13 @@ BOOST_AUTO_TEST_CASE(ConeIntersectionTest) { // Check the validity of the intersection BOOST_CHECK(aIntersection[0].isValid()); // The status of this one should be on surface - BOOST_CHECK_EQUAL(aIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(aIntersection[0].status(), IntersectionStatus::reachable); // The intersection is at 4 mm distance CHECK_CLOSE_ABS(aIntersection[0].pathLength(), -4., s_onSurfaceTolerance); // There MUST be a second solution BOOST_CHECK(aIntersection[1].isValid()); // The other intersection MUST be reachable - BOOST_CHECK_EQUAL(aIntersection[1].status(), - Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(aIntersection[1].status(), IntersectionStatus::onSurface); // Intersection from outside without chance of hitting the cylinder auto iIntersection = aCone->intersect(tgContext, outCone, perpXY, @@ -254,8 +242,7 @@ BOOST_AUTO_TEST_CASE(PlanarIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(fIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(fIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(fIntersection[0].status(), IntersectionStatus::reachable); // The path length MUST be positive BOOST_CHECK_GT(fIntersection[0].pathLength(), 0.); // The intersection MUST be unique @@ -267,8 +254,7 @@ BOOST_AUTO_TEST_CASE(PlanarIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(oIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(oIntersection[0].status(), - Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(oIntersection[0].status(), IntersectionStatus::onSurface); // The path length MUST be positive BOOST_CHECK_LT(std::abs(oIntersection[0].pathLength()), s_onSurfaceTolerance); @@ -281,8 +267,7 @@ BOOST_AUTO_TEST_CASE(PlanarIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(bIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(bIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(bIntersection[0].status(), IntersectionStatus::reachable); // The path length MUST be negative BOOST_CHECK_LT(bIntersection[0].pathLength(), 0.); // The intersection MUST be unique @@ -294,8 +279,7 @@ BOOST_AUTO_TEST_CASE(PlanarIntersectionTest) { // The intersection MUST NOT be valid BOOST_CHECK(!mIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(mIntersection[0].status(), - Intersection3D::Status::missed); + BOOST_CHECK_EQUAL(mIntersection[0].status(), IntersectionStatus::missed); // The path length MUST be negative BOOST_CHECK_GT(mIntersection[0].pathLength(), 0.); // The intersection MUST be unique @@ -308,7 +292,7 @@ BOOST_AUTO_TEST_CASE(PlanarIntersectionTest) { BOOST_CHECK(!iIntersection[0].isValid()); // The intersection MUST be reachable BOOST_CHECK_EQUAL(iIntersection[0].status(), - Intersection3D::Status::unreachable); + IntersectionStatus::unreachable); // The intersection MUST be unique BOOST_CHECK(!iIntersection[1].isValid()); }; @@ -352,8 +336,7 @@ BOOST_AUTO_TEST_CASE(LineIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(fIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(fIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(fIntersection[0].status(), IntersectionStatus::reachable); // The path length MUST be positive BOOST_CHECK_GT(fIntersection[0].pathLength(), 0.); // The intersection MUST be unique @@ -365,8 +348,7 @@ BOOST_AUTO_TEST_CASE(LineIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(oIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(oIntersection[0].status(), - Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(oIntersection[0].status(), IntersectionStatus::onSurface); // The path length MUST be positive BOOST_CHECK_LT(std::abs(oIntersection[0].pathLength()), s_onSurfaceTolerance); @@ -379,8 +361,7 @@ BOOST_AUTO_TEST_CASE(LineIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(oIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(oIntersection[0].status(), - Intersection3D::Status::onSurface); + BOOST_CHECK_EQUAL(oIntersection[0].status(), IntersectionStatus::onSurface); // The path length MUST be positive BOOST_CHECK_LT(std::abs(oIntersection[0].pathLength()), s_onSurfaceTolerance); @@ -393,8 +374,7 @@ BOOST_AUTO_TEST_CASE(LineIntersectionTest) { // The intersection MUST be valid BOOST_CHECK(bIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(bIntersection[0].status(), - Intersection3D::Status::reachable); + BOOST_CHECK_EQUAL(bIntersection[0].status(), IntersectionStatus::reachable); // The path length MUST be negative BOOST_CHECK_LT(bIntersection[0].pathLength(), 0.); // The intersection MUST be unique @@ -406,8 +386,7 @@ BOOST_AUTO_TEST_CASE(LineIntersectionTest) { // The intersection MUST NOT be valid BOOST_CHECK(!mIntersection[0].isValid()); // The intersection MUST be reachable - BOOST_CHECK_EQUAL(mIntersection[0].status(), - Intersection3D::Status::missed); + BOOST_CHECK_EQUAL(mIntersection[0].status(), IntersectionStatus::missed); // The path length MUST be negative BOOST_CHECK_LT(mIntersection[0].pathLength(), 0.); // The intersection MUST be unique @@ -420,7 +399,7 @@ BOOST_AUTO_TEST_CASE(LineIntersectionTest) { BOOST_CHECK(!iIntersection[0].isValid()); // The intersection MUST be reachable BOOST_CHECK_EQUAL(iIntersection[0].status(), - Intersection3D::Status::unreachable); + IntersectionStatus::unreachable); // The intersection MUST be unique BOOST_CHECK(!iIntersection[1].isValid()); }; diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp b/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp index c61508a6d89..72ad444fd8a 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp @@ -89,7 +89,7 @@ class SurfaceStub : public RegularSurface { const BoundaryTolerance& /*boundaryTolerance*/, const ActsScalar /*tolerance*/) const final { Intersection3D stubIntersection(Vector3(20., 0., 0.), 20., - Intersection3D::Status::reachable); + IntersectionStatus::reachable); return SurfaceMultiIntersection( {stubIntersection, Intersection3D::invalid()}, this); } diff --git a/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp b/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp index 41581b08b8d..bda4cad2da2 100644 --- a/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp +++ b/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp @@ -32,19 +32,15 @@ class Object {}; BOOST_AUTO_TEST_CASE(IntersectionTest) { // a few valid intersections // all positively sortered - Intersection3D fIp(Vector3(0., 1., 0.), 1., - Intersection3D::Status::reachable); - Intersection3D sIp(Vector3(0., 2., 0.), 2., - Intersection3D::Status::reachable); - Intersection3D tIp(Vector3(0., 3., 0.), 3., - Intersection3D::Status::reachable); + Intersection3D fIp(Vector3(0., 1., 0.), 1., IntersectionStatus::reachable); + Intersection3D sIp(Vector3(0., 2., 0.), 2., IntersectionStatus::reachable); + Intersection3D tIp(Vector3(0., 3., 0.), 3., IntersectionStatus::reachable); BOOST_CHECK(fIp.isValid()); BOOST_CHECK(sIp.isValid()); BOOST_CHECK(tIp.isValid()); // a non-valid intersection - Intersection3D nIp(Vector3(3., 3., 0.), 3., - Intersection3D::Status::unreachable); + Intersection3D nIp(Vector3(3., 3., 0.), 3., IntersectionStatus::unreachable); BOOST_CHECK(!nIp.isValid()); std::vector fstpIntersections = {fIp, sIp, tIp}; @@ -82,12 +78,9 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { tfnsnpIntersections[2].pathLength()); /// let's make a bunch of negative solution - Intersection3D fIn(Vector3(0., -1., 0.), -1., - Intersection3D::Status::reachable); - Intersection3D sIn(Vector3(0., -2., 0.), -2., - Intersection3D::Status::reachable); - Intersection3D tIn(Vector3(0., -3., 0.), -3., - Intersection3D::Status::reachable); + Intersection3D fIn(Vector3(0., -1., 0.), -1., IntersectionStatus::reachable); + Intersection3D sIn(Vector3(0., -2., 0.), -2., IntersectionStatus::reachable); + Intersection3D tIn(Vector3(0., -3., 0.), -3., IntersectionStatus::reachable); std::vector tsfnIntersections = {tIn, sIn, fIn}; std::vector fstnIntersections = {fIn, sIn, tIn}; @@ -113,7 +106,7 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { BOOST_CHECK_EQUAL(pnsolutions[5].pathLength(), 3.); // sort intersections with zero path length - Intersection3D zI(Vector3(0., 0., 0.), 0., Intersection3D::Status::onSurface); + Intersection3D zI(Vector3(0., 0., 0.), 0., IntersectionStatus::onSurface); std::vector tszfpIntersections = {tIp, sIp, zI, fIp}; std::ranges::sort(tszfpIntersections, Intersection3D::pathLengthOrder); @@ -147,25 +140,25 @@ BOOST_AUTO_TEST_CASE(ObjectIntersectionTest) { using PlaneIntersection = ObjectIntersection; - PlaneIntersection int6(Intersection3D(Vector3(6., 0., 0.), 6., - Intersection3D::Status::reachable), - psf6.get()); - PlaneIntersection int7(Intersection3D(Vector3(7., 0., 0.), 7., - Intersection3D::Status::reachable), - psf7.get()); - PlaneIntersection int8(Intersection3D(Vector3(8., 0., 0.), 8., - Intersection3D::Status::reachable), - psf8.get()); - PlaneIntersection int9a(Intersection3D(Vector3(9., 0., 0.), 9., - Intersection3D::Status::reachable), - psf9.get()); + PlaneIntersection int6( + Intersection3D(Vector3(6., 0., 0.), 6., IntersectionStatus::reachable), + psf6.get()); + PlaneIntersection int7( + Intersection3D(Vector3(7., 0., 0.), 7., IntersectionStatus::reachable), + psf7.get()); + PlaneIntersection int8( + Intersection3D(Vector3(8., 0., 0.), 8., IntersectionStatus::reachable), + psf8.get()); + PlaneIntersection int9a( + Intersection3D(Vector3(9., 0., 0.), 9., IntersectionStatus::reachable), + psf9.get()); PlaneIntersection int9b( Intersection3D(Vector3(9., 1., 0.), std::hypot(9., 1.), - Intersection3D::Status::reachable), + IntersectionStatus::reachable), psf9.get()); - PlaneIntersection int10(Intersection3D(Vector3(10., 0., 0.), 10., - Intersection3D::Status::reachable), - psf10.get()); + PlaneIntersection int10( + Intersection3D(Vector3(10., 0., 0.), 10., IntersectionStatus::reachable), + psf10.get()); std::vector firstSet = {int6, int7, int9b, int10}; std::vector secondSet = {int8, int9a, int9b, int10};