Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:01:47

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2016-2020 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/Algebra.hpp"
0012 #include "Acts/Definitions/Tolerance.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Geometry/Polyhedron.hpp"
0015 #include "Acts/Surfaces/BoundaryCheck.hpp"
0016 #include "Acts/Surfaces/InfiniteBounds.hpp"
0017 #include "Acts/Surfaces/PlanarBounds.hpp"
0018 #include "Acts/Surfaces/RegularSurface.hpp"
0019 #include "Acts/Surfaces/Surface.hpp"
0020 #include "Acts/Surfaces/SurfaceConcept.hpp"
0021 #include "Acts/Utilities/BinningType.hpp"
0022 #include "Acts/Utilities/Concepts.hpp"
0023 #include "Acts/Utilities/Result.hpp"
0024 
0025 #include <cstddef>
0026 #include <limits>
0027 #include <memory>
0028 #include <string>
0029 
0030 namespace Acts {
0031 
0032 class DetectorElementBase;
0033 class PlanarBounds;
0034 class SurfaceBounds;
0035 
0036 /// @class PlaneSurface
0037 ///
0038 /// Class for a planaer in the TrackingGeometry.
0039 ///
0040 /// The PlaneSurface extends the Surface class with the possibility to
0041 /// convert local to global positions (vice versa).
0042 ///
0043 /// @image html PlaneSurface.png
0044 ///
0045 class PlaneSurface : public RegularSurface {
0046   friend class Surface;
0047 
0048  protected:
0049   /// Copy Constructor
0050   ///
0051   /// @param other is the source surface for the copy
0052   PlaneSurface(const PlaneSurface& other);
0053 
0054   /// Copy constructor - with shift
0055   ///
0056   /// @param gctx The current geometry context object, e.g. alignment
0057   /// @param other is the source cone surface
0058   /// @param transform is the additional transform applied after copying
0059   PlaneSurface(const GeometryContext& gctx, const PlaneSurface& other,
0060                const Transform3& transform);
0061 
0062   /// Dedicated Constructor with normal vector
0063   /// This is for curvilinear surfaces which are by definition boundless
0064   ///
0065   /// @param center is the center position of the surface
0066   /// @param normal is thenormal vector of the plane surface
0067   PlaneSurface(const Vector3& center, const Vector3& normal);
0068 
0069   /// Constructor from DetectorElementBase : Element proxy
0070   ///
0071   /// @param pbounds are the provided planar bounds
0072   /// @param detelement is the linked detector element to this surface
0073   PlaneSurface(std::shared_ptr<const PlanarBounds> pbounds,
0074                const DetectorElementBase& detelement);
0075 
0076   /// Constructor for Planes with (optional) shared bounds object
0077   ///
0078   /// @param transform transform in 3D that positions this surface
0079   /// @param pbounds bounds object to describe the actual surface area
0080   PlaneSurface(const Transform3& transform,
0081                std::shared_ptr<const PlanarBounds> pbounds = nullptr);
0082 
0083  public:
0084   ~PlaneSurface() override = default;
0085   PlaneSurface() = delete;
0086 
0087   /// Assignment operator
0088   ///
0089   /// @param other The source PlaneSurface for assignment
0090   PlaneSurface& operator=(const PlaneSurface& other);
0091 
0092   // Use overloads from `RegularSurface`
0093   using RegularSurface::globalToLocal;
0094   using RegularSurface::localToGlobal;
0095   using RegularSurface::normal;
0096 
0097   /// Get the normal vector of this surface at a given local position
0098   ///
0099   /// @param gctx The current geometry context object, e.g. alignment
0100   /// @param lposition is the local position is ignored
0101   ///
0102   /// return a Vector3 by value
0103   Vector3 normal(const GeometryContext& gctx,
0104                  const Vector2& lposition) const final;
0105 
0106   /// Get the normal vector of this surface at a given global position
0107   /// @note The @p position is required to be on-surface.
0108   /// @param gctx The current geometry context object, e.g. alignment
0109   /// @param position is the global positiono (for @ref PlaneSurface this is ignored)
0110   /// @return The normal vector
0111   Vector3 normal(const GeometryContext& gctx,
0112                  const Vector3& position) const final;
0113 
0114   /// Get the normal vector, independent of the location
0115   /// @param gctx The current geometry context object, e.g. alignment
0116   /// @return The normal vector
0117   Vector3 normal(const GeometryContext& gctx) const;
0118 
0119   /// The binning position is the position calculated
0120   /// for a certain binning type
0121   ///
0122   /// @param gctx The current geometry context object, e.g. alignment
0123   /// @param bValue is the binning type to be used
0124   ///
0125   /// @return position that can beused for this binning
0126   Vector3 binningPosition(const GeometryContext& gctx,
0127                           BinningValue bValue) const final;
0128 
0129   /// Return the surface type
0130   SurfaceType type() const override;
0131 
0132   /// Return method for bounds object of this surfrace
0133   const SurfaceBounds& bounds() const override;
0134 
0135   /// Local to global transformation
0136   ///
0137   /// @note For planar surfaces the momentum direction is ignored in the local to global
0138   /// transformation
0139   ///
0140   /// @param gctx The current geometry context object, e.g. alignment
0141   /// @param lposition local 2D position in specialized surface frame
0142   ///
0143   /// @return the global position by value
0144   Vector3 localToGlobal(const GeometryContext& gctx,
0145                         const Vector2& lposition) const override;
0146 
0147   /// Global to local transformation
0148   ///
0149   /// @note For planar surfaces the momentum direction is ignored in the global to local
0150   /// transformation
0151   ///
0152   /// @param gctx The current geometry context object, e.g. alignment
0153   /// @param position global 3D position - considered to be on surface but not
0154   /// inside bounds (check is done)
0155   /// @param tolerance optional tolerance within which a point is considered
0156   /// valid on surface
0157   ///
0158   /// @return a Result<Vector2> which can be !ok() if the operation fails
0159   Result<Vector2> globalToLocal(
0160       const GeometryContext& gctx, const Vector3& position,
0161       double tolerance = s_onSurfaceTolerance) const override;
0162 
0163   /// Method that calculates the correction due to incident angle
0164   ///
0165   /// @param gctx The current geometry context object, e.g. alignment
0166   /// @param position global 3D position (ignored for @ref PlaneSurface)
0167   /// @param direction global 3D momentum direction (ignored for @ref PlaneSurface)
0168   /// @return a double representing the scaling factor
0169   double pathCorrection(const GeometryContext& gctx, const Vector3& position,
0170                         const Vector3& direction) const final;
0171 
0172   /// @brief Straight line intersection
0173   ///
0174   /// @param gctx The current geometry context object, e.g. alignment
0175   /// @param position The start position of the intersection attempt
0176   /// @param direction The direction of the intersection attempt,
0177   /// (@note expected to be normalized)
0178   /// @param bcheck The boundary check directive
0179   /// @param tolerance the tolerance used for the intersection
0180   ///
0181   /// <b>mathematical motivation:</b>
0182   ///
0183   /// the equation of the plane is given by: <br>
0184   /// @f$ \vec n \cdot \vec x = \vec n \cdot \vec p,@f$ <br>
0185   /// where @f$ \vec n = (n_{x}, n_{y}, n_{z})@f$ denotes the normal vector of
0186   /// the plane,  @f$ \vec p = (p_{x}, p_{y}, p_{z})@f$ one specific point
0187   /// on the plane and @f$ \vec x = (x,y,z) @f$ all possible points
0188   /// on the plane.<br>
0189   ///
0190   /// Given a line with:<br>
0191   /// @f$ \vec l(u) = \vec l_{1} + u \cdot \vec v @f$, <br>
0192   /// the solution for @f$ u @f$ can be written:
0193   /// @f$ u = \frac{\vec n (\vec p - \vec l_{1})}{\vec n \vec v}@f$ <br>
0194   /// If the denominator is 0 then the line lies:
0195   /// - either in the plane
0196   /// - perpendicular to the normal of the plane
0197   ///
0198   /// @return the @c SurfaceMultiIntersection object
0199   SurfaceMultiIntersection intersect(
0200       const GeometryContext& gctx, const Vector3& position,
0201       const Vector3& direction,
0202       const BoundaryCheck& bcheck = BoundaryCheck(false),
0203       ActsScalar tolerance = s_onSurfaceTolerance) const final;
0204 
0205   /// Return a Polyhedron for the surfaces
0206   ///
0207   /// @param gctx The current geometry context object, e.g. alignment
0208   /// @param lseg Number of segments along curved lines, it represents
0209   /// the full 2*M_PI coverange, if lseg is set to 1 only the extrema
0210   /// are given
0211   ///
0212   /// @return A list of vertices and a face/facett description of it
0213   Polyhedron polyhedronRepresentation(const GeometryContext& gctx,
0214                                       std::size_t lseg) const override;
0215 
0216   /// Return properly formatted class name for screen output
0217   std::string name() const override;
0218 
0219   /// Calculate the derivative of bound track parameters local position w.r.t.
0220   /// position in local 3D Cartesian coordinates
0221   ///
0222   /// @param gctx The current geometry context object, e.g. alignment
0223   /// @param position The position of the parameters in global
0224   ///
0225   /// @return Derivative of bound local position w.r.t. position in local 3D
0226   /// cartesian coordinates
0227   ActsMatrix<2, 3> localCartesianToBoundLocalDerivative(
0228       const GeometryContext& gctx, const Vector3& position) const final;
0229 
0230  protected:
0231   /// the bounds of this surface
0232   std::shared_ptr<const PlanarBounds> m_bounds;
0233 
0234  private:
0235 };
0236 
0237 ACTS_STATIC_CHECK_CONCEPT(RegularSurfaceConcept, PlaneSurface);
0238 
0239 }  // end of namespace Acts