File indexing completed on 2025-01-18 09:12:37
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/CylinderLayer.hpp"
0014 #include "Acts/Geometry/GenericApproachDescriptor.hpp"
0015 #include "Acts/Geometry/Layer.hpp"
0016 #include "Acts/Surfaces/CylinderBounds.hpp"
0017 #include "Acts/Surfaces/CylinderSurface.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/Tests/CommonHelpers/FloatComparisons.hpp"
0023
0024 #include <memory>
0025 #include <string>
0026 #include <utility>
0027 #include <vector>
0028
0029 namespace Acts::Test::Layers {
0030
0031 BOOST_AUTO_TEST_SUITE(Layers)
0032
0033
0034 BOOST_AUTO_TEST_CASE(CylinderLayerConstruction) {
0035
0036
0037
0038 Translation3 translation{0., 1., 2.};
0039 auto pTransform = Transform3(translation);
0040 double radius(0.5), halfz(10.);
0041 auto pCylinder = std::make_shared<const CylinderBounds>(radius, halfz);
0042 auto pCylinderLayer =
0043 CylinderLayer::create(pTransform, pCylinder, nullptr, 1.);
0044 BOOST_CHECK_EQUAL(pCylinderLayer->layerType(), LayerType::passive);
0045
0046
0047 auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
0048
0049 const std::vector<std::shared_ptr<const Surface>> aSurfaces{
0050 Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds),
0051 Surface::makeShared<PlaneSurface>(Transform3::Identity(), rBounds)};
0052 const double thickness(1.0);
0053 auto pCylinderLayerFromSurfaces =
0054 CylinderLayer::create(pTransform, pCylinder, nullptr, thickness);
0055 BOOST_CHECK_EQUAL(pCylinderLayerFromSurfaces->layerType(),
0056 LayerType::passive);
0057
0058 auto pCylinderLayerWithThickness =
0059 CylinderLayer::create(pTransform, pCylinder, nullptr, thickness);
0060 CHECK_CLOSE_REL(pCylinderLayerWithThickness->thickness(), thickness, 1e-6);
0061
0062 std::unique_ptr<ApproachDescriptor> ad(
0063 new GenericApproachDescriptor(aSurfaces));
0064 auto adPtr = ad.get();
0065 auto pCylinderLayerWithApproachDescriptor = CylinderLayer::create(
0066 pTransform, pCylinder, nullptr, thickness, std::move(ad));
0067 BOOST_CHECK_EQUAL(pCylinderLayerWithApproachDescriptor->approachDescriptor(),
0068 adPtr);
0069
0070 auto pCylinderLayerWithLayerType =
0071 CylinderLayer::create(pTransform, pCylinder, nullptr, thickness,
0072 std::move(ad), LayerType::passive);
0073 BOOST_CHECK_EQUAL(pCylinderLayerWithLayerType->layerType(),
0074 LayerType::passive);
0075 }
0076
0077
0078 BOOST_AUTO_TEST_CASE(CylinderLayerProperties) {
0079 Translation3 translation{0., 1., 2.};
0080 auto pTransform = Transform3(translation);
0081 double radius(0.5), halfz(10.);
0082 auto pCylinder = std::make_shared<const CylinderBounds>(radius, halfz);
0083 auto pCylinderLayer =
0084 CylinderLayer::create(pTransform, pCylinder, nullptr, 1.);
0085
0086 BOOST_CHECK_EQUAL(pCylinderLayer->surfaceRepresentation().name(),
0087 std::string("Acts::CylinderSurface"));
0088 }
0089
0090 BOOST_AUTO_TEST_SUITE_END()
0091
0092 }