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>(Transform3D::Identity(), rMin, rMax));
48 Surface::makeShared<DiscSurface>(pTransform, rMin, rMax, halfPhiSector));
51 auto anotherDiscSurface =
52 Surface::makeShared<DiscSurface>(pTransform, rMin, rMax, halfPhiSector);
57 auto copiedSurface = Surface::makeShared<DiscSurface>(*anotherDiscSurface);
58 BOOST_TEST_MESSAGE(
"Copy constructed DiscSurface ok");
61 BOOST_CHECK_NO_THROW(Surface::makeShared<DiscSurface>(
62 tgContext, *anotherDiscSurface, pTransform));
67 auto nullBounds = Surface::makeShared<DiscSurface>(
nullptr, detElem),
74 double rMin(1.0), rMax(5.0), halfPhiSector(
M_PI / 8.);
75 auto discSurfaceObject = Surface::makeShared<DiscSurface>(
76 Transform3D::Identity(), rMin, rMax, halfPhiSector);
83 BOOST_CHECK_EQUAL(discSurfaceObject->normal(
tgContext), zAxis);
87 BOOST_CHECK_EQUAL(discSurfaceObject->normal(
tgContext, lpos), zAxis);
100 Vector3D ignoredMomentum{0., 0., 0.};
102 Vector3D point3DNotInSector{0.0, 1.2, 0};
103 Vector3D point3DOnSurface{1.2, 0.0, 0};
104 BOOST_CHECK(!discSurfaceObject->isOnSurface(
105 tgContext, point3DNotInSector, ignoredMomentum,
true));
106 BOOST_CHECK(discSurfaceObject->isOnSurface(
tgContext, point3DOnSurface,
107 ignoredMomentum,
true));
110 Vector3D returnedPosition{10.9, 8.7, 6.5};
111 Vector3D expectedPosition{1.2, 0, 0};
115 discSurfaceObject->localToGlobal(
tgContext, rPhiOnDisc, ignoredMomentum);
118 returnedPosition = discSurfaceObject->localToGlobal(
119 tgContext, rPhiNotInSector, ignoredMomentum);
120 Vector3D expectedNonPosition{-1.2, 0, 0};
124 Vector2D returnedLocalPosition{33., 44.};
125 Vector2D expectedLocalPosition{1.2, 0.0};
126 returnedLocalPosition =
128 ->globalToLocal(
tgContext, point3DOnSurface, ignoredMomentum)
133 returnedLocalPosition =
135 ->globalToLocal(
tgContext, point3DNotInSector, ignoredMomentum)
138 Vector3D pointOutsideR{0.0, 100., 0};
139 returnedLocalPosition =
141 ->globalToLocal(
tgContext, pointOutsideR, ignoredMomentum)
151 CHECK_CLOSE_REL(discSurfaceObject->localCartesianToPolar(cartesian1_1),
155 CHECK_CLOSE_REL(discSurfaceObject->localPolarToLocalCartesian(rPhi1_1),
159 Vector3D cartesian3D1_1{1., 1., 0.};
161 discSurfaceObject->localCartesianToGlobal(
tgContext, cartesian1_1),
162 cartesian3D1_1, 1
e-6);
166 discSurfaceObject->globalToLocalCartesian(
tgContext, cartesian3D1_1),
170 double projected3DMomentum = std::sqrt(3.) * 1.e6;
172 projected3DMomentum};
173 Vector3D ignoredPosition{1.1, 2.2, 3.3};
179 Vector3D globalPosition{1.2, 0.0, -10.};
185 auto sfIntersection =
186 discSurfaceObject->intersect(
tgContext, globalPosition, direction,
false);
188 Intersection3D::Status::reachable};
189 BOOST_CHECK(
bool(sfIntersection));
191 expectedIntersect.position, 1
e-9);
193 expectedIntersect.pathLength, 1
e-9);
194 BOOST_CHECK_EQUAL(sfIntersection.object, discSurfaceObject.get());
198 boost::test_tools::output_test_stream nameOuput;
199 nameOuput << discSurfaceObject->name();
200 BOOST_CHECK(nameOuput.is_equal(
"Acts::DiscSurface"));
206 double rMin(1.0), rMax(5.0), halfPhiSector(
M_PI / 8.);
207 auto discSurfaceObject = Surface::makeShared<DiscSurface>(
208 Transform3D::Identity(), rMin, rMax, halfPhiSector);
210 Surface::makeShared<DiscSurface>(Transform3D::Identity(), 2.2, 4.4, 0.07);
212 BOOST_CHECK_NO_THROW(*assignedDisc = *discSurfaceObject);
213 BOOST_CHECK((*assignedDisc) == (*discSurfaceObject));
218 double rMin(1.0), rMax(5.0);
221 Surface::makeShared<DiscSurface>(Transform3D::Identity(), 0., rMax);
222 auto pDiscExtent = pDisc->polyhedronRepresentation(
tgContext, 1).extent();
236 Surface::makeShared<DiscSurface>(Transform3D::Identity(), rMin, rMax);
237 auto pRingExtent = pRing->polyhedronRepresentation(
tgContext, 1).extent();
253 double rMin(1.0), rMax(5.0), halfPhiSector(
M_PI / 8.);
254 auto discSurfaceObject =
255 Surface::makeShared<DiscSurface>(
transform, rMin, rMax, halfPhiSector);
257 const auto& rotation = transform.rotation();
259 const Vector3D localZAxis = rotation.col(2);
270 const auto& [rotToLocalXAxis, rotToLocalYAxis, rotToLocalZAxis] =
275 discSurfaceObject->alignmentToPathDerivative(
tgContext, rotToLocalZAxis,
276 globalPosition, direction);
279 expAlignToPath << 0, 0, 1, 3, 0, 0;
285 const auto& loc3DToLocBound =
286 discSurfaceObject->localCartesianToBoundLocalDerivative(
tgContext,
290 LocalCartesianToBoundLocalMatrix::Zero();
291 expLoc3DToLocBound << 0, 1, 0, -1.0 / 3, 0, 0;
295 BOOST_AUTO_TEST_SUITE_END()