9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
23 namespace utf = boost::unit_test;
24 namespace tt = boost::test_tools;
33 BOOST_AUTO_TEST_SUITE(Surfaces)
38 double rMin(1.0), rMax(5.0), halfPhiSector(
M_PI / 8.);
42 Surface::makeShared<DiscSurface>(
nullptr, rMin, rMax, halfPhiSector));
45 BOOST_CHECK_NO_THROW(Surface::makeShared<DiscSurface>(
nullptr, rMin, rMax));
49 auto pTransform = std::make_shared<const Transform3D>(translation);
51 Surface::makeShared<DiscSurface>(pTransform, rMin, rMax, halfPhiSector));
54 auto anotherDiscSurface =
55 Surface::makeShared<DiscSurface>(pTransform, rMin, rMax, halfPhiSector);
60 auto copiedSurface = Surface::makeShared<DiscSurface>(*anotherDiscSurface);
61 BOOST_TEST_MESSAGE(
"Copy constructed DiscSurface ok");
64 BOOST_CHECK_NO_THROW(Surface::makeShared<DiscSurface>(
65 tgContext, *anotherDiscSurface, *pTransform));
70 auto nullBounds = Surface::makeShared<DiscSurface>(
nullptr, detElem),
77 std::shared_ptr<const Transform3D> pTransform;
78 double rMin(1.0), rMax(5.0), halfPhiSector(
M_PI / 8.);
79 auto discSurfaceObject =
80 Surface::makeShared<DiscSurface>(pTransform, rMin, rMax, halfPhiSector);
87 BOOST_CHECK_EQUAL(discSurfaceObject->normal(
tgContext), zAxis);
91 BOOST_CHECK_EQUAL(discSurfaceObject->normal(
tgContext, lpos), zAxis);
104 Vector3D ignoredMomentum{0., 0., 0.};
106 Vector3D point3DNotInSector{0.0, 1.2, 0};
107 Vector3D point3DOnSurface{1.2, 0.0, 0};
108 BOOST_CHECK(!discSurfaceObject->isOnSurface(
109 tgContext, point3DNotInSector, ignoredMomentum,
true));
110 BOOST_CHECK(discSurfaceObject->isOnSurface(
tgContext, point3DOnSurface,
111 ignoredMomentum,
true));
114 Vector3D returnedPosition{10.9, 8.7, 6.5};
115 Vector3D expectedPosition{1.2, 0, 0};
118 discSurfaceObject->localToGlobal(
tgContext, rPhiOnDisc, ignoredMomentum,
122 discSurfaceObject->localToGlobal(
tgContext, rPhiNotInSector, ignoredMomentum,
124 Vector3D expectedNonPosition{-1.2, 0, 0};
128 Vector2D returnedLocalPosition{33., 44.};
129 Vector2D expectedLocalPosition{1.2, 0.0};
130 BOOST_CHECK(discSurfaceObject->globalToLocal(
tgContext, point3DOnSurface,
132 returnedLocalPosition));
136 BOOST_CHECK(discSurfaceObject->globalToLocal(
137 tgContext, point3DNotInSector, ignoredMomentum, returnedLocalPosition));
139 Vector3D pointOutsideR{0.0, 100., 0};
140 BOOST_CHECK(discSurfaceObject->globalToLocal(
141 tgContext, pointOutsideR, ignoredMomentum, returnedLocalPosition));
150 CHECK_CLOSE_REL(discSurfaceObject->localCartesianToPolar(cartesian1_1),
154 CHECK_CLOSE_REL(discSurfaceObject->localPolarToLocalCartesian(rPhi1_1),
158 Vector3D cartesian3D1_1{1., 1., 0.};
160 discSurfaceObject->localCartesianToGlobal(
tgContext, cartesian1_1),
161 cartesian3D1_1, 1
e-6);
165 discSurfaceObject->globalToLocalCartesian(
tgContext, cartesian3D1_1),
169 double projected3DMomentum = std::sqrt(3.) * 1.e6;
171 projected3DMomentum};
172 Vector3D ignoredPosition{1.1, 2.2, 3.3};
178 Vector3D globalPosition{1.2, 0.0, -10.};
183 auto intersect = discSurfaceObject->intersectionEstimate(
184 tgContext, globalPosition, direction,
false);
186 Intersection::Status::reachable};
187 BOOST_CHECK(
bool(intersect));
192 boost::test_tools::output_test_stream nameOuput;
193 nameOuput << discSurfaceObject->name();
194 BOOST_CHECK(nameOuput.is_equal(
"Acts::DiscSurface"));
200 std::shared_ptr<const Transform3D> pTransform;
201 double rMin(1.0), rMax(5.0), halfPhiSector(
M_PI / 8.);
202 auto discSurfaceObject =
203 Surface::makeShared<DiscSurface>(pTransform, rMin, rMax, halfPhiSector);
204 auto assignedDisc = Surface::makeShared<DiscSurface>(
nullptr, 2.2, 4.4, 0.07);
206 BOOST_CHECK_NO_THROW(*assignedDisc = *discSurfaceObject);
207 BOOST_CHECK((*assignedDisc) == (*discSurfaceObject));
210 BOOST_AUTO_TEST_SUITE_END()