File indexing completed on 2025-08-05 08:09:36
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/GenericApproachDescriptor.hpp"
0010
0011 #include "Acts/Surfaces/Surface.hpp"
0012 #include "Acts/Utilities/Intersection.hpp"
0013
0014 #include <algorithm>
0015
0016 #include <boost/container/small_vector.hpp>
0017
0018 void Acts::GenericApproachDescriptor::registerLayer(const Layer& lay) {
0019
0020 for (auto& sf : m_surfaceCache) {
0021 auto mutableSf = const_cast<Surface*>(sf);
0022 mutableSf->associateLayer(lay);
0023 }
0024 }
0025
0026 Acts::SurfaceIntersection Acts::GenericApproachDescriptor::approachSurface(
0027 const GeometryContext& gctx, const Vector3& position,
0028 const Vector3& direction, const BoundaryCheck& bcheck, double nearLimit,
0029 double farLimit) const {
0030
0031 boost::container::small_vector<SurfaceIntersection, 4> sIntersections;
0032 sIntersections.reserve(m_surfaceCache.size());
0033 for (const auto& sf : m_surfaceCache) {
0034 auto sfIntersection = sf->intersect(gctx, position, direction, bcheck);
0035 for (const auto& intersection : sfIntersection.split()) {
0036 if (intersection &&
0037 detail::checkIntersection(intersection, nearLimit, farLimit)) {
0038 sIntersections.push_back(intersection);
0039 }
0040 }
0041 }
0042 if (sIntersections.empty()) {
0043 return SurfaceIntersection::invalid();
0044 }
0045 return *std::min_element(sIntersections.begin(), sIntersections.end(),
0046 SurfaceIntersection::pathLengthOrder);
0047 }
0048
0049 const std::vector<const Acts::Surface*>&
0050 Acts::GenericApproachDescriptor::containedSurfaces() const {
0051 return m_surfaceCache;
0052 }
0053
0054 std::vector<const Acts::Surface*>&
0055 Acts::GenericApproachDescriptor::containedSurfaces() {
0056 return m_surfaceCache;
0057 }