307 std::size_t
const N = NCryostats * NTPCs * NPlanes;
310 BOOST_TEST(data.
dimSize<0U>() == NCryostats);
311 BOOST_TEST(data.
dimSize<1U>() == NTPCs);
312 BOOST_TEST(data.
dimSize<2U>() == NPlanes);
313 BOOST_TEST(data.
dimSize<3U>() == 0U);
315 BOOST_TEST(!data.
empty());
316 BOOST_TEST(data.
size() ==
N);
319 for (
auto c: util::counter<unsigned int>(NCryostats))
320 for (
auto t: util::counter<unsigned int>(NTPCs))
321 for (
auto p: util::counter<unsigned int>(NPlanes))
322 BOOST_TEST((data[{ c, t,
p }]) == 0);
328 std::size_t expected_index = 0U;
331 for (
auto&
value: data) {
332 static_assert(std::is_same_v<decltype(
value), decltype(data)::reference>);
334 geo::PlaneID const expected_ID = data.mapper().ID(expected_index);
335 BOOST_TEST(
value == data[expected_ID]);
339 BOOST_TEST(data.size() == expected_index);
343 for (
auto&& [ ID,
value ]: data.items()) {
344 static_assert(std::is_same_v<decltype(ID),
geo::PlaneID>);
345 static_assert(std::is_same_v<decltype(
value), decltype(data)::reference>);
347 geo::PlaneID const expected_ID = data.mapper().ID(expected_index);
348 BOOST_TEST(ID == expected_ID);
349 BOOST_TEST(
value == data[expected_ID]);
353 BOOST_TEST(data.size() == expected_index);
355 BOOST_TEST( data.hasPlane({ 0, 0, 0}));
356 BOOST_TEST( data.hasPlane({ 0, 0, 1}));
357 BOOST_TEST(!data.hasPlane({ 0, 0, 2}));
358 BOOST_TEST( data.hasPlane({ 0, 1, 0}));
359 BOOST_TEST( data.hasPlane({ 0, 1, 1}));
360 BOOST_TEST(!data.hasPlane({ 0, 1, 2}));
361 BOOST_TEST( data.hasPlane({ 0, 2, 0}));
362 BOOST_TEST( data.hasPlane({ 0, 2, 1}));
363 BOOST_TEST(!data.hasPlane({ 0, 2, 2}));
364 BOOST_TEST(!data.hasPlane({ 0, 3, 0}));
365 BOOST_TEST(!data.hasPlane({ 0, 3, 1}));
366 BOOST_TEST(!data.hasPlane({ 0, 3, 2}));
367 BOOST_TEST(!data.hasPlane({ 0, 4, 0}));
368 BOOST_TEST(!data.hasPlane({ 0, 4, 1}));
369 BOOST_TEST(!data.hasPlane({ 0, 4, 2}));
370 BOOST_TEST( data.hasPlane({ 1, 0, 0}));
371 BOOST_TEST( data.hasPlane({ 1, 0, 1}));
372 BOOST_TEST(!data.hasPlane({ 1, 0, 2}));
373 BOOST_TEST( data.hasPlane({ 1, 1, 0}));
374 BOOST_TEST( data.hasPlane({ 1, 1, 1}));
375 BOOST_TEST(!data.hasPlane({ 1, 1, 2}));
376 BOOST_TEST( data.hasPlane({ 1, 2, 0}));
377 BOOST_TEST( data.hasPlane({ 1, 2, 1}));
378 BOOST_TEST(!data.hasPlane({ 1, 2, 2}));
379 BOOST_TEST(!data.hasPlane({ 1, 3, 0}));
380 BOOST_TEST(!data.hasPlane({ 1, 3, 1}));
381 BOOST_TEST(!data.hasPlane({ 1, 3, 2}));
382 BOOST_TEST(!data.hasPlane({ 1, 4, 0}));
383 BOOST_TEST(!data.hasPlane({ 1, 4, 1}));
384 BOOST_TEST(!data.hasPlane({ 1, 4, 2}));
385 BOOST_TEST(!data.hasPlane({ 2, 0, 0}));
386 BOOST_TEST(!data.hasPlane({ 2, 0, 1}));
387 BOOST_TEST(!data.hasPlane({ 2, 0, 2}));
388 BOOST_TEST(!data.hasPlane({ 2, 1, 0}));
389 BOOST_TEST(!data.hasPlane({ 2, 1, 1}));
390 BOOST_TEST(!data.hasPlane({ 2, 1, 2}));
391 BOOST_TEST(!data.hasPlane({ 2, 2, 0}));
392 BOOST_TEST(!data.hasPlane({ 2, 2, 1}));
393 BOOST_TEST(!data.hasPlane({ 2, 2, 2}));
394 BOOST_TEST(!data.hasPlane({ 2, 3, 0}));
395 BOOST_TEST(!data.hasPlane({ 2, 3, 1}));
396 BOOST_TEST(!data.hasPlane({ 2, 3, 2}));
397 BOOST_TEST(!data.hasPlane({ 2, 4, 0}));
398 BOOST_TEST(!data.hasPlane({ 2, 4, 1}));
399 BOOST_TEST(!data.hasPlane({ 2, 4, 2}));
495 BOOST_TEST( (data[{0, 0, 0}]) == 4);
496 BOOST_TEST(data.
at({0, 0, 0}) == 4);
498 BOOST_TEST( (data[{0, 0, 0}]) == 5);
499 BOOST_TEST(data.
at({0, 0, 0}) == 5);
502 BOOST_TEST( (data[{0, 0, 1}]) == 6);
503 BOOST_TEST(data.
at({0, 0, 1}) == 6);
505 BOOST_TEST( (data[{0, 0, 0}]) == 5);
507 data[{0, 1, 0}] = 15;
508 BOOST_TEST( (data[{0, 1, 0}]) == 15);
509 BOOST_TEST(data.
at({0, 1, 0}) == 15);
511 BOOST_TEST( (data[{0, 0, 0}]) == 5);
512 BOOST_TEST( (data[{0, 0, 1}]) == 6);
514 data[{0, 1, 1}] = 16;
515 BOOST_TEST( (data[{0, 1, 1}]) == 16);
516 BOOST_TEST(data.
at({0, 1, 1}) == 16);
518 BOOST_TEST( (data[{0, 0, 0}]) == 5);
519 BOOST_TEST( (data[{0, 0, 1}]) == 6);
520 BOOST_TEST( (data[{0, 1, 0}]) == 15);
522 data[{0, 2, 0}] = 25;
523 BOOST_TEST( (data[{0, 2, 0}]) == 25);
524 BOOST_TEST(data.
at({0, 2, 0}) == 25);
526 BOOST_TEST( (data[{0, 0, 0}]) == 5);
527 BOOST_TEST( (data[{0, 0, 1}]) == 6);
528 BOOST_TEST( (data[{0, 1, 0}]) == 15);
529 BOOST_TEST( (data[{0, 1, 1}]) == 16);
531 data[{0, 2, 1}] = 26;
532 BOOST_TEST( (data[{0, 2, 1}]) == 26);
533 BOOST_TEST(data.
at({0, 2, 1}) == 26);
535 BOOST_TEST( (data[{0, 0, 0}]) == 5);
536 BOOST_TEST( (data[{0, 0, 1}]) == 6);
537 BOOST_TEST( (data[{0, 1, 0}]) == 15);
538 BOOST_TEST( (data[{0, 1, 1}]) == 16);
539 BOOST_TEST( (data[{0, 2, 0}]) == 25);
541 data[{1, 0, 0}] = 105;
542 BOOST_TEST( (data[{1, 0, 0}]) == 105);
543 BOOST_TEST(data.
at({1, 0, 0}) == 105);
545 BOOST_TEST( (data[{0, 0, 0}]) == 5);
546 BOOST_TEST( (data[{0, 0, 1}]) == 6);
547 BOOST_TEST( (data[{0, 1, 0}]) == 15);
548 BOOST_TEST( (data[{0, 1, 1}]) == 16);
549 BOOST_TEST( (data[{0, 2, 0}]) == 25);
550 BOOST_TEST( (data[{0, 2, 1}]) == 26);
552 data[{1, 0, 1}] = 106;
553 BOOST_TEST( (data[{1, 0, 1}]) == 106);
554 BOOST_TEST(data.
at({1, 0, 1}) == 106);
556 BOOST_TEST( (data[{0, 0, 0}]) == 5);
557 BOOST_TEST( (data[{0, 0, 1}]) == 6);
558 BOOST_TEST( (data[{0, 1, 0}]) == 15);
559 BOOST_TEST( (data[{0, 1, 1}]) == 16);
560 BOOST_TEST( (data[{0, 2, 0}]) == 25);
561 BOOST_TEST( (data[{0, 2, 1}]) == 26);
562 BOOST_TEST( (data[{1, 0, 0}]) == 105);
564 data[{1, 1, 0}] = 115;
565 BOOST_TEST( (data[{1, 1, 0}]) == 115);
566 BOOST_TEST(data.
at({1, 1, 0}) == 115);
568 BOOST_TEST( (data[{0, 0, 0}]) == 5);
569 BOOST_TEST( (data[{0, 0, 1}]) == 6);
570 BOOST_TEST( (data[{0, 1, 0}]) == 15);
571 BOOST_TEST( (data[{0, 1, 1}]) == 16);
572 BOOST_TEST( (data[{0, 2, 0}]) == 25);
573 BOOST_TEST( (data[{0, 2, 1}]) == 26);
574 BOOST_TEST( (data[{1, 0, 0}]) == 105);
575 BOOST_TEST( (data[{1, 0, 1}]) == 106);
577 data[{1, 1, 1}] = 116;
578 BOOST_TEST( (data[{1, 1, 1}]) == 116);
579 BOOST_TEST(data.
at({1, 1, 1}) == 116);
581 BOOST_TEST( (data[{0, 0, 0}]) == 5);
582 BOOST_TEST( (data[{0, 0, 1}]) == 6);
583 BOOST_TEST( (data[{0, 1, 0}]) == 15);
584 BOOST_TEST( (data[{0, 1, 1}]) == 16);
585 BOOST_TEST( (data[{0, 2, 0}]) == 25);
586 BOOST_TEST( (data[{0, 2, 1}]) == 26);
587 BOOST_TEST( (data[{1, 0, 0}]) == 105);
588 BOOST_TEST( (data[{1, 0, 1}]) == 106);
589 BOOST_TEST( (data[{1, 1, 0}]) == 115);
591 data[{1, 2, 0}] = 125;
592 BOOST_TEST( (data[{1, 2, 0}]) == 125);
593 BOOST_TEST(data.
at({1, 2, 0}) == 125);
595 BOOST_TEST((data[{0, 0, 0}]) == 5);
596 BOOST_TEST((data[{0, 0, 1}]) == 6);
597 BOOST_TEST((data[{0, 1, 0}]) == 15);
598 BOOST_TEST((data[{0, 1, 1}]) == 16);
599 BOOST_TEST((data[{0, 2, 0}]) == 25);
600 BOOST_TEST((data[{0, 2, 1}]) == 26);
601 BOOST_TEST((data[{1, 0, 0}]) == 105);
602 BOOST_TEST((data[{1, 0, 1}]) == 106);
603 BOOST_TEST((data[{1, 1, 0}]) == 115);
604 BOOST_TEST((data[{1, 1, 1}]) == 116);
606 data[{1, 2, 1}] = 126;
607 BOOST_TEST( (data[{1, 2, 1}]) == 126);
608 BOOST_TEST(data.
at({1, 2, 1}) == 126);
610 BOOST_TEST((data[{0, 0, 0}]) == 5);
611 BOOST_TEST((data[{0, 0, 1}]) == 6);
612 BOOST_TEST((data[{0, 1, 0}]) == 15);
613 BOOST_TEST((data[{0, 1, 1}]) == 16);
614 BOOST_TEST((data[{0, 2, 0}]) == 25);
615 BOOST_TEST((data[{0, 2, 1}]) == 26);
616 BOOST_TEST((data[{1, 0, 0}]) == 105);
617 BOOST_TEST((data[{1, 0, 1}]) == 106);
618 BOOST_TEST((data[{1, 1, 0}]) == 115);
619 BOOST_TEST((data[{1, 1, 1}]) == 116);
620 BOOST_TEST((data[{1, 2, 0}]) == 125);
623 BOOST_CHECK_THROW(data.
at({0, 3, 0}), std::out_of_range);
624 BOOST_CHECK_THROW(data.
at({0, 4, 0}), std::out_of_range);
625 BOOST_CHECK_THROW(data.
at({1, 3, 0}), std::out_of_range);
626 BOOST_CHECK_THROW(data.
at({1, 4, 0}), std::out_of_range);
627 BOOST_CHECK_THROW(data.
at({2, 0, 0}), std::out_of_range);
628 BOOST_CHECK_THROW(data.
at({2, 1, 0}), std::out_of_range);
629 BOOST_CHECK_THROW(data.
at({2, 2, 0}), std::out_of_range);
630 BOOST_CHECK_THROW(data.
at({2, 3, 0}), std::out_of_range);
631 BOOST_CHECK_THROW(data.
at({2, 4, 0}), std::out_of_range);
632 BOOST_CHECK_THROW(data.
at({0, 3, 1}), std::out_of_range);
633 BOOST_CHECK_THROW(data.
at({0, 4, 1}), std::out_of_range);
634 BOOST_CHECK_THROW(data.
at({1, 3, 1}), std::out_of_range);
635 BOOST_CHECK_THROW(data.
at({1, 4, 1}), std::out_of_range);
636 BOOST_CHECK_THROW(data.
at({2, 0, 1}), std::out_of_range);
637 BOOST_CHECK_THROW(data.
at({2, 1, 1}), std::out_of_range);
638 BOOST_CHECK_THROW(data.
at({2, 2, 1}), std::out_of_range);
639 BOOST_CHECK_THROW(data.
at({2, 3, 1}), std::out_of_range);
640 BOOST_CHECK_THROW(data.
at({2, 4, 1}), std::out_of_range);
641 BOOST_CHECK_THROW(data.
at({0, 0, 2}), std::out_of_range);
642 BOOST_CHECK_THROW(data.
at({0, 1, 2}), std::out_of_range);
643 BOOST_CHECK_THROW(data.
at({0, 2, 2}), std::out_of_range);
644 BOOST_CHECK_THROW(data.
at({0, 3, 2}), std::out_of_range);
645 BOOST_CHECK_THROW(data.
at({1, 0, 2}), std::out_of_range);
646 BOOST_CHECK_THROW(data.
at({1, 1, 2}), std::out_of_range);
647 BOOST_CHECK_THROW(data.
at({1, 2, 2}), std::out_of_range);
648 BOOST_CHECK_THROW(data.
at({1, 3, 2}), std::out_of_range);
649 BOOST_CHECK_THROW(data.
at({2, 0, 2}), std::out_of_range);
650 BOOST_CHECK_THROW(data.
at({2, 1, 2}), std::out_of_range);
651 BOOST_CHECK_THROW(data.
at({2, 2, 2}), std::out_of_range);
652 BOOST_CHECK_THROW(data.
at({2, 3, 2}), std::out_of_range);
654 BOOST_TEST(data.
first() == 5);
656 BOOST_TEST((data[{0, 0, 0}]) == -5);
657 BOOST_TEST(data.
first() == -5);
660 BOOST_TEST(data.
last() == 126);
662 BOOST_TEST((data[{1U, 2U, 1U}]) == -126);
663 BOOST_TEST(data.
last() == -126);
666 auto const& constData = data;
669 BOOST_TEST(data.
dimSize<0U>() == NCryostats);
670 BOOST_TEST(data.
dimSize<1U>() == NTPCs);
671 BOOST_TEST(data.
dimSize<2U>() == NPlanes);
672 BOOST_TEST(data.
dimSize<3U>() == 0U);
675 (std::addressof(constData.first()) == std::addressof(data.
first()));
677 (std::addressof(constData.last()) == std::addressof(data.
last()));
679 BOOST_TEST((constData[{0, 0, 0}]) == (data[{0, 0, 0}]));
680 BOOST_TEST((constData[{0, 0, 1}]) == (data[{0, 0, 1}]));
681 BOOST_TEST((constData[{0, 1, 0}]) == (data[{0, 1, 0}]));
682 BOOST_TEST((constData[{0, 1, 1}]) == (data[{0, 1, 1}]));
683 BOOST_TEST((constData[{0, 2, 0}]) == (data[{0, 2, 0}]));
684 BOOST_TEST((constData[{0, 2, 1}]) == (data[{0, 2, 1}]));
685 BOOST_TEST((constData[{1, 0, 0}]) == (data[{1, 0, 0}]));
686 BOOST_TEST((constData[{1, 0, 1}]) == (data[{1, 0, 1}]));
687 BOOST_TEST((constData[{1, 1, 0}]) == (data[{1, 1, 0}]));
688 BOOST_TEST((constData[{1, 1, 1}]) == (data[{1, 1, 1}]));
689 BOOST_TEST((constData[{1, 2, 0}]) == (data[{1, 2, 0}]));
690 BOOST_TEST((constData[{1, 2, 1}]) == (data[{1, 2, 1}]));
691 BOOST_TEST(constData.at({0, 0, 0}) == data.
at({0, 0, 0}));
692 BOOST_TEST(constData.at({0, 0, 1}) == data.
at({0, 0, 1}));
693 BOOST_TEST(constData.at({0, 1, 0}) == data.
at({0, 1, 0}));
694 BOOST_TEST(constData.at({0, 1, 1}) == data.
at({0, 1, 1}));
695 BOOST_TEST(constData.at({0, 2, 0}) == data.
at({0, 2, 0}));
696 BOOST_TEST(constData.at({0, 2, 1}) == data.
at({0, 2, 1}));
697 BOOST_TEST(constData.at({1, 0, 0}) == data.
at({1, 0, 0}));
698 BOOST_TEST(constData.at({1, 0, 1}) == data.
at({1, 0, 1}));
699 BOOST_TEST(constData.at({1, 1, 0}) == data.
at({1, 1, 0}));
700 BOOST_TEST(constData.at({1, 1, 1}) == data.
at({1, 1, 1}));
701 BOOST_TEST(constData.at({1, 2, 0}) == data.
at({1, 2, 0}));
702 BOOST_TEST(constData.at({1, 2, 1}) == data.
at({1, 2, 1}));
704 BOOST_CHECK_THROW(constData.at({0, 3, 0}), std::out_of_range);
705 BOOST_CHECK_THROW(constData.at({0, 4, 0}), std::out_of_range);
706 BOOST_CHECK_THROW(constData.at({1, 3, 0}), std::out_of_range);
707 BOOST_CHECK_THROW(constData.at({1, 4, 0}), std::out_of_range);
708 BOOST_CHECK_THROW(constData.at({2, 0, 0}), std::out_of_range);
709 BOOST_CHECK_THROW(constData.at({2, 1, 0}), std::out_of_range);
710 BOOST_CHECK_THROW(constData.at({2, 2, 0}), std::out_of_range);
711 BOOST_CHECK_THROW(constData.at({2, 3, 0}), std::out_of_range);
712 BOOST_CHECK_THROW(constData.at({2, 4, 0}), std::out_of_range);
713 BOOST_CHECK_THROW(constData.at({0, 3, 1}), std::out_of_range);
714 BOOST_CHECK_THROW(constData.at({0, 4, 1}), std::out_of_range);
715 BOOST_CHECK_THROW(constData.at({1, 3, 1}), std::out_of_range);
716 BOOST_CHECK_THROW(constData.at({1, 4, 1}), std::out_of_range);
717 BOOST_CHECK_THROW(constData.at({2, 0, 1}), std::out_of_range);
718 BOOST_CHECK_THROW(constData.at({2, 1, 1}), std::out_of_range);
719 BOOST_CHECK_THROW(constData.at({2, 2, 1}), std::out_of_range);
720 BOOST_CHECK_THROW(constData.at({2, 3, 1}), std::out_of_range);
721 BOOST_CHECK_THROW(constData.at({2, 4, 1}), std::out_of_range);
722 BOOST_CHECK_THROW(constData.at({0, 0, 2}), std::out_of_range);
723 BOOST_CHECK_THROW(constData.at({0, 1, 2}), std::out_of_range);
724 BOOST_CHECK_THROW(constData.at({0, 2, 2}), std::out_of_range);
725 BOOST_CHECK_THROW(constData.at({0, 3, 2}), std::out_of_range);
726 BOOST_CHECK_THROW(constData.at({1, 0, 2}), std::out_of_range);
727 BOOST_CHECK_THROW(constData.at({1, 1, 2}), std::out_of_range);
728 BOOST_CHECK_THROW(constData.at({1, 2, 2}), std::out_of_range);
729 BOOST_CHECK_THROW(constData.at({1, 3, 2}), std::out_of_range);
730 BOOST_CHECK_THROW(constData.at({2, 0, 2}), std::out_of_range);
731 BOOST_CHECK_THROW(constData.at({2, 1, 2}), std::out_of_range);
732 BOOST_CHECK_THROW(constData.at({2, 2, 2}), std::out_of_range);
733 BOOST_CHECK_THROW(constData.at({2, 3, 2}), std::out_of_range);
736 auto const cb = constData.begin();
737 auto const ce = constData.end();
738 BOOST_TEST(static_cast<size_t>(ce - cb) ==
N);
742 for (
auto&
value: constData) {
743 static_assert(std::is_same_v
744 <decltype(
value), std::decay_t<decltype(constData)>::const_reference>
747 geo::PlaneID const expected_ID = constData.mapper().ID(expected_index);
748 BOOST_TEST(
value == constData[expected_ID]);
752 BOOST_TEST(constData.size() == expected_index);
756 for (
auto&& [ ID,
value ]: constData.items()) {
757 static_assert(std::is_same_v<decltype(ID),
geo::PlaneID>);
758 static_assert(std::is_same_v
759 <decltype(
value), std::decay_t<decltype(constData)>::const_reference>
762 geo::PlaneID const expected_ID = constData.mapper().ID(expected_index);
763 BOOST_TEST(ID == expected_ID);
764 BOOST_TEST(
value == constData[expected_ID]);
768 BOOST_TEST(constData.size() == expected_index);
772 for (
auto c: util::counter<unsigned int>(NCryostats))
773 for (
auto t: util::counter<unsigned int>(NTPCs))
774 for (
auto p: util::counter<unsigned int>(NPlanes))
775 BOOST_TEST((data[{ c, t,
p }]) == 14);
777 data.
apply([](
int& v){ v *= 2; });
778 for (
auto c: util::counter<unsigned int>(NCryostats))
779 for (
auto t: util::counter<unsigned int>(NTPCs))
780 for (
auto p: util::counter<unsigned int>(NPlanes))
781 BOOST_TEST((data[{ c, t,
p }]) == 28);
786 BOOST_TEST(summer.
get() ==
N * 28);
790 (std::is_same_v<decltype(constData.apply(summer)),
Summer<int>&>);
791 constData.apply(summer);
792 BOOST_TEST(summer.
get() ==
N * 28);
795 BOOST_TEST(summer1.get() ==
N * 28);
798 BOOST_TEST(summer2.get() ==
N * 28);
801 for (
auto c: util::counter<unsigned int>(NCryostats))
802 for (
auto t: util::counter<unsigned int>(NTPCs))
803 for (
auto p: util::counter<unsigned int>(NPlanes))
804 BOOST_TEST((data[{ c, t,
p }]) == 0);
807 BOOST_TEST(data.
empty());
void reset()
Sets all the elements to a default-constructed value_type.
GeoID firstID() const
Returns the ID of the first element with GeoID type.
reference at(ID_t const &id)
GeoID lastID() const
Returns the ID of the last covered element with GeoID type.
size_type capacity() const
Returns the number of elements the container has memory for.
The data type to uniquely identify a Plane.
reference last()
Returns the element for the last ID (unchecked).
IDparameter< geo::PlaneID > PlaneID
Member type of validated geo::PlaneID parameter.
reference first()
Returns the element for the first ID (unchecked).
void clear()
Makes the container empty, with no usable storage space.
static constexpr unsigned int dimensions()
Dimensions of the ID of this container.
void fill(value_type value)
Sets all elements to the specified value (copied).
process_name largeant stream1 can override from command line with o or output physics producers generator N
size_type size() const
Returns the number of elements in the container.
bool empty() const
Returns whether the container has no elements (false by assumptions).
unsigned int dimSize() const
Dimensions of the Level dimension of this container.
Op apply(Op &&op)
Applies an operation on all elements.