diff --git a/CI/physmon/reference/performance_gsf.root b/CI/physmon/reference/performance_gsf.root index 7b73976f1a5..6cb292f54e1 100644 Binary files a/CI/physmon/reference/performance_gsf.root and b/CI/physmon/reference/performance_gsf.root differ diff --git a/Core/include/Acts/Propagator/AtlasStepper.hpp b/Core/include/Acts/Propagator/AtlasStepper.hpp index 93083e8c244..0569e16a93c 100644 --- a/Core/include/Acts/Propagator/AtlasStepper.hpp +++ b/Core/include/Acts/Propagator/AtlasStepper.hpp @@ -422,15 +422,14 @@ class AtlasStepper { detail::updateSingleStepSize(state, oIntersection, release); } - /// Set Step size - explicitly with a double + /// Update step size - explicitly with a double /// /// @param [in,out] state The stepping state (thread-local cache) /// @param [in] stepSize The step size value /// @param [in] stype The step size type to be set /// @param release [in] Do we release the step size? - void setStepSize(State& state, double stepSize, - ConstrainedStep::Type stype = ConstrainedStep::actor, - bool release = true) const { + void updateStepSize(State& state, double stepSize, + ConstrainedStep::Type stype, bool release = true) const { state.previousStepSize = state.stepSize.value(); state.stepSize.update(stepSize, stype, release); } @@ -446,8 +445,9 @@ class AtlasStepper { /// Release the Step size /// /// @param [in,out] state The stepping state (thread-local cache) - void releaseStepSize(State& state) const { - state.stepSize.release(ConstrainedStep::actor); + /// @param [in] stype The step size type to be released + void releaseStepSize(State& state, ConstrainedStep::Type stype) const { + state.stepSize.release(stype); } /// Output the Step Size - single component diff --git a/Core/include/Acts/Propagator/DirectNavigator.hpp b/Core/include/Acts/Propagator/DirectNavigator.hpp index 120f62ff7d1..c1b732f818f 100644 --- a/Core/include/Acts/Propagator/DirectNavigator.hpp +++ b/Core/include/Acts/Propagator/DirectNavigator.hpp @@ -331,7 +331,6 @@ class DirectNavigator { state.navigation.navSurfaces.end()) { ACTS_VERBOSE("Next surface candidate is " << (*state.navigation.navSurfaceIter)->geometryId()); - stepper.releaseStepSize(state.stepping); } } else if (surfaceStatus == Intersection3D::Status::reachable) { ACTS_VERBOSE("Next surface reachable at distance " diff --git a/Core/include/Acts/Propagator/EigenStepper.hpp b/Core/include/Acts/Propagator/EigenStepper.hpp index f7fe525361b..d15dd2a550e 100644 --- a/Core/include/Acts/Propagator/EigenStepper.hpp +++ b/Core/include/Acts/Propagator/EigenStepper.hpp @@ -272,15 +272,14 @@ class EigenStepper { detail::updateSingleStepSize(state, oIntersection, release); } - /// Set Step size - explicitly with a double + /// Update step size - explicitly with a double /// /// @param state [in,out] The stepping state (thread-local cache) /// @param stepSize [in] The step size value /// @param stype [in] The step size type to be set /// @param release [in] Do we release the step size? - void setStepSize(State& state, double stepSize, - ConstrainedStep::Type stype = ConstrainedStep::actor, - bool release = true) const { + void updateStepSize(State& state, double stepSize, + ConstrainedStep::Type stype, bool release = true) const { state.previousStepSize = state.stepSize.value(); state.stepSize.update(stepSize, stype, release); } @@ -296,8 +295,9 @@ class EigenStepper { /// Release the Step size /// /// @param state [in,out] The stepping state (thread-local cache) - void releaseStepSize(State& state) const { - state.stepSize.release(ConstrainedStep::actor); + /// @param [in] stype The step size type to be released + void releaseStepSize(State& state, ConstrainedStep::Type stype) const { + state.stepSize.release(stype); } /// Output the Step Size - single component diff --git a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp index 7fd4eb4766e..2e9cb6e206f 100644 --- a/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp +++ b/Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp @@ -675,17 +675,16 @@ class MultiEigenStepperLoop } } - /// Set Step size - explicitly with a double + /// Update step size - explicitly with a double /// /// @param state [in,out] The stepping state (thread-local cache) /// @param stepSize [in] The step size value /// @param stype [in] The step size type to be set /// @param release [in] Do we release the step size? - void setStepSize(State& state, double stepSize, - ConstrainedStep::Type stype = ConstrainedStep::actor, - bool release = true) const { + void updateStepSize(State& state, double stepSize, + ConstrainedStep::Type stype, bool release = true) const { for (auto& component : state.components) { - SingleStepper::setStepSize(component.state, stepSize, stype, release); + SingleStepper::updateStepSize(component.state, stepSize, stype, release); } } @@ -708,9 +707,10 @@ class MultiEigenStepperLoop /// Release the step-size for all components /// /// @param state [in,out] The stepping state (thread-local cache) - void releaseStepSize(State& state) const { + /// @param [in] stype The step size type to be released + void releaseStepSize(State& state, ConstrainedStep::Type stype) const { for (auto& component : state.components) { - SingleStepper::releaseStepSize(component.state); + SingleStepper::releaseStepSize(component.state, stype); } } diff --git a/Core/include/Acts/Propagator/Navigator.hpp b/Core/include/Acts/Propagator/Navigator.hpp index 17a0745fdd9..46126777d01 100644 --- a/Core/include/Acts/Propagator/Navigator.hpp +++ b/Core/include/Acts/Propagator/Navigator.hpp @@ -420,7 +420,7 @@ class Navigator { << "No further navigation action, proceed to target."); // Set navigation break and release the navigation step size state.navigation.navigationBreak = true; - stepper.releaseStepSize(state.stepping); + stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); } // Navigator target always resets the current surface @@ -536,7 +536,6 @@ class Navigator { << "No more volume to progress to, stopping navigation."); // Navigation break & release navigation stepping state.navigation.navigationBreak = true; - stepper.releaseStepSize(state.stepping); return; } else { ACTS_VERBOSE(volInfo(state) << "Volume updated."); @@ -562,7 +561,6 @@ class Navigator { } // Set navigation break and release the navigation step size state.navigation.navigationBreak = true; - stepper.releaseStepSize(state.stepping); } else { ACTS_VERBOSE(volInfo(state) << "Status could not be determined - good luck."); @@ -649,7 +647,7 @@ class Navigator { << "Start is target layer, nothing left to do."); // set the navigation break state.navigation.navigationBreak = true; - stepper.releaseStepSize(state.stepping); + stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); } return startResolved; } @@ -934,7 +932,7 @@ class Navigator { ACTS_VERBOSE(volInfo(state) << "No sufficient information to resolve boundary, " "stopping navigation."); - stepper.releaseStepSize(state.stepping); + stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); return false; } else if (state.navigation.currentVolume == state.navigation.targetVolume) { @@ -942,7 +940,7 @@ class Navigator { << "In target volume: no need to resolve boundary, " "stopping navigation."); state.navigation.navigationBreak = true; - stepper.releaseStepSize(state.stepping); + stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); return true; } @@ -1275,7 +1273,7 @@ class Navigator { // Screen output - no layer candidates found ACTS_VERBOSE(volInfo(state) << "No compatible layer candidates found."); // Release the step size - stepper.releaseStepSize(state.stepping); + stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); return false; } diff --git a/Core/include/Acts/Propagator/Propagator.ipp b/Core/include/Acts/Propagator/Propagator.ipp index c507c27b187..e94bf2b9bba 100644 --- a/Core/include/Acts/Propagator/Propagator.ipp +++ b/Core/include/Acts/Propagator/Propagator.ipp @@ -7,6 +7,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "Acts/EventData/TrackParametersConcept.hpp" +#include "Acts/Propagator/ConstrainedStep.hpp" #include "Acts/Propagator/PropagatorError.hpp" #include "Acts/Propagator/detail/LoopProtection.hpp" @@ -58,6 +59,9 @@ auto Acts::Propagator::propagate_impl(propagator_state_t& state, // pass error to caller return res.error(); } + // release actor and aborter constrains after step was performed + m_stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); + m_stepper.releaseStepSize(state.stepping, ConstrainedStep::aborter); // Post-stepping: // navigator post step call - action list - aborter list state.stage = PropagatorStage::postStep; diff --git a/Core/include/Acts/Propagator/StandardAborters.hpp b/Core/include/Acts/Propagator/StandardAborters.hpp index 375425af1c5..7c93b79198e 100644 --- a/Core/include/Acts/Propagator/StandardAborters.hpp +++ b/Core/include/Acts/Propagator/StandardAborters.hpp @@ -58,8 +58,8 @@ struct PathLimitReached { navigator.targetReached(state.navigation, true); return true; } - stepper.setStepSize(state.stepping, distance, ConstrainedStep::aborter, - false); + stepper.updateStepSize(state.stepping, distance, ConstrainedStep::aborter, + false); ACTS_VERBOSE("PathLimit aborter | " << "Target stepSize (path limit) updated to " << stepper.outputStepSize(state.stepping)); @@ -126,8 +126,8 @@ struct SurfaceReached { if (intersection && detail::checkIntersection(intersection.intersection(), pLimit, oLimit, tolerance, logger)) { - stepper.setStepSize(state.stepping, intersection.pathLength(), - ConstrainedStep::aborter, false); + stepper.updateStepSize(state.stepping, intersection.pathLength(), + ConstrainedStep::aborter, false); ACTS_VERBOSE( "SurfaceReached aborter | " "Target stepSize (surface) updated to " diff --git a/Core/include/Acts/Propagator/StepperConcept.hpp b/Core/include/Acts/Propagator/StepperConcept.hpp index 19621e09512..d7e81502939 100644 --- a/Core/include/Acts/Propagator/StepperConcept.hpp +++ b/Core/include/Acts/Propagator/StepperConcept.hpp @@ -54,7 +54,7 @@ METHOD_TRAIT(covariance_transport_curvilinear_t, transportCovarianceToCurvilinear); METHOD_TRAIT(step_t, step); METHOD_TRAIT(update_surface_status_t, updateSurfaceStatus); -METHOD_TRAIT(set_step_size_t, setStepSize); +METHOD_TRAIT(update_step_size_t, updateStepSize); METHOD_TRAIT(get_step_size_t, getStepSize); METHOD_TRAIT(release_step_size_t, releaseStepSize); METHOD_TRAIT(output_step_size_t, outputStepSize); @@ -126,11 +126,11 @@ constexpr bool MultiStepperStateConcept= require< static_assert(covariance_transport_exists, "covarianceTransport method not found"); 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"); + constexpr static bool update_step_size_exists = has_method; + static_assert(update_step_size_exists, "updateStepSize method not found"); constexpr static bool get_step_size_exists = has_method; static_assert(get_step_size_exists, "getStepSize method not found"); - constexpr static bool release_step_size_exists = has_method; + constexpr static bool release_step_size_exists = has_method; static_assert(release_step_size_exists, "releaseStepSize method not found"); constexpr static bool output_step_size_exists = has_method; static_assert(output_step_size_exists, "outputStepSize method not found"); @@ -151,7 +151,7 @@ constexpr bool MultiStepperStateConcept= require< curvilinear_state_method_exists, covariance_transport_exists, update_surface_exists, - set_step_size_exists, + update_step_size_exists, release_step_size_exists, output_step_size_exists>; diff --git a/Core/include/Acts/Propagator/StraightLineStepper.hpp b/Core/include/Acts/Propagator/StraightLineStepper.hpp index d4c78588970..2f68916cd16 100644 --- a/Core/include/Acts/Propagator/StraightLineStepper.hpp +++ b/Core/include/Acts/Propagator/StraightLineStepper.hpp @@ -263,15 +263,15 @@ class StraightLineStepper { release); } - /// Set Step size - explicitly with a double + /// Update step size - explicitly with a double /// /// @param state [in,out] The stepping state (thread-local cache) /// @param stepSize [in] The step size value /// @param stype [in] The step size type to be set /// @param release [in] Do we release the step size? - void setStepSize(State& state, double stepSize, - ConstrainedStep::Type stype = ConstrainedStep::actor, - bool release = true) const { + void updateStepSize(State& state, double stepSize, + ConstrainedStep::Type stype = ConstrainedStep::actor, + bool release = true) const { state.previousStepSize = state.stepSize.value(); state.stepSize.update(stepSize, stype, release); } @@ -286,9 +286,10 @@ class StraightLineStepper { /// Release the Step size /// - /// @param state [in,out] The stepping state (thread-local cache) - void releaseStepSize(State& state) const { - state.stepSize.release(ConstrainedStep::actor); + /// @param [in,out] state The stepping state (thread-local cache) + /// @param [in] stype The step size type to be released + void releaseStepSize(State& state, ConstrainedStep::Type stype) const { + state.stepSize.release(stype); } /// Output the Step Size - single component diff --git a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp index 0aeca4b6594..359233ad033 100644 --- a/Core/include/Acts/Propagator/detail/SteppingHelper.hpp +++ b/Core/include/Acts/Propagator/detail/SteppingHelper.hpp @@ -59,7 +59,8 @@ Acts::Intersection3D::Status updateSingleSurfaceStatus( detail::checkIntersection(sIntersection.intersection(), pLimit, oLimit, surfaceTolerance, logger)) { ACTS_VERBOSE("Surface is reachable"); - stepper.setStepSize(state, sIntersection.pathLength()); + stepper.updateStepSize(state, sIntersection.pathLength(), + ConstrainedStep::actor); return Intersection3D::Status::reachable; } diff --git a/Core/include/Acts/Surfaces/ConeSurface.hpp b/Core/include/Acts/Surfaces/ConeSurface.hpp index 0d453e106ed..3701bc7b5f7 100644 --- a/Core/include/Acts/Surfaces/ConeSurface.hpp +++ b/Core/include/Acts/Surfaces/ConeSurface.hpp @@ -18,7 +18,9 @@ #include "Acts/Surfaces/ConeBounds.hpp" #include "Acts/Surfaces/RegularSurface.hpp" #include "Acts/Surfaces/Surface.hpp" +#include "Acts/Surfaces/SurfaceConcept.hpp" #include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/Concepts.hpp" #include "Acts/Utilities/Result.hpp" #include "Acts/Utilities/detail/RealQuadraticEquation.hpp" @@ -278,4 +280,6 @@ class ConeSurface : public RegularSurface { const Vector3& direction) const; }; +ACTS_STATIC_CHECK_CONCEPT(RegularSurfaceConcept, ConeSurface); + } // namespace Acts diff --git a/Core/include/Acts/Surfaces/CylinderSurface.hpp b/Core/include/Acts/Surfaces/CylinderSurface.hpp index 2d1d550a5e5..717b55514c8 100644 --- a/Core/include/Acts/Surfaces/CylinderSurface.hpp +++ b/Core/include/Acts/Surfaces/CylinderSurface.hpp @@ -18,7 +18,9 @@ #include "Acts/Surfaces/CylinderBounds.hpp" #include "Acts/Surfaces/RegularSurface.hpp" #include "Acts/Surfaces/Surface.hpp" +#include "Acts/Surfaces/SurfaceConcept.hpp" #include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/Concepts.hpp" #include "Acts/Utilities/Result.hpp" #include "Acts/Utilities/detail/RealQuadraticEquation.hpp" @@ -285,4 +287,6 @@ class CylinderSurface : public RegularSurface { const Vector3& direction) const; }; +ACTS_STATIC_CHECK_CONCEPT(RegularSurfaceConcept, CylinderSurface); + } // namespace Acts diff --git a/Core/include/Acts/Surfaces/DiscSurface.hpp b/Core/include/Acts/Surfaces/DiscSurface.hpp index a0402ed441b..d55fc2c6181 100644 --- a/Core/include/Acts/Surfaces/DiscSurface.hpp +++ b/Core/include/Acts/Surfaces/DiscSurface.hpp @@ -18,7 +18,9 @@ #include "Acts/Surfaces/InfiniteBounds.hpp" #include "Acts/Surfaces/RegularSurface.hpp" #include "Acts/Surfaces/Surface.hpp" +#include "Acts/Surfaces/SurfaceConcept.hpp" #include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/Concepts.hpp" #include "Acts/Utilities/Result.hpp" #include @@ -328,4 +330,7 @@ class DiscSurface : public RegularSurface { protected: std::shared_ptr m_bounds; ///< bounds (shared) }; + +ACTS_STATIC_CHECK_CONCEPT(RegularSurfaceConcept, DiscSurface); + } // end of namespace Acts diff --git a/Core/include/Acts/Surfaces/PerigeeSurface.hpp b/Core/include/Acts/Surfaces/PerigeeSurface.hpp index e67a723160d..e8c95dba52c 100644 --- a/Core/include/Acts/Surfaces/PerigeeSurface.hpp +++ b/Core/include/Acts/Surfaces/PerigeeSurface.hpp @@ -13,6 +13,8 @@ #include "Acts/Surfaces/InfiniteBounds.hpp" #include "Acts/Surfaces/LineSurface.hpp" #include "Acts/Surfaces/Surface.hpp" +#include "Acts/Surfaces/SurfaceConcept.hpp" +#include "Acts/Utilities/Concepts.hpp" #include #include @@ -91,4 +93,6 @@ class PerigeeSurface : public LineSurface { std::size_t lseg) const final; }; +ACTS_STATIC_CHECK_CONCEPT(SurfaceConcept, PerigeeSurface); + } // namespace Acts diff --git a/Core/include/Acts/Surfaces/PlaneSurface.hpp b/Core/include/Acts/Surfaces/PlaneSurface.hpp index aeabeb9ae34..90c1441f1dd 100644 --- a/Core/include/Acts/Surfaces/PlaneSurface.hpp +++ b/Core/include/Acts/Surfaces/PlaneSurface.hpp @@ -17,7 +17,9 @@ #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RegularSurface.hpp" #include "Acts/Surfaces/Surface.hpp" +#include "Acts/Surfaces/SurfaceConcept.hpp" #include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/Concepts.hpp" #include "Acts/Utilities/Result.hpp" #include @@ -232,4 +234,6 @@ class PlaneSurface : public RegularSurface { private: }; +ACTS_STATIC_CHECK_CONCEPT(RegularSurfaceConcept, PlaneSurface); + } // end of namespace Acts diff --git a/Core/include/Acts/Surfaces/StrawSurface.hpp b/Core/include/Acts/Surfaces/StrawSurface.hpp index 314c2637a51..06a219ee28d 100644 --- a/Core/include/Acts/Surfaces/StrawSurface.hpp +++ b/Core/include/Acts/Surfaces/StrawSurface.hpp @@ -13,6 +13,8 @@ #include "Acts/Surfaces/LineBounds.hpp" #include "Acts/Surfaces/LineSurface.hpp" #include "Acts/Surfaces/Surface.hpp" +#include "Acts/Surfaces/SurfaceConcept.hpp" +#include "Acts/Utilities/Concepts.hpp" #include #include @@ -108,4 +110,6 @@ inline std::string Acts::StrawSurface::name() const { return "Acts::StrawSurface"; } +ACTS_STATIC_CHECK_CONCEPT(SurfaceConcept, StrawSurface); + } // namespace Acts diff --git a/Core/include/Acts/Surfaces/SurfaceConcept.hpp b/Core/include/Acts/Surfaces/SurfaceConcept.hpp new file mode 100644 index 00000000000..d510e2aa3ce --- /dev/null +++ b/Core/include/Acts/Surfaces/SurfaceConcept.hpp @@ -0,0 +1,133 @@ +// This file is part of the Acts project. +// +// Copyright (C) 2023 CERN for the benefit of the Acts project +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#pragma once + +#include "Acts/Definitions/Algebra.hpp" +#include "Acts/Definitions/Alignment.hpp" +#include "Acts/Definitions/TrackParametrization.hpp" +#include "Acts/Geometry/DetectorElementBase.hpp" +#include "Acts/Geometry/GeometryContext.hpp" +#include "Acts/Material/ISurfaceMaterial.hpp" +#include "Acts/Surfaces/BoundaryCheck.hpp" +#include "Acts/Surfaces/Surface.hpp" +#include "Acts/Surfaces/SurfaceBounds.hpp" +#include "Acts/Utilities/Result.hpp" + +#if defined(__cpp_concepts) +#include + +namespace Acts { + +template +concept SurfaceConcept = requires(S s, const S cs, S s2, const S cs2, + GeometryContext gctx) { + { cs == s2 } -> std::same_as; + + { cs.type() } -> std::same_as; + { cs.transform(gctx) } -> std::same_as; + { cs.center(gctx) } -> std::same_as; + { cs.normal(gctx, Vector3{}, Vector3{}) } -> std::same_as; + { cs.bounds() } -> std::convertible_to; + { + cs.associatedDetectorElement() + } -> std::same_as; + + { cs.associatedLayer() } -> std::same_as; + { s.associateLayer(std::declval()) } -> std::same_as; + + { cs.surfaceMaterial() } -> std::same_as; + { + cs.surfaceMaterialSharedPtr() + } -> std::same_as&>; + { + s.assignSurfaceMaterial( + std::declval>()) + } -> std::same_as; + { + cs.isOnSurface(gctx, Vector3{}, Vector3{}, + std::declval()) + } -> std::same_as; + { + cs.insideBounds(Vector2{}, std::declval()) + } -> std::same_as; + + { cs.localToGlobal(gctx, Vector2{}, Vector3{}) } -> std::same_as; + + { + cs.globalToLocal(gctx, Vector3{}, Vector3{}, double{5}) + } -> std::same_as>; + + { + cs.referenceFrame(gctx, Vector3{}, Vector3{}) + } -> std::same_as; + + { + cs.boundToFreeJacobian(gctx, BoundVector{}) + } -> std::same_as; + + { + cs.boundToFreeJacobian(gctx, BoundVector{}) + } -> std::same_as; + + { + cs.freeToBoundJacobian(gctx, FreeVector{}) + } -> std::same_as; + + { + cs.freeToPathDerivative(gctx, FreeVector{}) + } -> std::same_as; + + { cs.pathCorrection(gctx, Vector3{}, Vector3{}) } -> std::same_as; + + { + cs.intersect(gctx, Vector3{}, Vector3{}, + std::declval(), std::declval()) + } -> std::same_as; + + { + cs.toStream(gctx, std::declval()) + } -> std::same_as; + + { cs.toString(gctx) } -> std::same_as; + + { cs.name() } -> std::same_as; + + { + cs.polyhedronRepresentation(gctx, std::declval()) + } -> std::same_as; + + { + cs.alignmentToBoundDerivative(gctx, FreeVector{}, FreeVector{}) + } -> std::same_as; + + { + cs.alignmentToPathDerivative(gctx, FreeVector{}) + } -> std::same_as; + + { + cs.localCartesianToBoundLocalDerivative(gctx, Vector3{}) + } -> std::same_as>; +}; + +template +concept RegularSurfaceConcept = SurfaceConcept && + requires(S s, const S cs, GeometryContext gctx) { + { cs.normal(gctx, Vector2{}) } -> std::same_as; + + { cs.normal(gctx, Vector3{}) } -> std::same_as; + + { + cs.globalToLocal(gctx, Vector3{}, Vector3{}, std::declval()) + } -> std::same_as>; + + { cs.localToGlobal(gctx, Vector2{}) } -> std::same_as; +}; +} // namespace Acts + +#endif diff --git a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp index e9b9c036170..db40d174e31 100644 --- a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp +++ b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp @@ -395,7 +395,7 @@ class CombinatorialKalmanFilter { if (!result.filtered && filterTargetReached(state, stepper, navigator, logger())) { navigator.navigationBreak(state.navigation, true); - stepper.releaseStepSize(state.stepping); + stepper.releaseStepSize(state.stepping, ConstrainedStep::actor); } // Update: diff --git a/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp b/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp index 59b12e53f87..967de0f42aa 100644 --- a/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp +++ b/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp @@ -105,7 +105,7 @@ struct Gx2FitterOptions { /// @param freeToBoundCorrection_ Correction for non-linearity effect during transform from free to bound /// @param nUpdateMax_ Max number of iterations for updating the parameters /// @param zeroField_ Disables the QoP fit in case of missing B-field - /// @param relChi2changeCutOff_ Check for convergence (abort condition) + /// @param relChi2changeCutOff_ Check for convergence (abort condition). Set to 0 to skip. Gx2FitterOptions(const GeometryContext& gctx, const MagneticFieldContext& mctx, std::reference_wrapper cctx, diff --git a/Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/TrackFitterFunction.hpp b/Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/TrackFitterFunction.hpp index f272d217772..5850b94198e 100644 --- a/Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/TrackFitterFunction.hpp +++ b/Examples/Algorithms/TrackFitting/include/ActsExamples/TrackFitting/TrackFitterFunction.hpp @@ -104,6 +104,9 @@ std::shared_ptr makeGsfFitterFunction( /// @param multipleScattering bool /// @param energyLoss bool /// @param freeToBoundCorrection bool +/// @param nUpdateMax max number of iterations during the fit +/// @param zerofield Disables the QoP fit in case of missing B-field. +/// @param relChi2changeCutOff Check for convergence (abort condition). Set to 0 to skip. /// @param logger a logger instance std::shared_ptr makeGlobalChiSquareFitterFunction( std::shared_ptr trackingGeometry, @@ -111,6 +114,8 @@ std::shared_ptr makeGlobalChiSquareFitterFunction( bool multipleScattering = true, bool energyLoss = true, Acts::FreeToBoundCorrection freeToBoundCorrection = Acts::FreeToBoundCorrection(), + std::size_t nUpdateMax = 5, bool zeroField = false, + double relChi2changeCutOff = 1e-7, const Acts::Logger& logger = *Acts::getDefaultLogger("Gx2f", Acts::Logging::INFO)); diff --git a/Examples/Algorithms/TrackFitting/src/GlobalChiSquareFitterFunction.cpp b/Examples/Algorithms/TrackFitting/src/GlobalChiSquareFitterFunction.cpp index a641f93de0e..e2bc9115db0 100644 --- a/Examples/Algorithms/TrackFitting/src/GlobalChiSquareFitterFunction.cpp +++ b/Examples/Algorithms/TrackFitting/src/GlobalChiSquareFitterFunction.cpp @@ -68,6 +68,9 @@ struct GlobalChiSquareFitterFunctionImpl final : public TrackFitterFunction { bool multipleScattering = false; bool energyLoss = false; Acts::FreeToBoundCorrection freeToBoundCorrection; + std::size_t nUpdateMax = 5; + bool zeroField = false; + double relChi2changeCutOff = 1e-7; IndexSourceLink::SurfaceAccessor m_slSurfaceAccessor; @@ -91,7 +94,8 @@ struct GlobalChiSquareFitterFunctionImpl final : public TrackFitterFunction { const Acts::Experimental::Gx2FitterOptions gx2fOptions( options.geoContext, options.magFieldContext, options.calibrationContext, extensions, options.propOptions, &(*options.referenceSurface), - multipleScattering, energyLoss, freeToBoundCorrection, 5); + multipleScattering, energyLoss, freeToBoundCorrection, nUpdateMax, + zeroField, relChi2changeCutOff); return gx2fOptions; } @@ -127,8 +131,8 @@ ActsExamples::makeGlobalChiSquareFitterFunction( std::shared_ptr trackingGeometry, std::shared_ptr magneticField, bool multipleScattering, bool energyLoss, - Acts::FreeToBoundCorrection freeToBoundCorrection, - const Acts::Logger& logger) { + Acts::FreeToBoundCorrection freeToBoundCorrection, std::size_t nUpdateMax, + bool zeroField, double relChi2changeCutOff, const Acts::Logger& logger) { // Stepper should be copied into the fitters const Stepper stepper(std::move(magneticField)); @@ -157,6 +161,9 @@ ActsExamples::makeGlobalChiSquareFitterFunction( fitterFunction->multipleScattering = multipleScattering; fitterFunction->energyLoss = energyLoss; fitterFunction->freeToBoundCorrection = freeToBoundCorrection; + fitterFunction->nUpdateMax = nUpdateMax; + fitterFunction->zeroField = zeroField; + fitterFunction->relChi2changeCutOff = relChi2changeCutOff; return fitterFunction; } diff --git a/Examples/Python/python/acts/examples/reconstruction.py b/Examples/Python/python/acts/examples/reconstruction.py index 7ab4c4a072e..cfc8de476ff 100644 --- a/Examples/Python/python/acts/examples/reconstruction.py +++ b/Examples/Python/python/acts/examples/reconstruction.py @@ -1113,10 +1113,12 @@ def addGx2fTracks( s: acts.examples.Sequencer, trackingGeometry: acts.TrackingGeometry, field: acts.MagneticFieldProvider, - # directNavigation: bool = False, inputProtoTracks: str = "truth_particle_tracks", multipleScattering: bool = False, energyLoss: bool = False, + nUpdateMax: int = 5, + zeroField: bool = False, + relChi2changeCutOff: float = 1e-7, clusters: str = None, calibrator: acts.examples.MeasurementCalibrator = acts.examples.makePassThroughCalibrator(), logLevel: Optional[acts.logging.Level] = None, @@ -1127,6 +1129,9 @@ def addGx2fTracks( "multipleScattering": multipleScattering, "energyLoss": energyLoss, "freeToBoundCorrection": acts.examples.FreeToBoundCorrection(False), + "nUpdateMax": nUpdateMax, + "zeroField": zeroField, + "relChi2changeCutOff": relChi2changeCutOff, "level": customLogLevel(), } diff --git a/Examples/Python/src/TrackFitting.cpp b/Examples/Python/src/TrackFitting.cpp index 97091012c3d..ae6028c94c3 100644 --- a/Examples/Python/src/TrackFitting.cpp +++ b/Examples/Python/src/TrackFitting.cpp @@ -138,17 +138,17 @@ void addTrackFitting(Context& ctx) { std::shared_ptr magneticField, bool multipleScattering, bool energyLoss, Acts::FreeToBoundCorrection freeToBoundCorrection, + std::size_t nUpdateMax, bool zeroField, double relChi2changeCutOff, Logging::Level level) { return ActsExamples::makeGlobalChiSquareFitterFunction( trackingGeometry, magneticField, multipleScattering, energyLoss, - freeToBoundCorrection, *Acts::getDefaultLogger("Gx2f", level)); + freeToBoundCorrection, nUpdateMax, zeroField, relChi2changeCutOff, + *Acts::getDefaultLogger("Gx2f", level)); }, py::arg("trackingGeometry"), py::arg("magneticField"), py::arg("multipleScattering"), py::arg("energyLoss"), - py::arg("freeToBoundCorrection"), py::arg("level")); - - // TODO add other important parameters like nUpdates - // TODO add also in trackfitterfunction + py::arg("freeToBoundCorrection"), py::arg("nUpdateMax"), + py::arg("zeroField"), py::arg("relChi2changeCutOff"), py::arg("level")); } { diff --git a/Examples/Python/tests/root_file_hashes.txt b/Examples/Python/tests/root_file_hashes.txt index 84a4d82d2dc..ade2c97a26f 100644 --- a/Examples/Python/tests/root_file_hashes.txt +++ b/Examples/Python/tests/root_file_hashes.txt @@ -50,7 +50,7 @@ test_digitization_example_input[smeared]__measurements.root: 2e4fd9d3e6244e53486 test_digitization_example_input[geometric]__particles.root: 8549ba6e20338004ab8ba299fc65e1ee5071985b46df8f77f887cb6fef56a8ec test_digitization_example_input[geometric]__measurements.root: 20128357c9238926d628d18b3b91a0a73947b2b5682762bf5d8fd94342faf976 test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: 5ddcc228073553ba14205897451951ea475541643bb677e7718bd3369b484bcd -test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: 6ccdd72caf4d645debea57fc823d5ceedb74c70b9832b3a906ae4a06ac8fe796 +test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: afa6eaffe366533d343c78685015a10f71f8f49b318431878a1bb49098bcbfc4 test_ckf_tracks_example[generic-full_seeding]__performance_seeding_trees.root: 0e0676ffafdb27112fbda50d1cf627859fa745760f98073261dcf6db3f2f991e test_ckf_tracks_example[generic-truth_estimated]__trackstates_ckf.root: 10ecbc093239670b0a116fad5a25caf941f2a401a03892a6853652d20ee98a67 test_ckf_tracks_example[generic-truth_estimated]__tracksummary_ckf.root: 068c236fd9f52801eb39e72498c7ec37857523a617d77b5987db4bfb736c6f88 @@ -58,13 +58,13 @@ test_ckf_tracks_example[generic-truth_estimated]__performance_seeding.root: 1fac test_ckf_tracks_example[generic-truth_smeared]__trackstates_ckf.root: 4c081f8d984b7a9eb680ddc870d03ada2f3bbbb6fb0e41877720e449b82b87d8 test_ckf_tracks_example[generic-truth_smeared]__tracksummary_ckf.root: 3ac06b38c59d673099dd4474320423932c84eea47b226fad887ed1c2c83d18c1 test_ckf_tracks_example[odd-full_seeding]__trackstates_ckf.root: f8511a029465842e39894bbb6054bc330747e0948e686787aa9f90fea2e59102 -test_ckf_tracks_example[odd-full_seeding]__tracksummary_ckf.root: 24eea0bc0c0c2a790fbf8038e0bd84c62325bccc9c9bc580f66c27e7a35654c3 +test_ckf_tracks_example[odd-full_seeding]__tracksummary_ckf.root: fd2e99f7fef639aeb55991a55d31310f3a2e173c04d81010e4f60aba850be68d test_ckf_tracks_example[odd-full_seeding]__performance_seeding_trees.root: 43c58577aafe07645e5660c4f43904efadf91d8cda45c5c04c248bbe0f59814f test_ckf_tracks_example[odd-truth_estimated]__trackstates_ckf.root: f244ea1201fedaec0619d595945d33d976fc1e09e8d218e16ea0737f35debe0f -test_ckf_tracks_example[odd-truth_estimated]__tracksummary_ckf.root: f7b683c6c0c8a57dd61bd3ba2965bf5f689a6eb9c2e8c8e8e13a7907ea7411a3 +test_ckf_tracks_example[odd-truth_estimated]__tracksummary_ckf.root: 91ce6097ba491dd83529e60a08fb97459f2e221af553545c600db209358d299a test_ckf_tracks_example[odd-truth_estimated]__performance_seeding.root: 1a36b7017e59f1c08602ef3c2cb0483c51df248f112e3780c66594110719c575 test_ckf_tracks_example[odd-truth_smeared]__trackstates_ckf.root: cee2ef40dbc341861a9abac8e4d2503240c5522d9fef6edf30fa163129f17cef -test_ckf_tracks_example[odd-truth_smeared]__tracksummary_ckf.root: 6a8e6ef7c5a2b17b58d3c551e951a4cfb894c795e5c91df8b4499b5688020ee1 +test_ckf_tracks_example[odd-truth_smeared]__tracksummary_ckf.root: 1ec3257d7eccedd73bde17f3554e2bce1f4402a169b6003b3908d25833decd40 test_vertex_fitting_reading[Truth-False-100]__performance_vertexing.root: 76ef6084d758dfdfc0151ddec2170e12d73394424e3dac4ffe46f0f339ec8293 test_vertex_fitting_reading[Iterative-False-100]__performance_vertexing.root: 60372210c830a04f95ceb78c6c68a9b0de217746ff59e8e73053750c837b57eb test_vertex_fitting_reading[Iterative-True-100]__performance_vertexing.root: e34f217d524a5051dbb04a811d3407df3ebe2cc4bb7f54f6bda0847dbd7b52c3 diff --git a/Examples/Scripts/Python/truth_tracking_gx2f.py b/Examples/Scripts/Python/truth_tracking_gx2f.py index 2645841c258..4566dac4350 100644 --- a/Examples/Scripts/Python/truth_tracking_gx2f.py +++ b/Examples/Scripts/Python/truth_tracking_gx2f.py @@ -95,12 +95,13 @@ def runTruthTrackingGx2f( s, trackingGeometry, field, - # directNavigation, + nUpdateMax=17, + relChi2changeCutOff=1e-7, ) # Output s.addWriter( - acts.examples.RootTrajectoryStatesWriter( + acts.examples.RootTrackStatesWriter( level=acts.logging.INFO, inputTracks="tracks", inputParticles="truth_seeds_selected", @@ -112,7 +113,7 @@ def runTruthTrackingGx2f( ) s.addWriter( - acts.examples.RootTrajectorySummaryWriter( + acts.examples.RootTrackSummaryWriter( level=acts.logging.INFO, inputTracks="tracks", inputParticles="truth_seeds_selected", diff --git a/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp b/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp index 9195080817c..0658adeb9fc 100644 --- a/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp +++ b/Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp @@ -148,8 +148,8 @@ struct SimulationActor { const auto stepSize = properTimeDiff * result.particle.absoluteMomentum() / result.particle.mass(); - stepper.setStepSize(state.stepping, stepSize, - Acts::ConstrainedStep::user); + stepper.updateStepSize(state.stepping, stepSize, + Acts::ConstrainedStep::user); } // arm the point-like interaction limits in the first step diff --git a/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp b/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp index 6b778570a4a..1215f144b85 100644 --- a/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/AtlasStepperTests.cpp @@ -561,11 +561,11 @@ BOOST_AUTO_TEST_CASE(StepSize) { // TODO figure out why this fails and what it should be // BOOST_CHECK_EQUAL(stepper.overstepLimit(state), tolerance); - stepper.setStepSize(state, -5_cm); + stepper.updateStepSize(state, -5_cm, ConstrainedStep::actor); BOOST_CHECK_EQUAL(state.previousStepSize, stepSize); BOOST_CHECK_EQUAL(state.stepSize.value(), -5_cm); - stepper.releaseStepSize(state); + stepper.releaseStepSize(state, ConstrainedStep::actor); BOOST_CHECK_EQUAL(state.stepSize.value(), stepSize); } diff --git a/Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp b/Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp index dc35160fb67..78168544535 100644 --- a/Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/EigenStepperTests.cpp @@ -267,11 +267,11 @@ BOOST_AUTO_TEST_CASE(eigen_stepper_test) { // Step size modifies const std::string originalStepSize = esState.stepSize.toString(); - es.setStepSize(esState, -1337.); + es.updateStepSize(esState, -1337., ConstrainedStep::actor); BOOST_CHECK_EQUAL(esState.previousStepSize, stepSize); BOOST_CHECK_EQUAL(esState.stepSize.value(), -1337.); - es.releaseStepSize(esState); + es.releaseStepSize(esState, ConstrainedStep::actor); BOOST_CHECK_EQUAL(esState.stepSize.value(), stepSize); BOOST_CHECK_EQUAL(es.outputStepSize(esState), originalStepSize); diff --git a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp index 020e3238b20..4465065cf28 100644 --- a/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp +++ b/Tests/UnitTests/Core/Propagator/NavigatorTests.cpp @@ -159,9 +159,9 @@ struct PropagatorState { detail::updateSingleStepSize(state, oIntersection, release); } - void setStepSize(State& state, double stepSize, - ConstrainedStep::Type stype = ConstrainedStep::actor, - bool release = true) const { + void updateStepSize(State& state, double stepSize, + ConstrainedStep::Type stype, + bool release = true) const { state.previousStepSize = state.stepSize.value(); state.stepSize.update(stepSize, stype, release); } @@ -170,8 +170,8 @@ struct PropagatorState { return state.stepSize.value(stype); } - void releaseStepSize(State& state) const { - state.stepSize.release(ConstrainedStep::actor); + void releaseStepSize(State& state, ConstrainedStep::Type stype) const { + state.stepSize.release(stype); } std::string outputStepSize(const State& state) const { diff --git a/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp b/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp index 6901cbdabe4..a930ee9372a 100644 --- a/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp +++ b/Tests/UnitTests/Core/Propagator/StraightLineStepperTests.cpp @@ -158,11 +158,11 @@ BOOST_AUTO_TEST_CASE(straight_line_stepper_test) { // Step size modifies const std::string originalStepSize = slsState.stepSize.toString(); - sls.setStepSize(slsState, -1337.); + sls.updateStepSize(slsState, -1337., ConstrainedStep::actor); BOOST_CHECK_EQUAL(slsState.previousStepSize, stepSize); BOOST_CHECK_EQUAL(slsState.stepSize.value(), -1337.); - sls.releaseStepSize(slsState); + sls.releaseStepSize(slsState, ConstrainedStep::actor); BOOST_CHECK_EQUAL(slsState.stepSize.value(), stepSize); BOOST_CHECK_EQUAL(sls.outputStepSize(slsState), originalStepSize); diff --git a/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp b/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp index 6fa2fb7036d..3363bb5d098 100644 --- a/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp +++ b/Tests/UnitTests/Core/Surfaces/SurfaceStub.hpp @@ -14,6 +14,8 @@ #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/RegularSurface.hpp" #include "Acts/Surfaces/Surface.hpp" +#include "Acts/Surfaces/SurfaceConcept.hpp" +#include "Acts/Utilities/Concepts.hpp" #include "Acts/Utilities/Intersection.hpp" namespace Acts { @@ -57,6 +59,8 @@ class SurfaceStub : public RegularSurface { return Vector3(0., 0., 0.); } + using RegularSurface::localToGlobal; + /// Global to local transformation Result globalToLocal(const GeometryContext& /*cxt*/, const Vector3& /*gpos*/, @@ -64,6 +68,8 @@ class SurfaceStub : public RegularSurface { return Result::success(Vector2{20., 20.}); } + using RegularSurface::globalToLocal; + /// Calculation of the path correction for incident double pathCorrection(const GeometryContext& /*cxt*/, const Vector3& /*gpos*/, const Vector3& /*gmom*/) const final { @@ -115,4 +121,7 @@ class SurfaceStub : public RegularSurface { /// the bounds of this surface std::shared_ptr m_bounds; }; + +ACTS_STATIC_CHECK_CONCEPT(RegularSurfaceConcept, SurfaceStub); + } // namespace Acts diff --git a/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp b/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp index 8c1c2858d2b..8faae37c44c 100644 --- a/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp +++ b/Tests/UnitTests/Fatras/Kernel/SimulationActorTests.cpp @@ -119,8 +119,8 @@ struct MockStepper { state.dir = dir; state.p = 1 / qop; } - void setStepSize(State & /*state*/, double /*stepSize*/, - Acts::ConstrainedStep::Type /*stype*/) const {} + void updateStepSize(State & /*state*/, double /*stepSize*/, + Acts::ConstrainedStep::Type /*stype*/) const {} }; struct MockNavigatorState {