Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:51

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/ApproachDescriptor.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0015 #include "Acts/Surfaces/Surface.hpp"
0016 #include "Acts/Utilities/Helpers.hpp"
0017 #include "Acts/Utilities/Intersection.hpp"
0018 
0019 #include <memory>
0020 #include <utility>
0021 #include <vector>
0022 
0023 namespace Acts {
0024 
0025 class Layer;
0026 class Surface;
0027 
0028 /// @class GenericApproachDescriptor
0029 ///
0030 /// Class to decide and return which approaching surface to be taken,
0031 /// it's a generic descriptor for n surfaces
0032 class GenericApproachDescriptor : public ApproachDescriptor {
0033  public:
0034   /// A generic approach descriptor for new Acts::Surface objects
0035   /// passing ownership
0036   ///
0037   /// @param aSurfaces are the approach surfaces
0038   GenericApproachDescriptor(
0039       std::vector<std::shared_ptr<const Surface>> aSurfaces)
0040       : ApproachDescriptor(),
0041         m_surfaces(std::move(aSurfaces)),
0042         m_surfaceCache() {
0043     m_surfaceCache = unpack_shared_vector(m_surfaces);
0044   }
0045 
0046   /// A generic approach descriptor with n surfaces to test
0047   ~GenericApproachDescriptor() override = default;
0048 
0049   /// @brief Register the Layer to the surfaces
0050   ///
0051   /// @param lay is the layer to be registered
0052   void registerLayer(const Layer& lay) override;
0053 
0054   /// Get the approach surface to the layer
0055   ///
0056   /// @param gctx The current geometry context object, e.g. alignment
0057   /// @param position The global position to start the approach from
0058   /// @param direction The momentum vector
0059   /// @param boundaryTolerance The boundary check prescription
0060   /// @param nearLimit The minimum distance for an intersection to be considered
0061   /// @param farLimit The maximum distance for an intersection to be considered
0062   ///
0063   /// @return : a @c SurfaceIntersection
0064   SurfaceIntersection approachSurface(
0065       const GeometryContext& gctx, const Vector3& position,
0066       const Vector3& direction, const BoundaryTolerance& boundaryTolerance,
0067       double nearLimit, double farLimit) const override;
0068 
0069   /// return all contained surfaces of this approach descriptor
0070   const std::vector<const Surface*>& containedSurfaces() const override;
0071 
0072   /// Non-const version
0073   std::vector<const Surface*>& containedSurfaces() override;
0074 
0075  private:
0076   /// approach surfaces with ownership control
0077   std::vector<std::shared_ptr<const Surface>> m_surfaces;
0078 
0079   /// the surface container cache
0080   ///
0081   /// We will need to mutate those surfaces in registerLayer, but the C++ type
0082   /// system has no const-correct way of expressing this constraint.
0083   ///
0084   std::vector<const Surface*> m_surfaceCache;
0085 };
0086 
0087 }  // namespace Acts