File indexing completed on 2026-09-12 08:19:05
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Propagator/StandardAborters.hpp"
0012 #include "Acts/Surfaces/Surface.hpp"
0013 #include "Acts/Utilities/Intersection.hpp"
0014
0015 namespace Acts {
0016
0017
0018 struct MultiStepperSurfaceReached : public ForcedSurfaceReached {
0019
0020
0021
0022 bool averageOnSurface = true;
0023
0024
0025
0026
0027 double averageOnSurfaceTolerance = 0.2;
0028
0029 MultiStepperSurfaceReached() = default;
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 template <typename propagator_state_t, typename stepper_t,
0043 typename navigator_t>
0044 bool checkAbort(propagator_state_t& state, const stepper_t& stepper,
0045 const navigator_t& navigator, const Logger& logger) const {
0046 if (surface == nullptr) {
0047 ACTS_VERBOSE(
0048 "MultiStepperSurfaceReached aborter | "
0049 "No target surface set.");
0050 return false;
0051 }
0052
0053
0054 if (averageOnSurface) {
0055 const Intersection3D intersection =
0056 surface
0057 ->intersect(
0058 state.geoContext, stepper.position(state.stepping),
0059 state.options.direction * stepper.direction(state.stepping),
0060 BoundaryTolerance(boundaryTolerance),
0061 averageOnSurfaceTolerance)
0062 .closest();
0063
0064 if (intersection.status() == IntersectionStatus::onSurface) {
0065 ACTS_VERBOSE(
0066 "MultiStepperSurfaceReached aborter | "
0067 "Reached target in average mode");
0068 for (auto cmp : stepper.componentIterable(state.stepping)) {
0069 cmp.status() = IntersectionStatus::onSurface;
0070 }
0071
0072 return true;
0073 }
0074
0075 ACTS_VERBOSE(
0076 "MultiStepperSurfaceReached aborter | Average distance to target: "
0077 << intersection.pathLength());
0078 }
0079
0080 bool reached = true;
0081
0082 for (auto cmp : stepper.componentIterable(state.stepping)) {
0083
0084 auto singleState = cmp.singleState(state);
0085 const auto& singleStepper = cmp.singleStepper(stepper);
0086
0087 if (!ForcedSurfaceReached::checkAbort(singleState, singleStepper,
0088 navigator, logger)) {
0089 reached = false;
0090 } else {
0091 cmp.status() = Acts::IntersectionStatus::onSurface;
0092 }
0093 }
0094
0095 if (reached) {
0096 ACTS_VERBOSE(
0097 "MultiStepperSurfaceReached aborter | "
0098 "Reached target in single component mode");
0099 }
0100
0101 return reached;
0102 }
0103 };
0104
0105 }