Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:12

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/Algebra.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/Surfaces/detail/IntersectionHelper2D.hpp"
0014 #include "Acts/Utilities/Result.hpp"
0015 
0016 #include <array>
0017 #include <vector>
0018 
0019 namespace Acts {
0020 class Surface;
0021 class AnnulusBounds;
0022 class RadialBounds;
0023 }  // namespace Acts
0024 
0025 namespace ActsFatras {
0026 
0027 /// A brief struct that allows to apply a surface bound mask.
0028 struct PlanarSurfaceMask {
0029   /// Shorthand for a 2-d segment;
0030   using Segment2D = std::array<Acts::Vector2, 2>;
0031 
0032   /// Apply the mask on the segment
0033   /// - If the segment is fully inside the surface, return unchanged
0034   /// - Otherwise mask/clip the segment to fit into the bounds
0035   ///
0036   /// @note Only PlaneSurface/DiscSurface are supported
0037   ///
0038   /// @note If both end points of the segment are inside, the segment
0039   /// is not clipped/masked, even if it would cross a surface boundary.
0040   /// Examples for those would be non-covex polygons or segments on a
0041   /// radial bound, where the radial boundary is crossed. Such segments
0042   /// do not occur in Digitization, as the hit has to be inside the
0043   /// surface bounds to start with.
0044   ///
0045   /// @param surface The surface in question
0046   /// @param segment The track segment (on surface)
0047   ///
0048   /// @return a result wrapping a segment
0049   Acts::Result<Segment2D> apply(const Acts::Surface& surface,
0050                                 const Segment2D& segment) const;
0051 
0052   /// Apply the mask of a polygon
0053   ///
0054   /// @param vertices The vertices of the polygon
0055   /// @param segment The track segment (on surface)
0056   /// @param firstInside The indicator if the first is inside
0057   ///
0058   /// @return a result wrapping a segment
0059   Acts::Result<Segment2D> polygonMask(
0060       const std::vector<Acts::Vector2>& vertices, const Segment2D& segment,
0061       bool firstInside) const;
0062 
0063   /// Apply the mask of a Radial disk
0064   ///
0065   /// @param rBounds The radial disc for the masking
0066   /// @param segment The track segment (on surface)
0067   /// @param polarSegment The track segment (on surface, in polar)
0068   /// @param firstInside The indicator if the first is inside
0069   ///
0070   /// @return a result wrapping a segment
0071   Acts::Result<Segment2D> radialMask(const Acts::RadialBounds& rBounds,
0072                                      const Segment2D& segment,
0073                                      const Segment2D& polarSegment,
0074                                      bool firstInside) const;
0075 
0076   /// Apply the mask of an annulus disk
0077   ///
0078   /// @param aBounds The annulus disc for the masking
0079   /// @param segment The track segment (on surface)
0080   /// @param firstInside The indicator if the first is inside
0081   ///
0082   /// @return a result wrapping a segment
0083   Acts::Result<Segment2D> annulusMask(const Acts::AnnulusBounds& aBounds,
0084                                       const Segment2D& segment,
0085                                       bool firstInside) const;
0086 
0087   Acts::detail::IntersectionHelper2D intersector{};
0088 };
0089 
0090 }  // namespace ActsFatras