9 #include <boost/test/unit_test.hpp>
40 using namespace Acts::detail;
41 using namespace Acts::Experimental;
42 using namespace Acts::Experimental::detail;
50 template <
typename indexed_surface_gr
id>
51 std::size_t countBins(
const indexed_surface_grid& isGrid) {
52 std::size_t nonEmptyBins = 0
u;
53 for (std::size_t igb = 0
u; igb < isGrid.grid.size(); ++igb) {
54 const auto& gb = isGrid.grid.at(igb);
68 ACTS_INFO(
"Testing bin sequence generators.");
71 auto seq48e0b10B =
binSequence({4
u, 8
u}, 0
u, 10
u, AxisBoundaryType::Bound);
72 std::vector<std::size_t> reference = {4
u, 5
u, 6
u, 7
u, 8u};
73 BOOST_CHECK(seq48e0b10B == reference);
76 auto seq48e1b10B =
binSequence({4
u, 8u}, 1
u, 10
u, AxisBoundaryType::Bound);
77 reference = {3
u, 4
u, 5
u, 6
u, 7
u, 8
u, 9u};
78 BOOST_CHECK(seq48e1b10B == reference);
81 auto seq48e3b10B =
binSequence({4
u, 8u}, 3
u, 10
u, AxisBoundaryType::Bound);
82 reference = {1
u, 2
u, 3
u, 4
u, 5
u, 6
u, 7
u, 8
u, 9
u, 10u};
83 BOOST_CHECK(seq48e3b10B == reference);
86 auto seq48e3b10O =
binSequence({4
u, 8u}, 3
u, 10
u, AxisBoundaryType::Open);
87 reference = {1
u, 2
u, 3
u, 4
u, 5
u, 6
u, 7
u, 8
u, 9
u, 10
u, 11u};
88 BOOST_CHECK(seq48e3b10O == reference);
91 auto seq48e0b10C =
binSequence({4
u, 8u}, 0
u, 20
u, AxisBoundaryType::Closed);
92 reference = {4
u, 5
u, 6
u, 7
u, 8u};
93 BOOST_CHECK(seq48e0b10C == reference);
96 auto seq48e1b10C =
binSequence({4
u, 8u}, 1
u, 20
u, AxisBoundaryType::Closed);
97 reference = {3
u, 4
u, 5
u, 6
u, 7
u, 8
u, 9u};
98 BOOST_CHECK(seq48e1b10C == reference);
103 reference = {1
u, 18
u, 19
u, 20u};
104 BOOST_CHECK(seq1029e1b20C == reference);
107 auto seq218e0b20C =
binSequence({2
u, 18u}, 0
u, 20
u, AxisBoundaryType::Closed);
108 reference = {1
u, 2
u, 18
u, 19
u, 20u};
109 BOOST_CHECK(seq218e0b20C == reference);
112 auto seq218e2b20C =
binSequence({2
u, 18u}, 2
u, 20
u, AxisBoundaryType::Closed);
113 reference = {1
u, 2
u, 3
u, 4
u, 16
u, 17
u, 18
u, 19
u, 20u};
114 BOOST_CHECK(seq218e2b20C == reference);
120 ACTS_INFO(
"Testing one surface with center generator, should lead to 1 bin.");
133 auto rBounds = std::make_shared<RectangleBounds>(4., 4.);
134 auto pSurface = Surface::makeShared<PlaneSurface>(Transform3::Identity(),
141 std::vector<std::shared_ptr<Surface>> surfaces = {
pSurface};
144 filler.fill(
tContext, indexedGridXY, surfaces, generator);
146 std::size_t nonEmptyBins = countBins<decltype(indexedGridXY)>(indexedGridXY);
148 ACTS_INFO(
"- filled " << nonEmptyBins <<
" bins of the grid.");
149 BOOST_CHECK(nonEmptyBins == 1
u);
156 "Testing one surface with bin value generator, should lead to 1 bin.");
169 auto rBounds = std::make_shared<RectangleBounds>(4., 4.);
170 auto pSurface = Surface::makeShared<PlaneSurface>(Transform3::Identity(),
178 std::vector<std::shared_ptr<Surface>> surfaces = {
pSurface};
181 filler.fill(
tContext, indexedGridXY, surfaces, generator);
183 std::size_t nonEmptyBins = countBins<decltype(indexedGridXY)>(indexedGridXY);
184 ACTS_INFO(
"- filled " << nonEmptyBins <<
" bins of the grid.");
185 BOOST_CHECK(nonEmptyBins == 1
u);
192 "Testing one surface with polyhedron generator without expansion, should "
193 "lead to 5 unique bins, 25 total bins filled");
206 auto rBounds = std::make_shared<RectangleBounds>(4., 4.);
207 auto pSurface = Surface::makeShared<PlaneSurface>(Transform3::Identity(),
215 std::vector<std::shared_ptr<Surface>> surfaces = {
pSurface};
218 filler.fill(
tContext, indexedGridXY, surfaces, generator);
220 std::size_t nonEmptyBins = countBins<decltype(indexedGridXY)>(indexedGridXY);
221 ACTS_INFO(
"- filled " << nonEmptyBins <<
" bins of the grid.");
222 BOOST_CHECK(nonEmptyBins == 25
u);
229 "Testing one surface with polyhedron generator and expansion, should "
230 "lead to 5 unique bins, 49 total bins filled");
243 auto rBounds = std::make_shared<RectangleBounds>(4., 4.);
244 auto pSurface = Surface::makeShared<PlaneSurface>(Transform3::Identity(),
252 std::vector<std::shared_ptr<Surface>> surfaces = {
pSurface};
255 filler.fill(
tContext, indexedGridXY, surfaces, generator);
257 std::size_t nonEmptyBins = countBins<decltype(indexedGridXY)>(indexedGridXY);
258 ACTS_INFO(
"- filled " << nonEmptyBins <<
" bins of the grid.");
259 BOOST_CHECK(nonEmptyBins == 49
u);
266 "Testing one surface with polyhedron generator without expansion, should "
267 "lead to 5 unique bins, 6 total bins filled");
280 auto cBounds = std::make_shared<CylinderBounds>(10, 2., M_PI / 30, 0.);
281 auto cSurface = Surface::makeShared<CylinderSurface>(Transform3::Identity(),
289 std::vector<std::shared_ptr<Surface>> surfaces = {
cSurface};
292 filler.fill(
tContext, indexedGridZPhi, surfaces, generator);
294 std::size_t nonEmptyBins =
295 countBins<decltype(indexedGridZPhi)>(indexedGridZPhi);
296 ACTS_INFO(
"- filled " << nonEmptyBins <<
" bins of the grid.");
297 BOOST_CHECK(nonEmptyBins == 6
u);
303 ACTS_INFO(
"Testing one surface at M_PI jump, with polyhedron generator");
316 auto cBounds = std::make_shared<CylinderBounds>(10, 2., M_PI / 10, 0.);
317 auto tf =
AngleAxis3(M_PI, Vector3::UnitZ()) * Transform3::Identity();
325 std::vector<std::shared_ptr<Surface>> surfaces = {
cSurface};
328 filler.fill(
tContext, indexedGridZPhi, surfaces, generator);
330 std::size_t nonEmptyBins =
331 countBins<decltype(indexedGridZPhi)>(indexedGridZPhi);
332 ACTS_INFO(
"- filled " << nonEmptyBins <<
" bins of the grid.");
333 BOOST_CHECK(nonEmptyBins == 9
u);
336 BOOST_AUTO_TEST_SUITE_END()