Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:42:11

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/Detector/detail/IndexedGridFiller.hpp"
0012 #include "Acts/Detector/detail/ReferenceGenerators.hpp"
0013 #include "Acts/Geometry/TrackingVolume.hpp"
0014 #include "Acts/Navigation/INavigationPolicy.hpp"
0015 #include "Acts/Navigation/InternalNavigation.hpp"
0016 #include "Acts/Navigation/NavigationStream.hpp"
0017 #include "Acts/Surfaces/detail/IntersectionHelper2D.hpp"
0018 #include "Acts/Utilities/Grid.hpp"
0019 
0020 namespace Acts::Experimental {
0021 
0022 /// A navigation policy that uses grid based navigation for indexed surfaces
0023 /// Navigate through a multilayer structure by creating an artificial path on
0024 /// the grid.
0025 class MultiLayerNavigationPolicy : public INavigationPolicy {
0026  public:
0027   /// Type alias for 2D equidistant grid holding surface indices
0028   using GridType =
0029       Grid<std::vector<std::size_t>,
0030            Axis<AxisType::Equidistant, Acts::AxisBoundaryType::Bound>,
0031            Axis<AxisType::Equidistant, Acts::AxisBoundaryType::Bound>>;
0032   /// Type alias for indexed surfaces navigation updater
0033   using IndexedUpdatorType = IndexedSurfacesNavigation<GridType>;
0034 
0035   struct Config {
0036     // The binning expansion for grid neighbor lookups
0037     std::vector<std::size_t> binExpansion = {0u, 0u};
0038   };
0039 
0040   /// Main constructor, which expects the grid and will fill it with the
0041   /// surfaces from the volume passed
0042   /// @note Expects that the grid is defined but not filled - it will be filled here with the surfaces assigned to the @p volume
0043   /// @param gctx The geometrycontext object
0044   /// @param volume The tracking volume holding the surfaces that will be the indexed objects
0045   /// @param config The configuration of the Navigation Policy
0046   /// @param logger A logging instance
0047   /// @param grid The grid that will be filled with the surfaces
0048   explicit MultiLayerNavigationPolicy(const GeometryContext& gctx,
0049                                       const TrackingVolume& volume,
0050                                       const Logger& logger,
0051                                       const Config& config,
0052                                       IndexedUpdatorType grid);
0053 
0054   /// Update the navigation state from the surface array
0055   /// @param args The navigation arguments
0056   /// @param stream The navigation stream to update
0057   /// @param logger The logger
0058   void initializeCandidates(const NavigationArguments& args,
0059                             AppendOnlyNavigationStream& stream,
0060                             const Logger& logger) const;
0061 
0062   /// Connect this policy with a navigation delegate
0063   /// @param delegate The navigation delegate to connect to
0064   void connect(NavigationDelegate& delegate) const override {
0065     connectDefault<MultiLayerNavigationPolicy>(delegate);
0066   }
0067 
0068   /// Generate a path in the multilayer
0069   /// @param startPosition The starting position of the path (in local frame)
0070   /// @param direction The direction of the path (in local frame)
0071   /// @return A vector of positions along the path
0072   std::vector<Vector2> generatePath(const Vector3& startPosition,
0073                                     const Vector3& direction) const;
0074 
0075  private:
0076   // The tracking volume
0077   const TrackingVolume& m_volume;
0078 
0079   // The grid that holds the indexed surfaces
0080   IndexedUpdatorType m_indexedGrid;
0081 };
0082 
0083 static_assert(NavigationPolicyConcept<MultiLayerNavigationPolicy>);
0084 
0085 }  // namespace Acts::Experimental