File indexing completed on 2025-08-06 08:10:07
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
0014 namespace Acts {
0015
0016 struct MultiStepperSurfaceReached : public SurfaceReached {
0017
0018
0019
0020 bool averageOnSurface = true;
0021
0022
0023
0024
0025 double averageOnSurfaceTolerance = 0.2;
0026
0027 MultiStepperSurfaceReached() = default;
0028 MultiStepperSurfaceReached(double oLimit) : SurfaceReached(oLimit) {}
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 operator()(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 auto sIntersection =
0054 surface
0055 ->intersect(
0056 state.geoContext, stepper.position(state.stepping),
0057 state.options.direction * stepper.direction(state.stepping),
0058 BoundaryCheck(boundaryCheck), averageOnSurfaceTolerance)
0059 .closest();
0060
0061 if (sIntersection.status() == Intersection3D::Status::onSurface) {
0062 ACTS_VERBOSE(
0063 "MultiStepperSurfaceReached aborter | "
0064 "Reached target in average mode");
0065 for (auto cmp : stepper.componentIterable(state.stepping)) {
0066 cmp.status() = Intersection3D::Status::onSurface;
0067 }
0068
0069 return true;
0070 }
0071
0072 ACTS_VERBOSE(
0073 "MultiStepperSurfaceReached aborter | "
0074 "Target intersection not found. Maybe next time?");
0075 }
0076
0077 bool reached = true;
0078
0079 for (auto cmp : stepper.componentIterable(state.stepping)) {
0080
0081 auto singleState = cmp.singleState(state);
0082 const auto& singleStepper = cmp.singleStepper(stepper);
0083
0084 if (!SurfaceReached::operator()(singleState, singleStepper, navigator,
0085 logger)) {
0086 reached = false;
0087 } else {
0088 cmp.status() = Acts::Intersection3D::Status::onSurface;
0089 }
0090 }
0091
0092 if (reached) {
0093 ACTS_VERBOSE(
0094 "MultiStepperSurfaceReached aborter | "
0095 "Reached target in single component mode");
0096 }
0097
0098 return reached;
0099 }
0100 };
0101
0102 }