Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-20 09:27:57

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/Definitions/Units.hpp"
0012 #include "Acts/Navigation/INavigationPolicy.hpp"
0013 #include "Acts/Navigation/NavigationStream.hpp"
0014 
0015 #include <cstddef>
0016 #include <optional>
0017 
0018 namespace Acts {
0019 class GeometryContext;
0020 class Logger;
0021 class TrackingVolume;
0022 }  // namespace Acts
0023 
0024 namespace ActsPlugins {
0025 
0026 /// Parameters of the detray surface grid of a volume.
0027 ///
0028 /// Detray looks up a surface grid by intersecting the tangent of the track
0029 /// with a virtual reference surface and reading the bins in a search window
0030 /// around the crossing. A single bin (a [0, 0] window, detray's default) is the
0031 /// cheapest lookup, so the grid is filled for it: that bin lists every surface
0032 /// a track of the configured family can reach from there.
0033 struct DetraySurfaceGridConfig {
0034   /// Half range of the vertex z positions around z = 0
0035   double vertexZHalfRange = 150. * Acts::UnitConstants::mm;
0036   /// Lowest transverse momentum covered; <= 0 covers straight tracks only
0037   double minPt = 0.5 * Acts::UnitConstants::GeV;
0038   /// Solenoid field strength used for the bending
0039   double bField = 2. * Acts::UnitConstants::T;
0040   /// Number of vertex z values sampled across the range
0041   std::size_t nVertexZ = 5;
0042   /// Number of curvature values sampled across [-max, max]
0043   std::size_t nCurvature = 5;
0044   /// Maximum spacing of the outline samples, in bins
0045   double maxSampleSpacing = 0.25;
0046   /// Bin count factor for axes the surface array bins automatically, relative
0047   /// to one bin per module. If unset, the surface array's own binning is kept.
0048   std::optional<double> numberOfBinsFactor = 2.;
0049 };
0050 
0051 /// Navigation policy carrying the @ref DetraySurfaceGridConfig of a volume.
0052 ///
0053 /// It does not take part in ACTS navigation. The detray conversion builds
0054 /// the volume's detray surface grid from the volume's surface array with
0055 /// these parameters; a surface array without this policy gets no detray grid.
0056 class DetraySurfaceGridPolicy final : public Acts::INavigationPolicy {
0057  public:
0058   /// Constructor
0059   /// @param gctx The geometry context
0060   /// @param volume The volume this policy belongs to
0061   /// @param logger The logger
0062   /// @param config The grid parameters
0063   DetraySurfaceGridPolicy(const Acts::GeometryContext& gctx,
0064                           const Acts::TrackingVolume& volume,
0065                           const Acts::Logger& logger,
0066                           const DetraySurfaceGridConfig& config);
0067 
0068   /// Constructor with default parameters
0069   /// @param gctx The geometry context
0070   /// @param volume The volume this policy belongs to
0071   /// @param logger The logger
0072   DetraySurfaceGridPolicy(const Acts::GeometryContext& gctx,
0073                           const Acts::TrackingVolume& volume,
0074                           const Acts::Logger& logger);
0075 
0076   /// Adds no candidates
0077   /// @param gctx The geometry context
0078   /// @param args The navigation arguments
0079   /// @param state The navigation policy state
0080   /// @param stream The navigation stream, left unchanged
0081   /// @param logger The logger
0082   void initializeCandidates(const Acts::GeometryContext& gctx,
0083                             const Acts::NavigationArguments& args,
0084                             Acts::NavigationPolicyState& state,
0085                             Acts::AppendOnlyNavigationStream& stream,
0086                             const Acts::Logger& logger) const;
0087 
0088   /// Connect the no-op candidate initialization to a delegate
0089   /// @param delegate The navigation delegate
0090   void connect(Acts::NavigationDelegate& delegate) const override;
0091 
0092   /// The grid parameters
0093   /// @return The configuration
0094   const DetraySurfaceGridConfig& config() const;
0095 
0096   /// The volume this policy belongs to
0097   /// @return The volume
0098   const Acts::TrackingVolume& volume() const;
0099 
0100  private:
0101   const Acts::TrackingVolume* m_volume;
0102   DetraySurfaceGridConfig m_cfg;
0103 };
0104 
0105 static_assert(Acts::NavigationPolicyConcept<DetraySurfaceGridPolicy>);
0106 
0107 }  // namespace ActsPlugins