File indexing completed on 2025-11-17 08:55:03
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/Surfaces/PlaneSurface.hpp"
0017 #include "Acts/Surfaces/RectangleBounds.hpp"
0018 #include "Acts/Surfaces/Surface.hpp"
0019 #include "Acts/Surfaces/SurfaceArray.hpp"
0020
0021 #include <cmath>
0022 #include <memory>
0023 #include <utility>
0024 #include <vector>
0025
0026 #include "../Surfaces/SurfaceStub.hpp"
0027 #include "LayerStub.hpp"
0028
0029 using namespace Acts;
0030
0031 GeometryContext tgContext = GeometryContext();
0032
0033 namespace ActsTests {
0034
0035 BOOST_AUTO_TEST_SUITE(Layers)
0036
0037
0038 BOOST_AUTO_TEST_CASE(LayerConstruction) {
0039
0040
0041
0042
0043 LayerStub minallyConstructed(nullptr);
0044 BOOST_CHECK(minallyConstructed.constructedOk());
0045
0046 std::vector<std::shared_ptr<const Surface>> aSurfaces{
0047 Surface::makeShared<SurfaceStub>(), Surface::makeShared<SurfaceStub>()};
0048 std::unique_ptr<ApproachDescriptor> ad(
0049 new GenericApproachDescriptor(aSurfaces));
0050 const double thickness(1.0);
0051 LayerStub approachDescriptorConstructed(nullptr, thickness, std::move(ad));
0052
0053 BOOST_CHECK(approachDescriptorConstructed.constructedOk());
0054
0055 }
0056
0057
0058 BOOST_AUTO_TEST_CASE(LayerProperties) {
0059
0060
0061 auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
0062
0063 const std::vector<std::shared_ptr<const Surface>> aSurfaces{
0064 Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds),
0065 Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds)};
0066 std::unique_ptr<ApproachDescriptor> ad(
0067 new GenericApproachDescriptor(aSurfaces));
0068 auto adPtr = ad.get();
0069 const double thickness(1.0);
0070 LayerStub layerStub(nullptr, thickness, std::move(ad));
0071
0072
0073 BOOST_CHECK_EQUAL(layerStub.surfaceArray(), nullptr);
0074
0075 BOOST_CHECK_EQUAL(layerStub.thickness(), thickness);
0076
0077
0078 const Vector3 pos{0.0, 0.0, 0.0};
0079 const Vector3 pos2{100., 100., std::nan("")};
0080 BOOST_CHECK(layerStub.isOnLayer(tgContext, pos));
0081
0082
0083 BOOST_CHECK(layerStub.isOnLayer(tgContext, pos2));
0084
0085 BOOST_CHECK_EQUAL(layerStub.approachDescriptor(), adPtr);
0086 const Vector3 gpos{0., 0., 1.0};
0087 const Vector3 direction{0., 0., -1.};
0088
0089 BOOST_CHECK(!(layerStub.nextLayer(tgContext, gpos, direction)));
0090
0091 BOOST_CHECK(!layerStub.trackingVolume());
0092
0093
0094
0095
0096
0097 BOOST_CHECK_EQUAL(layerStub.layerType(), LayerType::passive);
0098 }
0099
0100 BOOST_AUTO_TEST_SUITE_END()
0101
0102 }