Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-06 07:43:58

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