Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-05 08:29:29

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2024 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Tolerance.hpp"
0012 #include "Acts/Geometry/PortalLinkBase.hpp"
0013 
0014 namespace Acts {
0015 
0016 class TrackingVolume;
0017 class GridPortalLink;
0018 
0019 /// Trivial portal link links to a single target volume on every point on a
0020 /// surface
0021 class TrivialPortalLink final : public PortalLinkBase {
0022  public:
0023   /// Construct a trivial portal link from a surface and a volume
0024   /// @param surface is the surface
0025   /// @param volume is the target
0026   TrivialPortalLink(std::shared_ptr<RegularSurface> surface,
0027                     TrackingVolume& volume)
0028       : PortalLinkBase(std::move(surface)), m_volume{&volume} {}
0029 
0030   /// Make a 1D grid portal link from this trivial portal link
0031   /// The grid size is automatically determined from the surface bounds.
0032   /// @param direction The binning direction
0033   /// @return A grid
0034   std::unique_ptr<GridPortalLink> makeGrid(BinningValue direction) const;
0035 
0036   /// Print the portal link to a stream
0037   /// @param os output stream
0038   void toStream(std::ostream& os) const override;
0039 
0040   /// Resolve the volume for a 2D position
0041   /// @note Always returns the single target volume
0042   /// @param gctx is the geometry context
0043   /// @param position is the 2D position
0044   /// @param tolerance is the tolerance
0045   /// @return The target volume (can be null)
0046   Result<const TrackingVolume*> resolveVolume(
0047       const GeometryContext& gctx, const Vector2& position,
0048       double tolerance = s_onSurfaceTolerance) const override;
0049 
0050   /// Resolve the volume for a 3D position
0051   /// @note Always returns the single target volume
0052   /// @param gctx is the geometry context
0053   /// @param position is the 2D position
0054   /// @param tolerance is the tolerance
0055   /// @return The target volume (can be null)
0056   /// @note The position is assumed to be on the associated surface.
0057   Result<const TrackingVolume*> resolveVolume(
0058       const GeometryContext& gctx, const Vector3& position,
0059       double tolerance = s_onSurfaceTolerance) const override;
0060 
0061  private:
0062   TrackingVolume* m_volume;
0063 };
0064 
0065 }  // namespace Acts