File indexing completed on 2025-11-08 09:20:10
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 using namespace Acts;
0029
0030 GeometryContext tgContext = GeometryContext();
0031
0032 namespace ActsTests {
0033
0034 BOOST_AUTO_TEST_SUITE(GeometrySuite)
0035
0036
0037 BOOST_AUTO_TEST_CASE(PlaneLayerConstruction) {
0038
0039
0040
0041 Translation3 translation{0., 1., 2.};
0042 auto pTransform = Transform3(translation);
0043 const double halfX(10.), halfY(5.);
0044 auto pRectangle = std::make_shared<const RectangleBounds>(halfX, halfY);
0045 auto pPlaneLayer = PlaneLayer::create(pTransform, pRectangle);
0046 BOOST_CHECK_EQUAL(pPlaneLayer->layerType(), LayerType::active);
0047
0048
0049 auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
0050
0051 const std::vector<std::shared_ptr<const Surface>> aSurfaces{
0052 Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds),
0053 Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds)};
0054 const double thickness(1.0);
0055 SurfaceArrayCreator sac;
0056 std::size_t binsX(2), binsY(4);
0057 auto pSurfaceArray = sac.surfaceArrayOnPlane(tgContext, aSurfaces, binsX,
0058 binsY, AxisDirection::AxisZ);
0059 auto pPlaneLayerFromSurfaces =
0060 PlaneLayer::create(pTransform, pRectangle, std::move(pSurfaceArray));
0061 BOOST_CHECK_EQUAL(pPlaneLayerFromSurfaces->layerType(), LayerType::active);
0062
0063 auto pPlaneLayerWithThickness = PlaneLayer::create(
0064 pTransform, pRectangle, std::move(pSurfaceArray), thickness);
0065 BOOST_CHECK_EQUAL(pPlaneLayerWithThickness->thickness(), thickness);
0066
0067 std::unique_ptr<ApproachDescriptor> ad(
0068 new GenericApproachDescriptor(aSurfaces));
0069 auto adPtr = ad.get();
0070 auto pPlaneLayerWithApproachDescriptor =
0071 PlaneLayer::create(pTransform, pRectangle, std::move(pSurfaceArray),
0072 thickness, std::move(ad));
0073 BOOST_CHECK_EQUAL(pPlaneLayerWithApproachDescriptor->approachDescriptor(),
0074 adPtr);
0075
0076 auto pPlaneLayerWithLayerType =
0077 PlaneLayer::create(pTransform, pRectangle, std::move(pSurfaceArray),
0078 thickness, std::move(ad), LayerType::passive);
0079 BOOST_CHECK_EQUAL(pPlaneLayerWithLayerType->layerType(), LayerType::passive);
0080 }
0081
0082
0083 BOOST_AUTO_TEST_CASE(PlaneLayerProperties) {
0084 Translation3 translation{0., 1., 2.};
0085 auto pTransform = Transform3(translation);
0086 const double halfX(10.), halfY(5.);
0087 auto pRectangle = std::make_shared<const RectangleBounds>(halfX, halfY);
0088 auto pPlaneLayer = PlaneLayer::create(pTransform, pRectangle);
0089
0090 BOOST_CHECK_EQUAL(pPlaneLayer->surfaceRepresentation().name(),
0091 std::string("Acts::PlaneSurface"));
0092 }
0093
0094 BOOST_AUTO_TEST_SUITE_END()
0095
0096 }