Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-02 07:48:55

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 #include "Acts/Geometry/Extent.hpp"
0010 #include "Acts/Navigation/INavigationPolicy.hpp"
0011 
0012 #pragma once
0013 
0014 namespace Acts {
0015 
0016 class SurfaceArray;
0017 
0018 /// A navigation policy that internally uses the Gen1 @c SurfaceArray class
0019 class SurfaceArrayNavigationPolicy : public INavigationPolicy {
0020  public:
0021   /// Enum for configuring which type of surface array to produce. This affects
0022   /// the projection that is used for creating the binning structure.
0023   enum class LayerType { Cylinder, Disc, Plane };
0024 
0025   /// Config struct to configure the surface array navigation
0026   struct Config {
0027     /// The type of the layer
0028     LayerType layerType = LayerType::Cylinder;
0029     /// The number of bins in the local directions. The interpretation depends
0030     /// on the layer type.
0031     std::pair<std::size_t, std::size_t> bins;
0032     /// Envelope added to the ProtoLayer extent when computing the surface-array
0033     /// lookup tolerance.
0034     ExtentEnvelope envelope = ExtentEnvelope::Zero();
0035   };
0036 
0037   /// Main constructor, which internally creates the surface array acceleration
0038   /// structure.
0039   /// @note Expects that all relevant surfaces are registered with @p volume.
0040   ///       Only selects sensitive surfaces for the surface array.
0041   /// @param gctx The geometry context
0042   /// @param volume The *layer volume* to construct the surface array from
0043   /// @param logger A logging instance
0044   /// @param config The configuration for the surface array
0045   explicit SurfaceArrayNavigationPolicy(const GeometryContext& gctx,
0046                                         const TrackingVolume& volume,
0047                                         const Logger& logger, Config config);
0048 
0049   /// Destructor
0050   ~SurfaceArrayNavigationPolicy() override;
0051 
0052   /// Update the navigation state from the surface array
0053   /// @param gctx The geometry context
0054   /// @param args The navigation arguments
0055   /// @param state The navigation policy state
0056   /// @param stream The navigation stream to update
0057   /// @param logger The logger
0058   void initializeCandidates(const GeometryContext& gctx,
0059                             const NavigationArguments& args,
0060                             NavigationPolicyState& state,
0061                             AppendOnlyNavigationStream& stream,
0062                             const Logger& logger) const;
0063 
0064   /// Connect this policy with a navigation delegate
0065   /// @param delegate The navigation delegate to connect to
0066   void connect(NavigationDelegate& delegate) const override;
0067 
0068   /// Output stream operator for the contained layer type enum
0069   /// @param os The output stream
0070   /// @param layerType The layer type to print
0071   friend std::ostream& operator<<(std::ostream& os,
0072                                   const LayerType& layerType) {
0073     switch (layerType) {
0074       using enum LayerType;
0075       case Cylinder:
0076         os << "Cylinder";
0077         break;
0078       case Disc:
0079         os << "Disc";
0080         break;
0081       case Plane:
0082         os << "Plane";
0083         break;
0084     }
0085     return os;
0086   }
0087 
0088   /// Const reference access to the layer array
0089   /// @return The surface array
0090   const SurfaceArray& surfaceArray() const;
0091 
0092   /// Constant access to config
0093   /// @return config
0094   const Config& config() const;
0095 
0096  private:
0097   Config m_cfg;
0098 
0099   std::unique_ptr<SurfaceArray> m_surfaceArray{};
0100   const TrackingVolume& m_volume;
0101 };
0102 
0103 static_assert(NavigationPolicyConcept<SurfaceArrayNavigationPolicy>);
0104 
0105 }  // namespace Acts