Back to home page

EIC code displayed by LXR

 
 

    


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

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/GeometryContext.hpp"
0013 #include "Acts/Geometry/Layer.hpp"
0014 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0015 #include "Acts/Surfaces/Surface.hpp"
0016 #include "Acts/Utilities/AxisDefinitions.hpp"
0017 
0018 #include <algorithm>
0019 #include <memory>
0020 #include <utility>
0021 
0022 namespace Acts {
0023 
0024 /// @class NavigationLayer
0025 ///
0026 /// Class to be used for gaps in Volumes as a navigational link.
0027 /// Navigation Layers have a surface representation, but should usually never be
0028 /// propagated to.
0029 class NavigationLayer : public Layer {
0030  public:
0031   ///  Factory Constructor - the surface representation is given by pointer
0032   /// (ownership passed)
0033   ///
0034   /// @param sRepresentation is the representation for extrapolation
0035   /// @param thickness is the thickness for the binning
0036   static LayerPtr create(std::shared_ptr<const Surface> sRepresentation,
0037                          double thickness = 0.) {
0038     return LayerPtr(new NavigationLayer(std::move(sRepresentation), thickness));
0039   }
0040 
0041   /// Destructor
0042   ~NavigationLayer() override;
0043 
0044   /// The binning position method
0045   ///
0046   /// @param gctx The current geometry context object, e.g. alignment
0047   /// @param aDir is the axis direction for which the reference position is requested
0048   ///  - as default the center is given, but may be overloaded
0049   ///
0050   /// @return The return vector can be used for binning in a TrackingVolume
0051   Vector3 referencePosition(const GeometryContext& gctx,
0052                             AxisDirection aDir) const final;
0053 
0054   /// Default Constructor - deleted
0055   NavigationLayer() = delete;
0056 
0057   /// Copy Constructor - deleted
0058   NavigationLayer(const NavigationLayer&) = delete;
0059 
0060   /// Assignment operator - deleted
0061   NavigationLayer& operator=(const NavigationLayer&) = delete;
0062 
0063   /// Transforms the layer into a Surface representation for extrapolation
0064   /// In general, extrapolation to a surface should be avoided
0065   const Surface& surfaceRepresentation() const final;
0066 
0067   // Non-const version
0068   Surface& surfaceRepresentation() final;
0069 
0070   /// Geometric isOnLayer() method
0071   /// using isOnSurface() with Layer specific tolerance
0072   ///
0073   /// @param gctx The current geometry context object, e.g. alignment
0074   /// @param gp is the global position for the check
0075   /// @param boundaryTolerance is the boundary check directive
0076   ///
0077   /// @return boolean that indicates if the position is on surface
0078   bool isOnLayer(const GeometryContext& gctx, const Vector3& gp,
0079                  const BoundaryTolerance& boundaryTolerance =
0080                      BoundaryTolerance::None()) const final;
0081 
0082   /// Accept layer according to the following collection directives
0083   ///
0084   /// @param resolveSensitive is the prescription to find the sensitive surfaces
0085   /// @param resolveMaterial is the precription to find material surfaces
0086   /// @param resolvePassive is the prescription to find all passive surfaces
0087   ///
0088   /// @note navigation layers are never accepted
0089   ///
0090   /// @return a boolean whether the layer is accepted for processing
0091   bool resolve(bool resolveSensitive, bool resolveMaterial,
0092                bool resolvePassive) const final;
0093 
0094  protected:
0095   /// Private Constructor
0096   /// - this is called by the creat(args*) method
0097   /// passed spacer layer if needed
0098   ///
0099   /// @param surfaceRepresentation is the surface of the layer
0100   /// @param thickness ithe layer thickness
0101   NavigationLayer(std::shared_ptr<const Surface> surfaceRepresentation,
0102                   double thickness);
0103 
0104   /// for the navigation Volume the surface
0105   ///
0106   /// We will need to mutate this surface during the geometry building process,
0107   /// but the C++ type system has no const-correct way of expressing this.
0108   ///
0109   std::shared_ptr<const Surface> m_surfaceRepresentation;
0110 };
0111 
0112 inline const Surface& NavigationLayer::surfaceRepresentation() const {
0113   return (*m_surfaceRepresentation);
0114 }
0115 
0116 inline Surface& NavigationLayer::surfaceRepresentation() {
0117   return *(const_cast<Surface*>(m_surfaceRepresentation.get()));
0118 }
0119 
0120 inline Vector3 NavigationLayer::referencePosition(const GeometryContext& gctx,
0121                                                   AxisDirection aDir) const {
0122   return m_surfaceRepresentation->referencePosition(gctx, aDir);
0123 }
0124 
0125 inline bool NavigationLayer::isOnLayer(
0126     const GeometryContext& gctx, const Vector3& gp,
0127     const BoundaryTolerance& boundaryTolerance) const {
0128   return m_surfaceRepresentation->isOnSurface(gctx, gp, Vector3::Zero(),
0129                                               boundaryTolerance);
0130 }
0131 
0132 inline bool NavigationLayer::resolve(bool /*resolveSensitive*/,
0133                                      bool /*resolveMaterial*/,
0134                                      bool /*reolvePassive*/) const {
0135   return false;
0136 }
0137 
0138 }  // namespace Acts