9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
23 namespace tt = boost::test_tools;
29 BOOST_AUTO_TEST_SUITE(Geometry)
32 double rmin{10.},
rmax{20.}, halfz{30.}, halfphi{
M_PI / 4}, avgphi{0.};
40 BOOST_CHECK_EQUAL(solidCylinderSector.decomposeToSurfaces().size(), 5);
44 BOOST_CHECK_EQUAL(tubeCylinder.decomposeToSurfaces().size(), 4);
48 BOOST_CHECK_EQUAL(tubeCylinderSector.decomposeToSurfaces().size(), 6);
53 double rmed = 0.5 * (rmin +
rmax);
54 double rthickness = (
rmax - rmin);
57 BOOST_CHECK_EQUAL(original, fromCylinder);
62 BOOST_CHECK_EQUAL(original, fromDisc);
66 BOOST_CHECK_EQUAL(original, copied);
70 BOOST_CHECK_EQUAL(original, assigned);
74 double rmin{10.},
rmax{20.}, halfz{30.}, halfphi{
M_PI / 4}, avgphi{0.};
77 std::array<double, CylinderVolumeBounds::eSize>
values;
78 std::vector<double> valvector = original.
values();
81 BOOST_CHECK_EQUAL(original, recreated);
85 double rmin{10.},
rmax{20.}, halfz{30.}, halfphi{
M_PI / 4}, avgphi{0.};
116 double rmed = 0.5 * (rmin +
rmax);
131 double rmin{10.},
rmax{20.}, halfz{30.}, halfphi{
M_PI / 4}, avgphi{0.};
146 bdata::random(-
M_PI,
M_PI) ^ bdata::random(-10., 10.) ^
147 bdata::random(-10., 10.) ^ bdata::random(-10., 10.) ^
170 auto mutableTransformPtr = std::make_shared<Transform3D>(
Translation3D(pos));
171 (*mutableTransformPtr) *= rotZ;
172 (*mutableTransformPtr) *= rotY;
173 (*mutableTransformPtr) *= rotX;
177 std::vector<std::shared_ptr<const Acts::Surface>> boundarySurfaces =
188 (transformPtr->inverse() * boundarySurfaces.at(1)->center(tgContext)).
z();
189 double centerPosZ = (transformPtr->inverse() *
pos).
z();
191 (transformPtr->inverse() * boundarySurfaces.at(0)->center(tgContext)).
z();
193 BOOST_CHECK_LT(centerPosZ, posDiscPosZ);
194 BOOST_CHECK_GT(centerPosZ, negDiscPosZ);
207 transformPtr->rotation().col(2).dot(
208 boundarySurfaces.at(1)->normal(tgContext,
Acts::Vector2D(0., 0.))),
213 transformPtr->rotation().col(2).dot(
214 boundarySurfaces.at(0)->normal(tgContext,
Acts::Vector2D(0., 0.))),
223 std::vector<IdentifiedPolyderon> tPolyhedrons;
226 const std::string&
name) ->
void {
227 std::string writeBase = std::string(
"CylinderVolumeBounds_") +
name;
231 for (
const auto& sf : surfaces) {
232 Polyhedron phComponent = sf->polyhedronRepresentation(tgContext, 72);
233 phCombined.
merge(phComponent);
234 tPolyhedrons.push_back(
238 tPolyhedrons.push_back({writeBase,
false, phCombined});
245 combineAndDecompose(cvbSurfaces,
"Solid");
252 BOOST_CHECK_EQUAL(
bb.entity(),
nullptr);
253 BOOST_CHECK_EQUAL(
bb.max(),
Vector3D(5, 5, 10));
254 BOOST_CHECK_EQUAL(
bb.min(),
Vector3D(-5, -5, -10));
257 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
262 bb = cvb.boundingBox();
263 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
264 BOOST_CHECK_EQUAL(bb.max(),
Vector3D(8, 8, 12));
265 BOOST_CHECK_EQUAL(bb.min(),
Vector3D(-8, -8, -12));
266 cvbSurfaces = cvb.decomposeToSurfaces();
267 combineAndDecompose(cvbSurfaces,
"Tube");
272 bb = cvb.boundingBox();
273 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
276 bb.min(),
Vector3D(5 * std::cos(angle), -8 * std::sin(angle), -13), tol);
277 cvbSurfaces = cvb.decomposeToSurfaces();
278 combineAndDecompose(cvbSurfaces,
"TubeSector");
282 bb = cvb.boundingBox(&rot);
283 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
286 bb.min(),
Vector3D(-8 * std::sin(angle), 5 * std::cos(angle), -13), tol);
289 bb = cvb.boundingBox(&rot);
290 BOOST_CHECK_EQUAL(bb.entity(),
nullptr);
296 BOOST_AUTO_TEST_SUITE_END()