File indexing completed on 2025-09-18 08:12:14
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/DiscLayer.hpp"
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/BoundarySurfaceFace.hpp"
0013 #include "Acts/Geometry/CylinderVolumeBounds.hpp"
0014 #include "Acts/Geometry/GenericApproachDescriptor.hpp"
0015 #include "Acts/Geometry/Layer.hpp"
0016 #include "Acts/Geometry/Volume.hpp"
0017 #include "Acts/Surfaces/RadialBounds.hpp"
0018 #include "Acts/Surfaces/Surface.hpp"
0019 #include "Acts/Surfaces/SurfaceArray.hpp"
0020
0021 #include <vector>
0022
0023 namespace Acts {
0024
0025 using VectorHelpers::perp;
0026 using VectorHelpers::phi;
0027
0028 std::shared_ptr<DiscLayer> DiscLayer::create(
0029 const Transform3& transform,
0030 const std::shared_ptr<const DiscBounds>& dbounds,
0031 std::unique_ptr<SurfaceArray> surfaceArray, double thickness,
0032 std::unique_ptr<ApproachDescriptor> ad, LayerType laytyp) {
0033 return std::shared_ptr<DiscLayer>(
0034 new DiscLayer(transform, dbounds, std::move(surfaceArray), thickness,
0035 std::move(ad), laytyp));
0036 }
0037
0038 DiscLayer::DiscLayer(const Transform3& transform,
0039 const std::shared_ptr<const DiscBounds>& dbounds,
0040 std::unique_ptr<SurfaceArray> surfaceArray,
0041 double thickness, std::unique_ptr<ApproachDescriptor> ades,
0042 LayerType laytyp)
0043 : DiscSurface(transform, dbounds),
0044 Layer(std::move(surfaceArray), thickness, std::move(ades), laytyp) {
0045
0046 const RadialBounds* rBounds =
0047 dynamic_cast<const RadialBounds*>(DiscSurface::m_bounds.get());
0048 if (rBounds != nullptr) {
0049
0050 auto rVolumeBounds =
0051 std::make_shared<CylinderVolumeBounds>(*rBounds, thickness);
0052
0053 m_representingVolume =
0054 std::make_unique<Volume>(*m_transform, rVolumeBounds);
0055 }
0056
0057 DiscSurface::associateLayer(*this);
0058
0059 if (!m_approachDescriptor && m_surfaceArray) {
0060 buildApproachDescriptor();
0061 }
0062
0063 if (m_approachDescriptor) {
0064 approachDescriptor()->registerLayer(*this);
0065 }
0066 }
0067
0068 const DiscSurface& DiscLayer::surfaceRepresentation() const {
0069 return (*this);
0070 }
0071
0072 DiscSurface& DiscLayer::surfaceRepresentation() {
0073 return (*this);
0074 }
0075
0076 void DiscLayer::buildApproachDescriptor() {
0077
0078 m_approachDescriptor.reset(nullptr);
0079
0080 if (m_representingVolume != nullptr) {
0081
0082 std::vector<OrientedSurface> bSurfaces =
0083 m_representingVolume->volumeBounds().orientedSurfaces(
0084 m_representingVolume->transform());
0085
0086 std::vector<std::shared_ptr<const Surface>> aSurfaces;
0087 aSurfaces.push_back(bSurfaces.at(negativeFaceXY).surface);
0088 aSurfaces.push_back(bSurfaces.at(positiveFaceXY).surface);
0089 aSurfaces.push_back(bSurfaces.at(tubeInnerCover).surface);
0090 aSurfaces.push_back(bSurfaces.at(tubeOuterCover).surface);
0091
0092 m_approachDescriptor =
0093 std::make_unique<const GenericApproachDescriptor>(std::move(aSurfaces));
0094 }
0095
0096
0097 for (auto& sfPtr : (m_approachDescriptor->containedSurfaces())) {
0098 if (sfPtr != nullptr) {
0099 auto& mutableSf = *(const_cast<Surface*>(sfPtr));
0100 mutableSf.associateLayer(*this);
0101 }
0102 }
0103 }
0104
0105 }