File indexing completed on 2025-09-18 08:14:01
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/ApproachDescriptor.hpp"
0013 #include "Acts/Geometry/GenericApproachDescriptor.hpp"
0014 #include "Acts/Geometry/GeometryContext.hpp"
0015 #include "Acts/Geometry/Layer.hpp"
0016 #include "Acts/Geometry/PlaneLayer.hpp"
0017 #include "Acts/Geometry/SurfaceArrayCreator.hpp"
0018 #include "Acts/Surfaces/PlaneSurface.hpp"
0019 #include "Acts/Surfaces/RectangleBounds.hpp"
0020 #include "Acts/Surfaces/Surface.hpp"
0021
0022 #include <cstddef>
0023 #include <memory>
0024 #include <string>
0025 #include <utility>
0026 #include <vector>
0027
0028 namespace Acts::Test {
0029
0030 GeometryContext tgContext = GeometryContext();
0031 }
0032
0033 namespace Acts::Test::Layers {
0034
0035 BOOST_AUTO_TEST_SUITE(Layers)
0036
0037
0038 BOOST_AUTO_TEST_CASE(PlaneLayerConstruction) {
0039
0040
0041
0042 Translation3 translation{0., 1., 2.};
0043 auto pTransform = Transform3(translation);
0044 const double halfX(10.), halfY(5.);
0045 auto pRectangle = std::make_shared<const RectangleBounds>(halfX, halfY);
0046 auto pPlaneLayer = PlaneLayer::create(pTransform, pRectangle);
0047 BOOST_CHECK_EQUAL(pPlaneLayer->layerType(), LayerType::active);
0048
0049
0050 auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
0051
0052 const std::vector<std::shared_ptr<const Surface>> aSurfaces{
0053 Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds),
0054 Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds)};
0055 const double thickness(1.0);
0056 SurfaceArrayCreator sac;
0057 std::size_t binsX(2), binsY(4);
0058 auto pSurfaceArray = sac.surfaceArrayOnPlane(tgContext, aSurfaces, binsX,
0059 binsY, AxisDirection::AxisZ);
0060 auto pPlaneLayerFromSurfaces =
0061 PlaneLayer::create(pTransform, pRectangle, std::move(pSurfaceArray));
0062 BOOST_CHECK_EQUAL(pPlaneLayerFromSurfaces->layerType(), LayerType::active);
0063
0064 auto pPlaneLayerWithThickness = PlaneLayer::create(
0065 pTransform, pRectangle, std::move(pSurfaceArray), thickness);
0066 BOOST_CHECK_EQUAL(pPlaneLayerWithThickness->thickness(), thickness);
0067
0068 std::unique_ptr<ApproachDescriptor> ad(
0069 new GenericApproachDescriptor(aSurfaces));
0070 auto adPtr = ad.get();
0071 auto pPlaneLayerWithApproachDescriptor =
0072 PlaneLayer::create(pTransform, pRectangle, std::move(pSurfaceArray),
0073 thickness, std::move(ad));
0074 BOOST_CHECK_EQUAL(pPlaneLayerWithApproachDescriptor->approachDescriptor(),
0075 adPtr);
0076
0077 auto pPlaneLayerWithLayerType =
0078 PlaneLayer::create(pTransform, pRectangle, std::move(pSurfaceArray),
0079 thickness, std::move(ad), LayerType::passive);
0080 BOOST_CHECK_EQUAL(pPlaneLayerWithLayerType->layerType(), LayerType::passive);
0081 }
0082
0083
0084 BOOST_AUTO_TEST_CASE(PlaneLayerProperties) {
0085 Translation3 translation{0., 1., 2.};
0086 auto pTransform = Transform3(translation);
0087 const double halfX(10.), halfY(5.);
0088 auto pRectangle = std::make_shared<const RectangleBounds>(halfX, halfY);
0089 auto pPlaneLayer = PlaneLayer::create(pTransform, pRectangle);
0090
0091 BOOST_CHECK_EQUAL(pPlaneLayer->surfaceRepresentation().name(),
0092 std::string("Acts::PlaneSurface"));
0093 }
0094
0095 BOOST_AUTO_TEST_SUITE_END()
0096
0097 }