From 90dde799ebcc73137e6f02996f4f88322b4f6c16 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Wed, 28 Aug 2024 21:18:32 +0200 Subject: [PATCH 01/15] refactor!: Fuse `Actor` and `Aborter` --- .../Material/PropagatorMaterialAssigner.hpp | 24 ++-- Core/include/Acts/Propagator/AbortList.hpp | 115 ------------------ Core/include/Acts/Propagator/ActionList.hpp | 94 -------------- .../Propagator/DenseEnvironmentExtension.hpp | 3 +- .../Acts/Propagator/MaterialInteractor.hpp | 14 ++- .../Acts/Propagator/MultiStepperAborters.hpp | 13 +- Core/include/Acts/Propagator/Propagator.hpp | 62 +++++----- Core/include/Acts/Propagator/Propagator.ipp | 92 +++++++------- .../Acts/Propagator/PropagatorOptions.hpp | 40 +++--- .../Acts/Propagator/RiddersPropagator.hpp | 35 +++--- .../Acts/Propagator/RiddersPropagator.ipp | 21 ++-- .../Acts/Propagator/StandardAborters.hpp | 37 ++++-- .../Acts/Propagator/SurfaceCollector.hpp | 14 ++- .../Acts/Propagator/VolumeCollector.hpp | 14 ++- .../Acts/Propagator/detail/SteppingLogger.hpp | 16 ++- .../detail/abort_list_implementation.hpp | 108 ---------------- .../detail/action_list_implementation.hpp | 96 --------------- .../CombinatorialKalmanFilter.hpp | 62 +++++----- .../Acts/TrackFitting/GaussianSumFitter.hpp | 50 +++----- .../TrackFitting/GlobalChiSquareFitter.hpp | 37 ++---- .../Acts/TrackFitting/KalmanFitter.hpp | 67 ++++------ .../Acts/TrackFitting/detail/GsfActor.hpp | 14 ++- Core/src/Material/SurfaceMaterialMapper.cpp | 12 +- Core/src/Material/VolumeMaterialMapper.cpp | 11 +- .../Propagation/PropagatorInterface.hpp | 12 +- .../src/TrackFindingAlgorithm.cpp | 6 +- .../include/ActsFatras/Kernel/Simulation.hpp | 11 +- .../Kernel/detail/SimulationActor.hpp | 35 ++---- .../CommonHelpers/MeasurementsCreator.hpp | 28 +++-- .../IntegrationTests/NavigatorConsistency.cpp | 24 ++-- .../PropagationBentTracks.cpp | 4 +- .../Material/VolumeMaterialMapperTests.cpp | 19 ++- .../Navigation/DetectorNavigatorTests.cpp | 37 +++--- .../Core/Propagator/DirectNavigatorTests.cpp | 18 ++- .../Core/Propagator/EigenStepperTests.cpp | 57 +++++---- .../Core/Propagator/ExtrapolatorTests.cpp | 10 +- .../Propagator/KalmanExtrapolatorTests.cpp | 26 ++-- .../Core/Propagator/LoopProtectionTests.cpp | 7 +- .../Propagator/MaterialCollectionTests.cpp | 19 ++- .../Core/Propagator/PropagatorTests.cpp | 39 +++--- .../Core/Propagator/SympyStepperTests.cpp | 3 +- .../Fatras/Kernel/SimulationActorTests.cpp | 33 +++-- docs/core/propagation.md | 2 +- 43 files changed, 515 insertions(+), 926 deletions(-) delete mode 100644 Core/include/Acts/Propagator/AbortList.hpp delete mode 100644 Core/include/Acts/Propagator/ActionList.hpp delete mode 100644 Core/include/Acts/Propagator/detail/abort_list_implementation.hpp delete mode 100644 Core/include/Acts/Propagator/detail/action_list_implementation.hpp diff --git a/Core/include/Acts/Material/PropagatorMaterialAssigner.hpp b/Core/include/Acts/Material/PropagatorMaterialAssigner.hpp index 6cb85d74e75..ca54a7b08d7 100644 --- a/Core/include/Acts/Material/PropagatorMaterialAssigner.hpp +++ b/Core/include/Acts/Material/PropagatorMaterialAssigner.hpp @@ -12,8 +12,7 @@ #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/MagneticField/MagneticFieldContext.hpp" #include "Acts/Material/interface/IAssignmentFinder.hpp" -#include "Acts/Propagator/AbortList.hpp" -#include "Acts/Propagator/ActionList.hpp" +#include "Acts/Propagator/ActorList.hpp" #include "Acts/Propagator/Propagator.hpp" #include "Acts/Propagator/SurfaceCollector.hpp" #include "Acts/Surfaces/Surface.hpp" @@ -62,9 +61,9 @@ struct InteractionVolumeCollector { /// @param [in,out] result is the mutable result object template - void operator()(propagator_state_t& state, const stepper_t& stepper, - const navigator_t& navigator, result_type& result, - const Logger& /*logger*/) const { + void act(propagator_state_t& state, const stepper_t& stepper, + const navigator_t& navigator, result_type& result, + const Logger& /*logger*/) const { // Retrieve the current volume auto currentVolume = navigator.currentVolume(state.navigation); @@ -85,6 +84,14 @@ struct InteractionVolumeCollector { } } } + + template + bool check(propagator_state_t& /*state*/, const stepper_t& /*stepper*/, + const navigator_t& /*navigator*/, result_type& /*result*/, + const Logger& /*logger*/) const { + return false; + } }; /// @class PropagatorMaterialAssigner @@ -131,11 +138,10 @@ class PropagatorMaterialAssigner final : public IAssignmentFinder { // Prepare Action list and abort list using MaterialSurfaceCollector = SurfaceCollector; - using ActionList = - ActionList; - using AbortList = AbortList; + using ActorList = ActorList; using PropagatorOptions = - typename propagator_t::template Options; + typename propagator_t::template Options; PropagatorOptions options(gctx, mctx); diff --git a/Core/include/Acts/Propagator/AbortList.hpp b/Core/include/Acts/Propagator/AbortList.hpp deleted file mode 100644 index d18b1b991a3..00000000000 --- a/Core/include/Acts/Propagator/AbortList.hpp +++ /dev/null @@ -1,115 +0,0 @@ -// This file is part of the Acts project. -// -// Copyright (C) 2016-2018 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/Propagator/detail/abort_list_implementation.hpp" -#include "Acts/Utilities/detail/Extendable.hpp" -#include "Acts/Utilities/detail/MPL/has_duplicates.hpp" -#include "Acts/Utilities/detail/MPL/type_collector.hpp" - -#include -#include - -namespace hana = boost::hana; - -namespace Acts { - -/// @brief AbortList object to be used in the propagation -/// -/// The abort list is a list of structs or classes that -/// is called at each propagation step and can trigger the abort -/// of the current propagation. -/// -/// It can (optionally) depend on a result of an Actor from -/// the actor list. -template -struct AbortList : public detail::Extendable { - private: - static_assert(!detail::has_duplicates_v, - "same aborter type specified several times"); - - using detail::Extendable::tuple; - - public: - /// @cond - // This uses the type collector - using result_type = typename decltype(hana::unpack( - detail::type_collector_t, - hana::template_))::type; - /// @endcond - - using detail::Extendable::get; - - /// Default constructor - AbortList() = default; - - /// Default copy constructor - /// - /// @param aborters The source action list - AbortList(const AbortList& aborters) = default; - - /// Default move constructor - /// - /// @param aborters The source action list - AbortList(AbortList&& aborters) = default; - - /// Default move assignment operator - /// - /// @param aborters The source action list - AbortList& operator=( - const AbortList& aborters) = default; - - /// Default move assignment operator - /// - /// @param aborters The source action list - AbortList& operator=(AbortList&& aborters) = - default; - - /// Constructor from tuple - /// - /// @param aborters Source extensions tuple - AbortList(const std::tuple& aborters) - : detail::Extendable(aborters) {} - - /// Constructor from tuple move - /// - /// @param aborters Source extensions tuple - AbortList(std::tuple&& aborters) - : detail::Extendable(std::move(aborters)) {} - - /// Append new entries and return a new condition - template - AbortList append(appendices_t... aps) const { - auto catTuple = - std::tuple_cat(tuple(), std::tuple(aps...)); - return AbortList(std::move(catTuple)); - } - - /// This is the call signature for the abort list, it broadcasts the call - /// to the tuple() members of the list - /// - /// @tparam propagator_state_t is the state type of the propagator - /// @tparam stepper_t Type of the stepper - /// @tparam navigator_t Type of the navigator - /// - /// @param [in,out] state is the state object from the propagator - /// @param [in] stepper Stepper used for the propagation - /// @param [in] navigator Navigator used for the propagation - /// @param [in] args are the arguments to be passed to the aborters - template - bool operator()(propagator_state_t& state, const stepper_t& stepper, - const navigator_t& navigator, Args&&... args) const { - using impl = detail::abort_list_impl; - return impl::check(tuple(), state, stepper, navigator, - std::forward(args)...); - } -}; - -} // namespace Acts diff --git a/Core/include/Acts/Propagator/ActionList.hpp b/Core/include/Acts/Propagator/ActionList.hpp deleted file mode 100644 index 5ae6f85ff2e..00000000000 --- a/Core/include/Acts/Propagator/ActionList.hpp +++ /dev/null @@ -1,94 +0,0 @@ -// This file is part of the Acts project. -// -// Copyright (C) 2016-2018 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/Propagator/detail/action_list_implementation.hpp" -#include "Acts/Utilities/detail/Extendable.hpp" -#include "Acts/Utilities/detail/MPL/all_of.hpp" -#include "Acts/Utilities/detail/MPL/has_duplicates.hpp" -#include "Acts/Utilities/detail/MPL/type_collector.hpp" - -#include -#include - -namespace hana = boost::hana; - -namespace Acts { - -/// @brief ActionList implementation to be used with the propagator -/// -/// This is the ActionList struct that is used in the propagator -/// to define a list of different actors_t that are each -/// executed during the stepping procedure -template -struct ActionList : public detail::Extendable { - private: - static_assert(!detail::has_duplicates_v, - "same action type specified several times"); - - using detail::Extendable::tuple; - - public: - /// @cond - // This uses the type collector and unpacks using the `R` meta function - template