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