File indexing completed on 2025-09-15 08:14:04
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/Intersection.hpp"
0014
0015 #include <algorithm>
0016
0017 #include <boost/container/small_vector.hpp>
0018
0019 namespace Acts {
0020
0021 void GenericApproachDescriptor::registerLayer(const Layer& lay) {
0022
0023 for (auto& sf : m_surfaceCache) {
0024 auto mutableSf = const_cast<Surface*>(sf);
0025 mutableSf->associateLayer(lay);
0026 }
0027 }
0028
0029 SurfaceIntersection GenericApproachDescriptor::approachSurface(
0030 const GeometryContext& gctx, const Vector3& position,
0031 const Vector3& direction, const BoundaryTolerance& boundaryTolerance,
0032 double nearLimit, double farLimit) const {
0033
0034 boost::container::small_vector<SurfaceIntersection, 4> sIntersections;
0035 sIntersections.reserve(m_surfaceCache.size());
0036 for (const auto& sf : m_surfaceCache) {
0037 auto sfIntersection =
0038 sf->intersect(gctx, position, direction, boundaryTolerance);
0039 for (const auto& intersection : sfIntersection.split()) {
0040 if (intersection.isValid() &&
0041 detail::checkPathLength(intersection.pathLength(), nearLimit,
0042 farLimit)) {
0043 sIntersections.push_back(intersection);
0044 }
0045 }
0046 }
0047 if (sIntersections.empty()) {
0048 return SurfaceIntersection::invalid();
0049 }
0050 return *std::min_element(sIntersections.begin(), sIntersections.end(),
0051 SurfaceIntersection::pathLengthOrder);
0052 }
0053
0054 const std::vector<const Surface*>&
0055 GenericApproachDescriptor::containedSurfaces() const {
0056 return m_surfaceCache;
0057 }
0058
0059 std::vector<const Surface*>& GenericApproachDescriptor::containedSurfaces() {
0060 return m_surfaceCache;
0061 }
0062
0063 }