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