Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:22:28

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   /// Update the navigation state from the surface array
0046   /// @param gctx The geometry context
0047   /// @param args The navigation arguments
0048   /// @param stream The navigation stream to update
0049   /// @param logger The logger
0050   void initializeCandidates(const GeometryContext& gctx,
0051                             const NavigationArguments& args,
0052                             AppendOnlyNavigationStream& stream,
0053                             const Logger& logger) const;
0054 
0055   /// Connect this policy with a navigation delegate
0056   /// @param delegate The navigation delegate to connect to
0057   void connect(NavigationDelegate& delegate) const override;
0058 
0059   /// Output stream operator for the contained layer type enum
0060   /// @param os The output stream
0061   /// @param layerType The layer type to print
0062   friend std::ostream& operator<<(std::ostream& os,
0063                                   const LayerType& layerType) {
0064     switch (layerType) {
0065       using enum LayerType;
0066       case Cylinder:
0067         os << "Cylinder";
0068         break;
0069       case Disc:
0070         os << "Disc";
0071         break;
0072       case Plane:
0073         os << "Plane";
0074         break;
0075     }
0076     return os;
0077   }
0078 
0079   /// Const reference access to the layer array
0080   /// @return The surface array
0081   const SurfaceArray& surfaceArray() const;
0082 
0083  private:
0084   std::unique_ptr<SurfaceArray> m_surfaceArray{};
0085   const TrackingVolume& m_volume;
0086 };
0087 
0088 static_assert(NavigationPolicyConcept<SurfaceArrayNavigationPolicy>);
0089 
0090 }  // namespace Acts