Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:11:29

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