9 #include <boost/test/unit_test.hpp>
25 namespace tt = boost::test_tools;
64 std::vector<float>
values = {0., 1., 2., 3., 4., 10.};
70 std::vector<float>
phiValues = {-M_PI, -2., -1., 1., 2., M_PI};
82 std::vector<float>
sstr = {0., 1., 1.5, 2., 3.};
99 std::vector<float> values_binary;
100 std::vector<float> phiValues_binary;
160 std::vector<float> values_binary;
161 std::vector<float> phiValues_binary;
217 BOOST_CHECK_EQUAL(phiData_arb_binary.
search(M_PI), size_t(0));
227 std::vector<float> values_binary;
228 std::vector<float> phiValues_binary;
270 std::vector<float> values_binary;
271 std::vector<float> phiValues_binary;
286 xData_arb_binary.
bins());
295 BOOST_CHECK_EQUAL(phiData_arb_binary.
search(4.), size_t(0));
301 std::vector<float> boundaries = {0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.};
306 float phiStep = M_PI * 2. / 5.;
307 std::vector<float> phiBoundaries_eq = {-M_PI,
308 float(-M_PI + 1 * phiStep),
309 float(-M_PI + 2 * phiStep),
310 float(-M_PI + 3 * phiStep),
311 float(-M_PI + 4 * phiStep),
312 float(-M_PI + 5 * phiStep)};
321 std::vector<float> values_binary;
322 std::vector<float> phiValues_binary;
346 BOOST_CHECK_EQUAL(xData_arb_binary.
center(0), 0.5 *
delta);
349 std::vector<float> center = {0.5, 1.5, 2.5, 3.5, 4.5,
350 5.5, 6.5, 7.5, 8.5, 9.5};
351 for (
size_t ib = 0;
ib < center.size(); ++
ib) {
356 float phiStep = M_PI * 2. / 5.;
357 std::vector<float> phiCenters_eq = {
358 float(-M_PI + 0.5 * phiStep), float(-M_PI + 1.5 * phiStep),
359 float(-M_PI + 2.5 * phiStep), float(-M_PI + 3.5 * phiStep),
360 float(-M_PI + 4.5 * phiStep)};
362 for (
size_t ib = 0;
ib < phiCenters_eq.size(); ++
ib) {
373 float phiStep = M_PI * 2. / 5.;
374 std::vector<float> phiBoundaries_mod = {
375 float(-M_PI + deltaPhi),
376 float(-M_PI + 1 * phiStep) +
deltaPhi,
377 float(-M_PI + 2 * phiStep) +
deltaPhi,
378 float(-M_PI + 3 * phiStep) +
deltaPhi,
379 float(-M_PI + 4 * phiStep) +
deltaPhi,
380 float(-M_PI + 5 * phiStep) + deltaPhi};
386 float firstAngle = (-M_PI + 1.5 *
deltaPhi);
387 Vector3 firstBin(cos(firstAngle), sin(firstAngle), 0.);
388 BOOST_CHECK_EQUAL(phiData_mod.
search(firstAngle), size_t(0));
389 BOOST_CHECK_EQUAL(phiData_mod.
searchGlobal(firstBin), size_t(0));
391 float firstAngleNeg = (-M_PI + 0.5 *
deltaPhi);
392 Vector3 lastBinNeg(cos(firstAngleNeg), sin(firstAngleNeg), 0.);
393 BOOST_CHECK_EQUAL(phiData_mod.
search(firstAngleNeg), size_t(4));
394 BOOST_CHECK_EQUAL(phiData_mod.
searchGlobal(lastBinNeg), size_t(4));
396 float lastAnglePos = (M_PI + 0.5 *
deltaPhi);
397 Vector3 lastBinPos(cos(lastAnglePos), sin(lastAnglePos), 0.);
398 BOOST_CHECK_EQUAL(phiData_mod.
search(lastAnglePos), size_t(4));
399 BOOST_CHECK_EQUAL(phiData_mod.
searchGlobal(lastBinPos), size_t(4));
402 float underscaledAngle = -M_PI - 0.5 *
deltaPhi;
403 Vector3 underscaledPos(cos(underscaledAngle), sin(underscaledAngle), 0.);
404 BOOST_CHECK_EQUAL(phiData_mod.
search(underscaledAngle), size_t(4));
405 BOOST_CHECK_EQUAL(phiData_mod.
searchGlobal(underscaledPos), size_t(4));