9 #include <boost/test/unit_test.hpp>
20 namespace tt = boost::test_tools;
56 std::vector<float>
values = {0., 1., 2., 3., 4., 10.};
74 std::vector<float>
sstr = {0., 1., 1.5, 2., 3.};
91 std::vector<float> values_binary;
92 std::vector<float> phiValues_binary;
150 std::vector<float> values_binary;
151 std::vector<float> phiValues_binary;
207 BOOST_CHECK_EQUAL(phiData_arb_binary.
search(
M_PI), size_t(0));
217 std::vector<float> values_binary;
218 std::vector<float> phiValues_binary;
260 std::vector<float> values_binary;
261 std::vector<float> phiValues_binary;
276 xData_arb_binary.
bins());
283 BOOST_CHECK_EQUAL(bin,
size_t(9));
286 BOOST_CHECK_EQUAL(bin,
size_t(0));
290 BOOST_CHECK_EQUAL(bin,
size_t(5));
293 BOOST_CHECK_EQUAL(bin,
size_t(0));
300 BOOST_CHECK_EQUAL(bin,
size_t(0));
308 BOOST_CHECK_EQUAL(phiData_arb_binary.
search(4.), size_t(0));
312 BOOST_CHECK_EQUAL(bin,
size_t(0));
315 BOOST_CHECK_EQUAL(bin,
size_t(4));
319 BOOST_CHECK_EQUAL(bin,
size_t(0));
322 BOOST_CHECK_EQUAL(bin,
size_t(4));
326 BOOST_CHECK_EQUAL(bin,
size_t(0));
335 std::vector<float>
boundaries = {0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.};
340 float phiStep =
M_PI * 2. / 5.;
341 std::vector<float> phiBoundaries_eq = {-
M_PI,
342 float(-
M_PI + 1 * phiStep),
343 float(-
M_PI + 2 * phiStep),
344 float(-
M_PI + 3 * phiStep),
345 float(-
M_PI + 4 * phiStep),
346 float(-
M_PI + 5 * phiStep)};
355 std::vector<float> values_binary;
356 std::vector<float> phiValues_binary;
380 BOOST_CHECK_EQUAL(xData_arb_binary.
center(0), 0.5 *
delta);
383 std::vector<float> center = {0.5, 1.5, 2.5, 3.5, 4.5,
384 5.5, 6.5, 7.5, 8.5, 9.5};
385 for (
size_t ib = 0; ib < center.size(); ++ib) {
390 float phiStep =
M_PI * 2. / 5.;
391 std::vector<float> phiCenters_eq = {
392 float(-
M_PI + 0.5 * phiStep), float(-
M_PI + 1.5 * phiStep),
393 float(-
M_PI + 2.5 * phiStep), float(-
M_PI + 3.5 * phiStep),
394 float(-
M_PI + 4.5 * phiStep)};
396 for (
size_t ib = 0; ib < phiCenters_eq.size(); ++ib) {
405 float deltaPhi = 0.1;
407 float phiStep =
M_PI * 2. / 5.;
408 std::vector<float> phiBoundaries_mod = {
409 float(-
M_PI + deltaPhi),
410 float(-
M_PI + 1 * phiStep) + deltaPhi,
411 float(-
M_PI + 2 * phiStep) + deltaPhi,
412 float(-
M_PI + 3 * phiStep) + deltaPhi,
413 float(-
M_PI + 4 * phiStep) + deltaPhi,
414 float(-
M_PI + 5 * phiStep) + deltaPhi};
420 float firstAngle = (-
M_PI + 1.5 * deltaPhi);
421 Vector3D firstBin(
cos(firstAngle), sin(firstAngle), 0.);
422 BOOST_CHECK_EQUAL(phiData_mod.
search(firstAngle), size_t(0));
423 BOOST_CHECK_EQUAL(phiData_mod.
searchGlobal(firstBin), size_t(0));
425 float firstAngleNeg = (-
M_PI + 0.5 * deltaPhi);
426 Vector3D lastBinNeg(
cos(firstAngleNeg), sin(firstAngleNeg), 0.);
427 BOOST_CHECK_EQUAL(phiData_mod.
search(firstAngleNeg), size_t(4));
428 BOOST_CHECK_EQUAL(phiData_mod.
searchGlobal(lastBinNeg), size_t(4));
430 float lastAnglePos = (
M_PI + 0.5 * deltaPhi);
431 Vector3D lastBinPos(
cos(lastAnglePos), sin(lastAnglePos), 0.);
432 BOOST_CHECK_EQUAL(phiData_mod.
search(lastAnglePos), size_t(4));
433 BOOST_CHECK_EQUAL(phiData_mod.
searchGlobal(lastBinPos), size_t(4));
436 float underscaledAngle = -
M_PI - 0.5 * deltaPhi;
437 Vector3D underscaledPos(
cos(underscaledAngle), sin(underscaledAngle), 0.);
438 BOOST_CHECK_EQUAL(phiData_mod.
search(underscaledAngle), size_t(4));
439 BOOST_CHECK_EQUAL(phiData_mod.
searchGlobal(underscaledPos), size_t(4));