9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
21 namespace tt = boost::test_tools;
22 using boost::test_tools::output_test_stream;
23 namespace utf = boost::unit_test;
32 BOOST_AUTO_TEST_SUITE(PlaneSurfaces)
37 auto rBounds = std::make_shared<const RectangleBounds>(3., 4.);
43 Surface::makeShared<PlaneSurface>(pTransform, rBounds)->type(),
46 auto planeSurfaceObject =
47 Surface::makeShared<PlaneSurface>(pTransform, rBounds);
48 auto copiedPlaneSurface =
49 Surface::makeShared<PlaneSurface>(*planeSurfaceObject);
51 BOOST_CHECK(*copiedPlaneSurface == *planeSurfaceObject);
54 auto copiedTransformedPlaneSurface = Surface::makeShared<PlaneSurface>(
55 tgContext, *planeSurfaceObject, pTransform);
56 BOOST_CHECK_EQUAL(copiedTransformedPlaneSurface->type(),
Surface::Plane);
61 auto nullBounds = Surface::makeShared<PlaneSurface>(
nullptr, detElem),
68 auto rBounds = std::make_shared<const RectangleBounds>(3., 4.);
72 auto planeSurfaceObject =
73 Surface::makeShared<PlaneSurface>(pTransform, rBounds);
77 auto planeSurfaceObject2 =
78 Surface::makeShared<PlaneSurface>(pTransform2, rBounds);
83 Vector3D binningPosition{0., 1., 2.};
89 Vector3D globalPosition{2.0, 2.0, 0.0};
92 expectedFrame << 1., 0., 0., 0., 1., 0., 0., 0., 1.;
96 expectedFrame, 1
e-6, 1e-9);
100 BOOST_CHECK_EQUAL(planeSurfaceObject->normal(
tgContext), normal3D);
103 BOOST_CHECK_EQUAL(planeSurfaceObject->bounds().type(),
112 Vector3D expectedPosition{1.5 + translation.x(), 1.7 + translation.y(),
121 Vector2D expectedLocalPosition{1.5, 1.7};
127 BOOST_CHECK(planeSurfaceObject->isOnSurface(
tgContext, globalPosition,
134 auto sfIntersection =
135 planeSurfaceObject->intersect(
tgContext, offSurface, direction,
true);
137 Intersection3D::Status::reachable};
138 BOOST_CHECK(
bool(sfIntersection));
139 BOOST_CHECK_EQUAL(sfIntersection.intersection.position,
140 expectedIntersect.position);
141 BOOST_CHECK_EQUAL(sfIntersection.intersection.pathLength,
142 expectedIntersect.pathLength);
143 BOOST_CHECK_EQUAL(sfIntersection.object, planeSurfaceObject.get());
152 BOOST_CHECK_EQUAL(planeSurfaceObject->name(),
153 std::string(
"Acts::PlaneSurface"));
172 auto rBounds = std::make_shared<const RectangleBounds>(3., 4.);
175 auto planeSurfaceObject =
176 Surface::makeShared<PlaneSurface>(pTransform, rBounds);
177 auto planeSurfaceObject2 =
178 Surface::makeShared<PlaneSurface>(pTransform, rBounds);
181 BOOST_CHECK(*planeSurfaceObject == *planeSurfaceObject2);
183 BOOST_TEST_CHECKPOINT(
184 "Create and then assign a PlaneSurface object to the existing one");
186 auto assignedPlaneSurface =
187 Surface::makeShared<PlaneSurface>(Transform3D::Identity(),
nullptr);
188 *assignedPlaneSurface = *planeSurfaceObject;
190 BOOST_CHECK(*assignedPlaneSurface == *planeSurfaceObject);
203 auto rBounds = std::make_shared<RectangleBounds>(rHx, rHy);
205 auto plane = Surface::makeShared<PlaneSurface>(
208 auto planeExtent = plane->polyhedronRepresentation(
tgContext, 1).extent();
221 double alpha = 0.123;
222 auto planeRot = Surface::makeShared<PlaneSurface>(
227 auto planeExtentRot =
228 planeRot->polyhedronRepresentation(
tgContext, 1).extent();
246 auto rBounds = std::make_shared<const RectangleBounds>(3., 4.);
250 auto planeSurfaceObject =
251 Surface::makeShared<PlaneSurface>(pTransform, rBounds);
252 const auto& rotation = pTransform.rotation();
254 const Vector3D localZAxis = rotation.col(2);
268 const auto& [rotToLocalXAxis, rotToLocalYAxis, rotToLocalZAxis] =
273 planeSurfaceObject->alignmentToPathDerivative(
tgContext, rotToLocalZAxis,
274 globalPosition, direction);
277 expAlignToPath << 0, 0, 1, 2, -1, 0;
283 const auto& loc3DToLocBound =
284 planeSurfaceObject->localCartesianToBoundLocalDerivative(
tgContext,
287 CHECK_CLOSE_ABS(loc3DToLocBound, LocalCartesianToBoundLocalMatrix::Identity(),
293 derivatives.segment<3>(0) =
momentum;
295 planeSurfaceObject->alignmentToBoundDerivative(
tgContext, derivatives,
296 globalPosition, direction);
301 expAlignToloc0 << -1, 0, 0, 0, 0, 2;
303 expAlignToloc1 << 0, -1, 0, 0, 0, -1;
309 BOOST_AUTO_TEST_SUITE_END()