EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GenericApproachDescriptor.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GenericApproachDescriptor.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
13 
15  // go through the surfaces
16  for (auto& sf : m_surfaceCache) {
17  auto mutableSf = const_cast<Surface*>(sf);
18  mutableSf->associateLayer(lay);
19  }
20 }
21 
24  const GeometryContext& gctx, const Vector3D& position,
25  const Vector3D& direction, const BoundaryCheck& bcheck) const {
26  std::vector<ObjectIntersection<Surface>> sIntersections;
27  sIntersections.reserve(m_surfaceCache.size());
28  for (auto& sf : m_surfaceCache) {
29  auto sfIntersection = sf->intersect(gctx, position, direction, bcheck);
30  // Overstepping is not allowed for approach surfaces
31  if (sfIntersection.intersection.pathLength < 0. and
32  sfIntersection.alternative.pathLength > 0.) {
33  std::swap(sfIntersection.intersection, sfIntersection.alternative);
34  }
35  sIntersections.push_back(sfIntersection);
36  }
37  // Sort them & return the closest
38  std::sort(sIntersections.begin(), sIntersections.end());
39  return (*sIntersections.begin());
40 }
41 
42 const std::vector<const Acts::Surface*>&
44  return m_surfaceCache;
45 }
46 
47 std::vector<const Acts::Surface*>&
49  return m_surfaceCache;
50 }