File indexing completed on 2025-12-16 09:23:10
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/PlaneLayer.hpp"
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/GenericApproachDescriptor.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Surfaces/Surface.hpp"
0015 #include "Acts/Surfaces/SurfaceArray.hpp"
0016
0017 #include <vector>
0018
0019 namespace Acts {
0020
0021 std::shared_ptr<PlaneLayer> PlaneLayer::create(
0022 const Transform3& transform, std::shared_ptr<const PlanarBounds> pbounds,
0023 std::unique_ptr<SurfaceArray> surfaceArray, double thickness,
0024 std::unique_ptr<ApproachDescriptor> ad, LayerType laytyp) {
0025 return std::shared_ptr<PlaneLayer>(
0026 new PlaneLayer(transform, pbounds, std::move(surfaceArray), thickness,
0027 std::move(ad), laytyp));
0028 }
0029
0030 PlaneLayer::PlaneLayer(const Transform3& transform,
0031 std::shared_ptr<const PlanarBounds>& pbounds,
0032 std::unique_ptr<SurfaceArray> surfaceArray,
0033 double thickness,
0034 std::unique_ptr<ApproachDescriptor> ades,
0035 LayerType laytyp)
0036 : PlaneSurface(transform, pbounds),
0037 Layer(std::move(surfaceArray), thickness, std::move(ades), laytyp) {
0038
0039
0040 PlaneSurface::associateLayer(*this);
0041
0042 if (!m_approachDescriptor && m_surfaceArray) {
0043 buildApproachDescriptor();
0044 }
0045
0046 if (m_approachDescriptor) {
0047 approachDescriptor()->registerLayer(*this);
0048 }
0049 }
0050
0051 const PlaneSurface& PlaneLayer::surfaceRepresentation() const {
0052 return (*this);
0053 }
0054
0055 PlaneSurface& PlaneLayer::surfaceRepresentation() {
0056 return (*this);
0057 }
0058
0059 void PlaneLayer::buildApproachDescriptor() {
0060
0061 m_approachDescriptor.reset(nullptr);
0062
0063 std::vector<std::shared_ptr<const Surface>> aSurfaces;
0064
0065
0066
0067 const Transform3& lTransform = transform(GeometryContext());
0068 RotationMatrix3 lRotation = lTransform.rotation();
0069 const Vector3& lCenter = center(GeometryContext());
0070 const Vector3& lVector = normal(GeometryContext(), lCenter);
0071
0072 const Transform3 apnTransform = Transform3(
0073 Translation3(lCenter - 0.5 * Layer::m_layerThickness * lVector) *
0074 lRotation);
0075 const Transform3 appTransform = Transform3(
0076 Translation3(lCenter + 0.5 * Layer::m_layerThickness * lVector) *
0077 lRotation);
0078
0079 aSurfaces.push_back(
0080 Surface::makeShared<PlaneSurface>(apnTransform, PlaneSurface::m_bounds));
0081 aSurfaces.push_back(
0082 Surface::makeShared<PlaneSurface>(appTransform, PlaneSurface::m_bounds));
0083
0084 for (auto& sfPtr : aSurfaces) {
0085 auto mutableSf = const_cast<Surface*>(sfPtr.get());
0086 mutableSf->associateLayer(*this);
0087 }
0088
0089 m_approachDescriptor =
0090 std::make_unique<const GenericApproachDescriptor>(std::move(aSurfaces));
0091 }
0092
0093 }