Back to home page

EIC code displayed by LXR

 
 

    


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