9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
20 namespace tt = boost::test_tools;
21 using boost::test_tools::output_test_stream;
22 namespace utf = boost::unit_test;
31 BOOST_AUTO_TEST_SUITE(ConeSurfaces)
39 double alpha{
M_PI / 8.}, halfPhiSector{
M_PI / 16.}, zMin{1.0}, zMax{10.};
40 bool symmetric(
false);
43 BOOST_CHECK_EQUAL(Surface::makeShared<ConeSurface>(Transform3D::Identity(),
48 Surface::makeShared<ConeSurface>(pTransform,
alpha, symmetric)->type(),
52 BOOST_CHECK_EQUAL(Surface::makeShared<ConeSurface>(pTransform,
alpha, zMin,
61 std::make_shared<const ConeBounds>(
alpha, zMin, zMax, halfPhiSector, 0.);
63 Surface::makeShared<ConeSurface>(pTransform, pConeBounds)->type(),
68 auto coneSurfaceObject =
69 Surface::makeShared<ConeSurface>(pTransform,
alpha, symmetric);
70 auto copiedConeSurface = Surface::makeShared<ConeSurface>(*coneSurfaceObject);
72 BOOST_CHECK(*copiedConeSurface == *coneSurfaceObject);
75 auto copiedTransformedConeSurface = Surface::makeShared<ConeSurface>(
76 tgContext, *coneSurfaceObject, pTransform);
77 BOOST_CHECK_EQUAL(copiedTransformedConeSurface->type(),
Surface::Cone);
80 BOOST_CHECK_THROW(
auto nullBounds = Surface::makeShared<ConeSurface>(
81 Transform3D::Identity(),
nullptr),
89 bool symmetric(
false);
92 auto coneSurfaceObject =
93 Surface::makeShared<ConeSurface>(pTransform,
alpha, symmetric);
99 Vector3D binningPosition{0., 1., 2.};
102 binningPosition, 1
e-6);
105 Vector3D globalPosition{2.0, 2.0, 2.0};
107 double rootHalf = std::sqrt(0.5);
109 expectedFrame << -rootHalf, 0., rootHalf, rootHalf, 0., rootHalf, 0., 1., 0.;
112 expectedFrame, 1
e-6, 1e-9);
121 Vector3D normalAtPiBy2{0.0312768, 0.92335, -0.382683};
124 normalAtPiBy2, 1e-2, 1e-9);
139 Vector3D expectedPosition{0.0220268, 1.65027, 3.5708};
154 BOOST_CHECK(coneSurfaceObject->isOnSurface(
tgContext, globalPosition,
162 0.40218866453252877, 0.01);
165 BOOST_CHECK_EQUAL(coneSurfaceObject->name(),
166 std::string(
"Acts::ConeSurface"));
185 bool symmetric(
false);
188 auto coneSurfaceObject =
189 Surface::makeShared<ConeSurface>(pTransform,
alpha, symmetric);
191 auto coneSurfaceObject2 =
192 Surface::makeShared<ConeSurface>(pTransform,
alpha, symmetric);
195 BOOST_CHECK(*coneSurfaceObject == *coneSurfaceObject2);
197 BOOST_TEST_CHECKPOINT(
198 "Create and then assign a ConeSurface object to the existing one");
200 auto assignedConeSurface =
201 Surface::makeShared<ConeSurface>(Transform3D::Identity(), 0.1,
true);
202 *assignedConeSurface = *coneSurfaceObject;
204 BOOST_CHECK(*assignedConeSurface == *coneSurfaceObject);
208 double alpha{
M_PI / 8.}, zMin{0.}, zMax{10.};
214 auto pConeBounds = std::make_shared<const ConeBounds>(
alpha, zMin, zMax);
215 auto pCone = Surface::makeShared<ConeSurface>(pTransform, pConeBounds);
216 auto pConeExtent = pCone->polyhedronRepresentation(
tgContext, 1).extent();
218 double rMax = zMax * std::tan(alpha);
229 double halfPhiSector =
M_PI / 8.;
231 std::make_shared<const ConeBounds>(
alpha, zMin, zMax, halfPhiSector, 0.);
232 pCone = Surface::makeShared<ConeSurface>(pTransform, pConeBounds);
233 pConeExtent = pCone->polyhedronRepresentation(
tgContext, 1).extent();
244 bool symmetric(
false);
247 auto coneSurfaceObject =
248 Surface::makeShared<ConeSurface>(pTransform,
alpha, symmetric);
250 const auto& rotation = pTransform.rotation();
252 const Vector3D localZAxis = rotation.col(2);
257 Vector3D globalPosition{0, 1. + std::tan(alpha), 3};
261 const auto& loc3DToLocBound =
262 coneSurfaceObject->localCartesianToBoundLocalDerivative(
tgContext,
266 LocalCartesianToBoundLocalMatrix::Zero();
267 expLoc3DToLocBound << -1, 0,
M_PI / 2. * std::tan(alpha), 0, 0, 1;
271 BOOST_AUTO_TEST_SUITE_END()