Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-11 07:38:50

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/InfiniteBounds.hpp"
0014 #include "Acts/Surfaces/PlanarBounds.hpp"
0015 #include "Acts/Surfaces/RegularSurface.hpp"
0016 #include "Acts/Surfaces/Surface.hpp"
0017 #include "Acts/Surfaces/SurfaceConcept.hpp"
0018 #include "Acts/Utilities/Intersection.hpp"
0019 
0020 namespace ActsTests {
0021 
0022 /// Surface derived class stub
0023 class SurfaceStub : public Acts::RegularSurface {
0024  public:
0025   explicit SurfaceStub(
0026       const Acts::Transform3& htrans = Acts::Transform3::Identity())
0027       : Acts::GeometryObject(), Acts::RegularSurface(htrans) {}
0028   SurfaceStub(const Acts::GeometryContext& gctx, const SurfaceStub& sf,
0029               const Acts::Transform3& transf)
0030       : Acts::GeometryObject(), Acts::RegularSurface(gctx, sf, transf) {}
0031   explicit SurfaceStub(const Acts::SurfacePlacementBase& detelement)
0032       : Acts::GeometryObject(), Acts::RegularSurface(detelement) {}
0033 
0034   /// Return method for the Surface type to avoid dynamic casts
0035   Acts::Surface::SurfaceType type() const final { return Acts::Surface::Other; }
0036 
0037   /// Return method for the normal vector of the surface
0038   Acts::Vector3 normal(const Acts::GeometryContext& /*gctx*/,
0039                        const Acts::Vector3& /*position*/) const final {
0040     return Acts::Vector3::Zero();
0041   }
0042 
0043   Acts::Vector3 normal(const Acts::GeometryContext& /*gctx*/,
0044                        const Acts::Vector2& /*lposition*/) const final {
0045     return Acts::Vector3::Zero();
0046   }
0047 
0048   using Acts::RegularSurface::normal;
0049 
0050   /// Return method for SurfaceBounds
0051   const Acts::SurfaceBounds& bounds() const final {
0052     return Acts::s_noBounds;  // need to improve this for meaningful test
0053   }
0054 
0055   /// Local to global transformation
0056   Acts::Vector3 localToGlobal(const Acts::GeometryContext& /*gctx*/,
0057                               const Acts::Vector2& /*lpos*/
0058   ) const final {
0059     return Acts::Vector3::Zero();
0060   }
0061 
0062   using Acts::RegularSurface::localToGlobal;
0063 
0064   /// Global to local transformation
0065   Acts::Result<Acts::Vector2> globalToLocal(
0066       const Acts::GeometryContext& /*cxt*/, const Acts::Vector3& /*gpos*/,
0067       double /*tolerance*/) const final {
0068     return Acts::Result<Acts::Vector2>::success(Acts::Vector2{20., 20.});
0069   }
0070 
0071   using Acts::RegularSurface::globalToLocal;
0072 
0073   /// Calculation of the path correction for incident
0074   double pathCorrection(const Acts::GeometryContext& /*cxt*/,
0075                         const Acts::Vector3& /*gpos*/,
0076                         const Acts::Vector3& /*gmom*/) const final {
0077     return 0.0;
0078   }
0079 
0080   /// Inherited from GeometryObject base
0081   Acts::Vector3 referencePosition(const Acts::GeometryContext& /*txt*/,
0082                                   Acts::AxisDirection /*bValue*/) const final {
0083     return Acts::Vector3::Zero();
0084   }
0085 
0086   /// Surface intersction
0087   Acts::MultiIntersection3D intersect(
0088       const Acts::GeometryContext& /*gctx*/, const Acts::Vector3& /*position*/,
0089       const Acts::Vector3& /*direction*/,
0090       const Acts::BoundaryTolerance& /*boundaryTolerance*/,
0091       const double /*tolerance*/) const final {
0092     Acts::Intersection3D stubIntersection(Acts::Vector3(20., 0., 0.), 20.,
0093                                           Acts::IntersectionStatus::reachable);
0094     return Acts::MultiIntersection3D(stubIntersection,
0095                                      Acts::Intersection3D::Invalid());
0096   }
0097 
0098   /// Return properly formatted class name
0099   std::string name() const final { return std::string("SurfaceStub"); }
0100 
0101   /// Simply return true to check a method can be called on a constructed object
0102   bool constructedOk() const { return true; }
0103 
0104   /// Return a Polyhedron for the surfaces
0105   Acts::Polyhedron polyhedronRepresentation(
0106       const Acts::GeometryContext& /*gctx*/,
0107       unsigned int /* ignored */) const final {
0108     std::vector<Acts::Vector3> vertices;
0109     std::vector<std::vector<std::size_t>> faces;
0110     std::vector<std::vector<std::size_t>> triangularMesh;
0111 
0112     return Acts::Polyhedron(vertices, faces, triangularMesh);
0113   }
0114 
0115   // Cartesian 3D to local bound derivative
0116   Acts::Matrix<2, 3> localCartesianToBoundLocalDerivative(
0117       const Acts::GeometryContext& /*gctx*/,
0118       const Acts::Vector3& /*position*/) const final {
0119     return Acts::Matrix<2, 3>::Identity();
0120   }
0121 
0122  protected:
0123   std::array<Acts::AxisDirection, 2> localAxes() const override {
0124     return {Acts::AxisDirection::AxisX, Acts::AxisDirection::AxisY};
0125   }
0126 
0127  private:
0128   /// the bounds of this surface
0129   std::shared_ptr<const Acts::PlanarBounds> m_bounds;
0130 };
0131 
0132 static_assert(Acts::RegularSurfaceConcept<SurfaceStub>,
0133               "SurfaceStub does not fulfill RegularSurfaceConcept");
0134 
0135 }  // namespace ActsTests