Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:53

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