Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-14 08:02:22

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