Back to home page

EIC code displayed by LXR

 
 

    


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

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 Acts {
0021 /// Surface derived class stub
0022 class SurfaceStub : public RegularSurface {
0023  public:
0024   SurfaceStub(const Transform3& htrans = Transform3::Identity())
0025       : GeometryObject(), RegularSurface(htrans) {}
0026   SurfaceStub(const GeometryContext& gctx, const SurfaceStub& sf,
0027               const Transform3& transf)
0028       : GeometryObject(), RegularSurface(gctx, sf, transf) {}
0029   SurfaceStub(const DetectorElementBase& detelement)
0030       : GeometryObject(), RegularSurface(detelement) {}
0031 
0032   ~SurfaceStub() override = default;
0033 
0034   /// Return method for the Surface type to avoid dynamic casts
0035   SurfaceType type() const final { return Surface::Other; }
0036 
0037   /// Return method for the normal vector of the surface
0038   Vector3 normal(const GeometryContext& /*gctx*/,
0039                  const Vector3& /*position*/) const final {
0040     return Vector3{0., 0., 0.};
0041   }
0042 
0043   Vector3 normal(const GeometryContext& /*gctx*/,
0044                  const Vector2& /*lposition*/) const final {
0045     return Vector3{0., 0., 0.};
0046   }
0047 
0048   using RegularSurface::normal;
0049 
0050   /// Return method for SurfaceBounds
0051   const SurfaceBounds& bounds() const final {
0052     return s_noBounds;  // need to improve this for meaningful test
0053   }
0054 
0055   /// Local to global transformation
0056   Vector3 localToGlobal(const GeometryContext& /*gctx*/, const Vector2& /*lpos*/
0057   ) const final {
0058     return Vector3(0., 0., 0.);
0059   }
0060 
0061   using RegularSurface::localToGlobal;
0062 
0063   /// Global to local transformation
0064   Result<Vector2> globalToLocal(const GeometryContext& /*cxt*/,
0065                                 const Vector3& /*gpos*/,
0066                                 double /*tolerance*/) const final {
0067     return Result<Vector2>::success(Vector2{20., 20.});
0068   }
0069 
0070   using RegularSurface::globalToLocal;
0071 
0072   /// Calculation of the path correction for incident
0073   double pathCorrection(const GeometryContext& /*cxt*/, const Vector3& /*gpos*/,
0074                         const Vector3& /*gmom*/) const final {
0075     return 0.0;
0076   }
0077 
0078   /// Inherited from GeometryObject base
0079   Vector3 referencePosition(const GeometryContext& /*txt*/,
0080                             AxisDirection /*bValue*/) const final {
0081     const Vector3 v{0., 0., 0.};
0082     return v;
0083   }
0084 
0085   /// Surface intersction
0086   SurfaceMultiIntersection intersect(
0087       const GeometryContext& /*gctx*/, const Vector3& /*position*/,
0088       const Vector3& /*direction*/,
0089       const BoundaryTolerance& /*boundaryTolerance*/,
0090       const double /*tolerance*/) const final {
0091     Intersection3D stubIntersection(Vector3(20., 0., 0.), 20.,
0092                                     IntersectionStatus::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                                       unsigned int /* ignored */) 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 static_assert(RegularSurfaceConcept<SurfaceStub>,
0126               "SurfaceStub does not fulfill RegularSurfaceConcept");
0127 
0128 }  // namespace Acts