Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:23:22

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2016-2018 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 http://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/BoundaryCheck.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 bcheck 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(const GeometryContext& gctx,
0065                                       const Vector3& position,
0066                                       const Vector3& direction,
0067                                       const BoundaryCheck& bcheck,
0068                                       double nearLimit,
0069                                       double farLimit) const override;
0070 
0071   /// return all contained surfaces of this approach descriptor
0072   const std::vector<const Surface*>& containedSurfaces() const override;
0073 
0074   /// Non-const version
0075   std::vector<const Surface*>& containedSurfaces() override;
0076 
0077  private:
0078   /// approach surfaces with ownership control
0079   std::vector<std::shared_ptr<const Surface>> m_surfaces;
0080 
0081   /// the surface container cache
0082   ///
0083   /// We will need to mutate those surfaces in registerLayer, but the C++ type
0084   /// system has no const-correct way of expressing this constraint.
0085   ///
0086   std::vector<const Surface*> m_surfaceCache;
0087 };
0088 
0089 }  // namespace Acts