File indexing completed on 2025-10-16 08:02:15
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 struct MultiStepperSurfaceReached : public ForcedSurfaceReached {
0018
0019
0020
0021 bool averageOnSurface = true;
0022
0023
0024
0025
0026 double averageOnSurfaceTolerance = 0.2;
0027
0028 MultiStepperSurfaceReached() = default;
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 template <typename propagator_state_t, typename stepper_t,
0041 typename navigator_t>
0042 bool checkAbort(propagator_state_t& state, const stepper_t& stepper,
0043 const navigator_t& navigator, const Logger& logger) const {
0044 if (surface == nullptr) {
0045 ACTS_VERBOSE(
0046 "MultiStepperSurfaceReached aborter | "
0047 "No target surface set.");
0048 return false;
0049 }
0050
0051
0052 if (averageOnSurface) {
0053 const Intersection3D intersection =
0054 surface
0055 ->intersect(
0056 state.geoContext, stepper.position(state.stepping),
0057 state.options.direction * stepper.direction(state.stepping),
0058 BoundaryTolerance(boundaryTolerance),
0059 averageOnSurfaceTolerance)
0060 .closest();
0061
0062 if (intersection.status() == IntersectionStatus::onSurface) {
0063 ACTS_VERBOSE(
0064 "MultiStepperSurfaceReached aborter | "
0065 "Reached target in average mode");
0066 for (auto cmp : stepper.componentIterable(state.stepping)) {
0067 cmp.status() = IntersectionStatus::onSurface;
0068 }
0069
0070 return true;
0071 }
0072
0073 ACTS_VERBOSE(
0074 "MultiStepperSurfaceReached aborter | Average distance to target: "
0075 << intersection.pathLength());
0076 }
0077
0078 bool reached = true;
0079
0080 for (auto cmp : stepper.componentIterable(state.stepping)) {
0081
0082 auto singleState = cmp.singleState(state);
0083 const auto& singleStepper = cmp.singleStepper(stepper);
0084
0085 if (!ForcedSurfaceReached::checkAbort(singleState, singleStepper,
0086 navigator, logger)) {
0087 reached = false;
0088 } else {
0089 cmp.status() = Acts::IntersectionStatus::onSurface;
0090 }
0091 }
0092
0093 if (reached) {
0094 ACTS_VERBOSE(
0095 "MultiStepperSurfaceReached aborter | "
0096 "Reached target in single component mode");
0097 }
0098
0099 return reached;
0100 }
0101 };
0102
0103 }