File indexing completed on 2025-10-17 07:59:00
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/GenericApproachDescriptor.hpp"
0010
0011 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0012 #include "Acts/Surfaces/Surface.hpp"
0013 #include "Acts/Utilities/Enumerate.hpp"
0014 #include "Acts/Utilities/Intersection.hpp"
0015
0016 #include <boost/container/small_vector.hpp>
0017
0018 namespace Acts {
0019
0020 void GenericApproachDescriptor::registerLayer(const Layer& lay) {
0021
0022 for (const Surface* surface : m_surfaceCache) {
0023 auto* mutableSurface = const_cast<Surface*>(surface);
0024 mutableSurface->associateLayer(lay);
0025 }
0026 }
0027
0028 NavigationTarget GenericApproachDescriptor::approachSurface(
0029 const GeometryContext& gctx, const Vector3& position,
0030 const Vector3& direction, const BoundaryTolerance& boundaryTolerance,
0031 double nearLimit, double farLimit) const {
0032
0033 boost::container::small_vector<NavigationTarget, 4> targets;
0034 targets.reserve(m_surfaceCache.size());
0035 for (const Surface* surface : m_surfaceCache) {
0036 auto multiIntersection =
0037 surface->intersect(gctx, position, direction, boundaryTolerance);
0038 for (auto [intersectionIndex, intersection] :
0039 Acts::enumerate(multiIntersection)) {
0040 if (intersection.isValid() &&
0041 detail::checkPathLength(intersection.pathLength(), nearLimit,
0042 farLimit)) {
0043 targets.emplace_back(intersection, intersectionIndex,
0044 *surface->associatedLayer(), *surface,
0045 boundaryTolerance);
0046 }
0047 }
0048 }
0049 if (targets.empty()) {
0050 return NavigationTarget::None();
0051 }
0052 return *std::ranges::min_element(targets, NavigationTarget::pathLengthOrder);
0053 }
0054
0055 const std::vector<const Surface*>&
0056 GenericApproachDescriptor::containedSurfaces() const {
0057 return m_surfaceCache;
0058 }
0059
0060 std::vector<const Surface*>& GenericApproachDescriptor::containedSurfaces() {
0061 return m_surfaceCache;
0062 }
0063
0064 }