9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
38 namespace ActsFatras {
40 BOOST_AUTO_TEST_SUITE(Digitization)
45 auto rectangleBounds = std::make_shared<Acts::RectangleBounds>(1., 1.);
46 auto planeSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(
47 Acts::Transform3::Identity(), rectangleBounds);
58 cl.
segments(geoCtx, *planeSurface, pixelated, {nPosition, nPosition});
59 BOOST_CHECK(nSegments.size() == 1);
60 BOOST_CHECK(nSegments[0].bin[0] == 13);
61 BOOST_CHECK(nSegments[0].bin[1] == 17);
67 cl.
segments(geoCtx, *planeSurface, pixelated, {ixPositionS, ixPositionE});
68 BOOST_CHECK(ixSegments.size() == 4);
74 cl.
segments(geoCtx, *planeSurface, pixelated, {iyPositionS, iyPositionE});
75 BOOST_CHECK(iySegments.size() == 3);
80 auto ixySegments = cl.
segments(geoCtx, *planeSurface, pixelated,
81 {ixyPositionS, ixyPositionE});
82 BOOST_CHECK(ixySegments.size() == 18);
89 std::make_shared<const Acts::RadialBounds>(5., 10., 0.25, 0.);
90 auto radialDisc = Acts::Surface::makeShared<Acts::DiscSurface>(
91 Acts::Transform3::Identity(), radialBounds);
102 cl.
segments(geoCtx, *radialDisc, strips, {nPosition, nPosition});
103 BOOST_CHECK(nSegments.size() == 1);
104 BOOST_CHECK(nSegments[0].bin[0] == 0);
105 BOOST_CHECK(nSegments[0].bin[1] == 161);
111 cl.
segments(geoCtx, *radialDisc, strips, {sPositionS, sPositionE});
112 BOOST_CHECK(sSegment.size() == 59);
117 sSegment = cl.
segments(geoCtx, *radialDisc, strips, {sPositionS, sPositionE});
118 BOOST_CHECK(sSegment.size() == 2);
123 bdata::random(0., 1.) ^ bdata::random(0., 1.) ^
124 bdata::random(0., 1.) ^ bdata::random(0., 1.) ^
126 startR0, startR1, endR0, endR1,
index) {
132 auto testBeds = pstd(1.);
136 for (
const auto& tb : testBeds) {
137 const auto&
name = std::get<0>(tb);
138 const auto*
surface = (std::get<1>(tb)).get();
139 const auto& segmentation = std::get<2>(tb);
140 const auto& randomizer = std::get<3>(tb);
145 const auto centerXY = surface->center(geoCtx).segment<2>(0);
147 shape.open(
"Channelizer" +
name +
"Borders.csv");
149 const auto* pBounds =
151 csvHelper.
writePolygon(shape, pBounds->vertices(1), -centerXY);
153 const auto* dBounds =
155 csvHelper.
writePolygon(shape, dBounds->vertices(72), -centerXY);
158 grid.open(
"Channelizer" +
name +
"Grid.csv");
159 if (segmentation.binningData()[0].binvalue ==
Acts::binX and
160 segmentation.binningData()[1].binvalue ==
Acts::binY) {
161 double bxmin = segmentation.binningData()[0].min;
162 double bxmax = segmentation.binningData()[0].max;
163 double bymin = segmentation.binningData()[1].min;
164 double bymax = segmentation.binningData()[1].max;
165 const auto& xboundaries = segmentation.binningData()[0].boundaries();
166 const auto& yboundaries = segmentation.binningData()[1].boundaries();
167 for (
const auto xval : xboundaries) {
168 csvHelper.
writeLine(grid, {xval, bymin}, {xval, bymax});
170 for (
const auto yval : yboundaries) {
171 csvHelper.
writeLine(grid, {bxmin, yval}, {bxmax, yval});
173 }
else if (segmentation.binningData()[0].binvalue ==
Acts::binR and
174 segmentation.binningData()[1].binvalue ==
Acts::binPhi) {
175 double brmin = segmentation.binningData()[0].min;
176 double brmax = segmentation.binningData()[0].max;
177 double bphimin = segmentation.binningData()[1].min;
178 double bphimax = segmentation.binningData()[1].max;
179 const auto& rboundaries = segmentation.binningData()[0].boundaries();
180 const auto& phiboundaries = segmentation.binningData()[1].boundaries();
181 for (
const auto r : rboundaries) {
182 csvHelper.
writeArc(grid,
r, bphimin, bphimax);
184 for (
const auto phi : phiboundaries) {
185 double cphi = std::cos(
phi);
186 double sphi = std::sin(
phi);
187 csvHelper.
writeLine(grid, {brmin * cphi, brmin * sphi},
188 {brmax * cphi, brmax * sphi});
193 auto start = randomizer(startR0, startR1);
194 auto end = randomizer(endR0, endR1);
196 std::ofstream segments;
200 std::ofstream cluster;
207 for (
const auto& cs : cSegement) {
208 csvHelper.
writeLine(segments, cs.path2D[0], cs.path2D[1]);
216 BOOST_AUTO_TEST_SUITE_END()