292 std::size_t
const N = NCryostats * NTPCsets * NROPs;
294 BOOST_TEST(!data.
empty());
295 BOOST_TEST(data.
size() ==
N);
298 for (
auto c: util::counter<unsigned int>(NCryostats))
299 for (
auto s: util::counter<unsigned short int>(NTPCsets))
300 for (
auto r: util::counter<unsigned int>(NROPs))
301 BOOST_TEST((data[{ c,
s,
r }]) == 0);
307 std::size_t expected_index = 0U;
310 for (
auto&
value: data) {
311 static_assert(std::is_same_v<decltype(
value), decltype(data)::reference>);
313 readout::ROPID const expected_ID = data.mapper().ID(expected_index);
314 BOOST_TEST(
value == data[expected_ID]);
318 BOOST_TEST(data.size() == expected_index);
322 for (
auto&& [ ID,
value ]: data.items()) {
324 static_assert(std::is_same_v<decltype(
value), decltype(data)::reference>);
326 readout::ROPID const expected_ID = data.mapper().ID(expected_index);
327 BOOST_TEST(ID == expected_ID);
328 BOOST_TEST(
value == data[expected_ID]);
332 BOOST_TEST(data.size() == expected_index);
335 BOOST_TEST( data.hasROP({ 0, 0, 0}));
336 BOOST_TEST( data.hasROP({ 0, 0, 1}));
337 BOOST_TEST(!data.hasROP({ 0, 0, 2}));
338 BOOST_TEST( data.hasROP({ 0, 1, 0}));
339 BOOST_TEST( data.hasROP({ 0, 1, 1}));
340 BOOST_TEST(!data.hasROP({ 0, 1, 2}));
341 BOOST_TEST( data.hasROP({ 0, 2, 0}));
342 BOOST_TEST( data.hasROP({ 0, 2, 1}));
343 BOOST_TEST(!data.hasROP({ 0, 2, 2}));
344 BOOST_TEST(!data.hasROP({ 0, 3, 0}));
345 BOOST_TEST(!data.hasROP({ 0, 3, 1}));
346 BOOST_TEST(!data.hasROP({ 0, 3, 2}));
347 BOOST_TEST(!data.hasROP({ 0, 4, 0}));
348 BOOST_TEST(!data.hasROP({ 0, 4, 1}));
349 BOOST_TEST(!data.hasROP({ 0, 4, 2}));
350 BOOST_TEST( data.hasROP({ 1, 0, 0}));
351 BOOST_TEST( data.hasROP({ 1, 0, 1}));
352 BOOST_TEST(!data.hasROP({ 1, 0, 2}));
353 BOOST_TEST( data.hasROP({ 1, 1, 0}));
354 BOOST_TEST( data.hasROP({ 1, 1, 1}));
355 BOOST_TEST(!data.hasROP({ 1, 1, 2}));
356 BOOST_TEST( data.hasROP({ 1, 2, 0}));
357 BOOST_TEST( data.hasROP({ 1, 2, 1}));
358 BOOST_TEST(!data.hasROP({ 1, 2, 2}));
359 BOOST_TEST(!data.hasROP({ 1, 3, 0}));
360 BOOST_TEST(!data.hasROP({ 1, 3, 1}));
361 BOOST_TEST(!data.hasROP({ 1, 3, 2}));
362 BOOST_TEST(!data.hasROP({ 1, 4, 0}));
363 BOOST_TEST(!data.hasROP({ 1, 4, 1}));
364 BOOST_TEST(!data.hasROP({ 1, 4, 2}));
365 BOOST_TEST(!data.hasROP({ 2, 0, 0}));
366 BOOST_TEST(!data.hasROP({ 2, 0, 1}));
367 BOOST_TEST(!data.hasROP({ 2, 0, 2}));
368 BOOST_TEST(!data.hasROP({ 2, 1, 0}));
369 BOOST_TEST(!data.hasROP({ 2, 1, 1}));
370 BOOST_TEST(!data.hasROP({ 2, 1, 2}));
371 BOOST_TEST(!data.hasROP({ 2, 2, 0}));
372 BOOST_TEST(!data.hasROP({ 2, 2, 1}));
373 BOOST_TEST(!data.hasROP({ 2, 2, 2}));
374 BOOST_TEST(!data.hasROP({ 2, 3, 0}));
375 BOOST_TEST(!data.hasROP({ 2, 3, 1}));
376 BOOST_TEST(!data.hasROP({ 2, 3, 2}));
377 BOOST_TEST(!data.hasROP({ 2, 4, 0}));
378 BOOST_TEST(!data.hasROP({ 2, 4, 1}));
379 BOOST_TEST(!data.hasROP({ 2, 4, 2}));
475 BOOST_TEST( (data[{0, 0, 0}]) == 4);
476 BOOST_TEST(data.
at({0, 0, 0}) == 4);
478 BOOST_TEST( (data[{0, 0, 0}]) == 5);
479 BOOST_TEST(data.
at({0, 0, 0}) == 5);
482 BOOST_TEST( (data[{0, 0, 1}]) == 6);
483 BOOST_TEST(data.
at({0, 0, 1}) == 6);
485 BOOST_TEST( (data[{0, 0, 0}]) == 5);
487 data[{0, 1, 0}] = 15;
488 BOOST_TEST( (data[{0, 1, 0}]) == 15);
489 BOOST_TEST(data.
at({0, 1, 0}) == 15);
491 BOOST_TEST( (data[{0, 0, 0}]) == 5);
492 BOOST_TEST( (data[{0, 0, 1}]) == 6);
494 data[{0, 1, 1}] = 16;
495 BOOST_TEST( (data[{0, 1, 1}]) == 16);
496 BOOST_TEST(data.
at({0, 1, 1}) == 16);
498 BOOST_TEST( (data[{0, 0, 0}]) == 5);
499 BOOST_TEST( (data[{0, 0, 1}]) == 6);
500 BOOST_TEST( (data[{0, 1, 0}]) == 15);
502 data[{0, 2, 0}] = 25;
503 BOOST_TEST( (data[{0, 2, 0}]) == 25);
504 BOOST_TEST(data.
at({0, 2, 0}) == 25);
506 BOOST_TEST( (data[{0, 0, 0}]) == 5);
507 BOOST_TEST( (data[{0, 0, 1}]) == 6);
508 BOOST_TEST( (data[{0, 1, 0}]) == 15);
509 BOOST_TEST( (data[{0, 1, 1}]) == 16);
511 data[{0, 2, 1}] = 26;
512 BOOST_TEST( (data[{0, 2, 1}]) == 26);
513 BOOST_TEST(data.
at({0, 2, 1}) == 26);
515 BOOST_TEST( (data[{0, 0, 0}]) == 5);
516 BOOST_TEST( (data[{0, 0, 1}]) == 6);
517 BOOST_TEST( (data[{0, 1, 0}]) == 15);
518 BOOST_TEST( (data[{0, 1, 1}]) == 16);
519 BOOST_TEST( (data[{0, 2, 0}]) == 25);
521 data[{1, 0, 0}] = 105;
522 BOOST_TEST( (data[{1, 0, 0}]) == 105);
523 BOOST_TEST(data.
at({1, 0, 0}) == 105);
525 BOOST_TEST( (data[{0, 0, 0}]) == 5);
526 BOOST_TEST( (data[{0, 0, 1}]) == 6);
527 BOOST_TEST( (data[{0, 1, 0}]) == 15);
528 BOOST_TEST( (data[{0, 1, 1}]) == 16);
529 BOOST_TEST( (data[{0, 2, 0}]) == 25);
530 BOOST_TEST( (data[{0, 2, 1}]) == 26);
532 data[{1, 0, 1}] = 106;
533 BOOST_TEST( (data[{1, 0, 1}]) == 106);
534 BOOST_TEST(data.
at({1, 0, 1}) == 106);
536 BOOST_TEST( (data[{0, 0, 0}]) == 5);
537 BOOST_TEST( (data[{0, 0, 1}]) == 6);
538 BOOST_TEST( (data[{0, 1, 0}]) == 15);
539 BOOST_TEST( (data[{0, 1, 1}]) == 16);
540 BOOST_TEST( (data[{0, 2, 0}]) == 25);
541 BOOST_TEST( (data[{0, 2, 1}]) == 26);
542 BOOST_TEST( (data[{1, 0, 0}]) == 105);
544 data[{1, 1, 0}] = 115;
545 BOOST_TEST( (data[{1, 1, 0}]) == 115);
546 BOOST_TEST(data.
at({1, 1, 0}) == 115);
548 BOOST_TEST( (data[{0, 0, 0}]) == 5);
549 BOOST_TEST( (data[{0, 0, 1}]) == 6);
550 BOOST_TEST( (data[{0, 1, 0}]) == 15);
551 BOOST_TEST( (data[{0, 1, 1}]) == 16);
552 BOOST_TEST( (data[{0, 2, 0}]) == 25);
553 BOOST_TEST( (data[{0, 2, 1}]) == 26);
554 BOOST_TEST( (data[{1, 0, 0}]) == 105);
555 BOOST_TEST( (data[{1, 0, 1}]) == 106);
557 data[{1, 1, 1}] = 116;
558 BOOST_TEST( (data[{1, 1, 1}]) == 116);
559 BOOST_TEST(data.
at({1, 1, 1}) == 116);
561 BOOST_TEST( (data[{0, 0, 0}]) == 5);
562 BOOST_TEST( (data[{0, 0, 1}]) == 6);
563 BOOST_TEST( (data[{0, 1, 0}]) == 15);
564 BOOST_TEST( (data[{0, 1, 1}]) == 16);
565 BOOST_TEST( (data[{0, 2, 0}]) == 25);
566 BOOST_TEST( (data[{0, 2, 1}]) == 26);
567 BOOST_TEST( (data[{1, 0, 0}]) == 105);
568 BOOST_TEST( (data[{1, 0, 1}]) == 106);
569 BOOST_TEST( (data[{1, 1, 0}]) == 115);
571 data[{1, 2, 0}] = 125;
572 BOOST_TEST( (data[{1, 2, 0}]) == 125);
573 BOOST_TEST(data.
at({1, 2, 0}) == 125);
575 BOOST_TEST( (data[{0, 0, 0}]) == 5);
576 BOOST_TEST( (data[{0, 0, 1}]) == 6);
577 BOOST_TEST( (data[{0, 1, 0}]) == 15);
578 BOOST_TEST( (data[{0, 1, 1}]) == 16);
579 BOOST_TEST( (data[{0, 2, 0}]) == 25);
580 BOOST_TEST( (data[{0, 2, 1}]) == 26);
581 BOOST_TEST( (data[{1, 0, 0}]) == 105);
582 BOOST_TEST( (data[{1, 0, 1}]) == 106);
583 BOOST_TEST( (data[{1, 1, 0}]) == 115);
584 BOOST_TEST( (data[{1, 1, 1}]) == 116);
586 data[{1, 2, 1}] = 126;
587 BOOST_TEST( (data[{1, 2, 1}]) == 126);
588 BOOST_TEST(data.
at({1, 2, 1}) == 126);
590 BOOST_TEST( (data[{0, 0, 0}]) == 5);
591 BOOST_TEST( (data[{0, 0, 1}]) == 6);
592 BOOST_TEST( (data[{0, 1, 0}]) == 15);
593 BOOST_TEST( (data[{0, 1, 1}]) == 16);
594 BOOST_TEST( (data[{0, 2, 0}]) == 25);
595 BOOST_TEST( (data[{0, 2, 1}]) == 26);
596 BOOST_TEST( (data[{1, 0, 0}]) == 105);
597 BOOST_TEST( (data[{1, 0, 1}]) == 106);
598 BOOST_TEST( (data[{1, 1, 0}]) == 115);
599 BOOST_TEST( (data[{1, 1, 1}]) == 116);
600 BOOST_TEST( (data[{1, 2, 0}]) == 125);
603 BOOST_CHECK_THROW(data.
at({0, 3, 0}), std::out_of_range);
604 BOOST_CHECK_THROW(data.
at({0, 4, 0}), std::out_of_range);
605 BOOST_CHECK_THROW(data.
at({1, 3, 0}), std::out_of_range);
606 BOOST_CHECK_THROW(data.
at({1, 4, 0}), std::out_of_range);
607 BOOST_CHECK_THROW(data.
at({2, 0, 0}), std::out_of_range);
608 BOOST_CHECK_THROW(data.
at({2, 1, 0}), std::out_of_range);
609 BOOST_CHECK_THROW(data.
at({2, 2, 0}), std::out_of_range);
610 BOOST_CHECK_THROW(data.
at({2, 3, 0}), std::out_of_range);
611 BOOST_CHECK_THROW(data.
at({2, 4, 0}), std::out_of_range);
612 BOOST_CHECK_THROW(data.
at({0, 3, 1}), std::out_of_range);
613 BOOST_CHECK_THROW(data.
at({0, 4, 1}), std::out_of_range);
614 BOOST_CHECK_THROW(data.
at({1, 3, 1}), std::out_of_range);
615 BOOST_CHECK_THROW(data.
at({1, 4, 1}), std::out_of_range);
616 BOOST_CHECK_THROW(data.
at({2, 0, 1}), std::out_of_range);
617 BOOST_CHECK_THROW(data.
at({2, 1, 1}), std::out_of_range);
618 BOOST_CHECK_THROW(data.
at({2, 2, 1}), std::out_of_range);
619 BOOST_CHECK_THROW(data.
at({2, 3, 1}), std::out_of_range);
620 BOOST_CHECK_THROW(data.
at({2, 4, 1}), std::out_of_range);
621 BOOST_CHECK_THROW(data.
at({0, 0, 2}), std::out_of_range);
622 BOOST_CHECK_THROW(data.
at({0, 1, 2}), std::out_of_range);
623 BOOST_CHECK_THROW(data.
at({0, 2, 2}), std::out_of_range);
624 BOOST_CHECK_THROW(data.
at({0, 3, 2}), std::out_of_range);
625 BOOST_CHECK_THROW(data.
at({1, 0, 2}), std::out_of_range);
626 BOOST_CHECK_THROW(data.
at({1, 1, 2}), std::out_of_range);
627 BOOST_CHECK_THROW(data.
at({1, 2, 2}), std::out_of_range);
628 BOOST_CHECK_THROW(data.
at({1, 3, 2}), std::out_of_range);
629 BOOST_CHECK_THROW(data.
at({2, 0, 2}), std::out_of_range);
630 BOOST_CHECK_THROW(data.
at({2, 1, 2}), std::out_of_range);
631 BOOST_CHECK_THROW(data.
at({2, 2, 2}), std::out_of_range);
632 BOOST_CHECK_THROW(data.
at({2, 3, 2}), std::out_of_range);
634 BOOST_TEST(data.
first() == 5);
636 BOOST_TEST((data[{0, 0, 0}]) == -5);
637 BOOST_TEST(data.
first() == -5);
640 BOOST_TEST(data.
last() == 126);
642 BOOST_TEST((data[{1U, 2U, 1U}]) == -126);
643 BOOST_TEST(data.
last() == -126);
646 auto const& constData = data;
649 (std::addressof(constData.first()) == std::addressof(data.
first()));
651 (std::addressof(constData.last()) == std::addressof(data.
last()));
653 BOOST_TEST((constData[{0, 0, 0}]) == (data[{0, 0, 0}]));
654 BOOST_TEST((constData[{0, 0, 1}]) == (data[{0, 0, 1}]));
655 BOOST_TEST((constData[{0, 1, 0}]) == (data[{0, 1, 0}]));
656 BOOST_TEST((constData[{0, 1, 1}]) == (data[{0, 1, 1}]));
657 BOOST_TEST((constData[{0, 2, 0}]) == (data[{0, 2, 0}]));
658 BOOST_TEST((constData[{0, 2, 1}]) == (data[{0, 2, 1}]));
659 BOOST_TEST((constData[{1, 0, 0}]) == (data[{1, 0, 0}]));
660 BOOST_TEST((constData[{1, 0, 1}]) == (data[{1, 0, 1}]));
661 BOOST_TEST((constData[{1, 1, 0}]) == (data[{1, 1, 0}]));
662 BOOST_TEST((constData[{1, 1, 1}]) == (data[{1, 1, 1}]));
663 BOOST_TEST((constData[{1, 2, 0}]) == (data[{1, 2, 0}]));
664 BOOST_TEST((constData[{1, 2, 1}]) == (data[{1, 2, 1}]));
665 BOOST_TEST(constData.at({0, 0, 0}) == data.
at({0, 0, 0}));
666 BOOST_TEST(constData.at({0, 0, 1}) == data.
at({0, 0, 1}));
667 BOOST_TEST(constData.at({0, 1, 0}) == data.
at({0, 1, 0}));
668 BOOST_TEST(constData.at({0, 1, 1}) == data.
at({0, 1, 1}));
669 BOOST_TEST(constData.at({0, 2, 0}) == data.
at({0, 2, 0}));
670 BOOST_TEST(constData.at({0, 2, 1}) == data.
at({0, 2, 1}));
671 BOOST_TEST(constData.at({1, 0, 0}) == data.
at({1, 0, 0}));
672 BOOST_TEST(constData.at({1, 0, 1}) == data.
at({1, 0, 1}));
673 BOOST_TEST(constData.at({1, 1, 0}) == data.
at({1, 1, 0}));
674 BOOST_TEST(constData.at({1, 1, 1}) == data.
at({1, 1, 1}));
675 BOOST_TEST(constData.at({1, 2, 0}) == data.
at({1, 2, 0}));
676 BOOST_TEST(constData.at({1, 2, 1}) == data.
at({1, 2, 1}));
678 BOOST_CHECK_THROW(constData.at({0, 3, 0}), std::out_of_range);
679 BOOST_CHECK_THROW(constData.at({0, 4, 0}), std::out_of_range);
680 BOOST_CHECK_THROW(constData.at({1, 3, 0}), std::out_of_range);
681 BOOST_CHECK_THROW(constData.at({1, 4, 0}), std::out_of_range);
682 BOOST_CHECK_THROW(constData.at({2, 0, 0}), std::out_of_range);
683 BOOST_CHECK_THROW(constData.at({2, 1, 0}), std::out_of_range);
684 BOOST_CHECK_THROW(constData.at({2, 2, 0}), std::out_of_range);
685 BOOST_CHECK_THROW(constData.at({2, 3, 0}), std::out_of_range);
686 BOOST_CHECK_THROW(constData.at({2, 4, 0}), std::out_of_range);
687 BOOST_CHECK_THROW(constData.at({0, 3, 1}), std::out_of_range);
688 BOOST_CHECK_THROW(constData.at({0, 4, 1}), std::out_of_range);
689 BOOST_CHECK_THROW(constData.at({1, 3, 1}), std::out_of_range);
690 BOOST_CHECK_THROW(constData.at({1, 4, 1}), std::out_of_range);
691 BOOST_CHECK_THROW(constData.at({2, 0, 1}), std::out_of_range);
692 BOOST_CHECK_THROW(constData.at({2, 1, 1}), std::out_of_range);
693 BOOST_CHECK_THROW(constData.at({2, 2, 1}), std::out_of_range);
694 BOOST_CHECK_THROW(constData.at({2, 3, 1}), std::out_of_range);
695 BOOST_CHECK_THROW(constData.at({2, 4, 1}), std::out_of_range);
696 BOOST_CHECK_THROW(constData.at({0, 0, 2}), std::out_of_range);
697 BOOST_CHECK_THROW(constData.at({0, 1, 2}), std::out_of_range);
698 BOOST_CHECK_THROW(constData.at({0, 2, 2}), std::out_of_range);
699 BOOST_CHECK_THROW(constData.at({0, 3, 2}), std::out_of_range);
700 BOOST_CHECK_THROW(constData.at({1, 0, 2}), std::out_of_range);
701 BOOST_CHECK_THROW(constData.at({1, 1, 2}), std::out_of_range);
702 BOOST_CHECK_THROW(constData.at({1, 2, 2}), std::out_of_range);
703 BOOST_CHECK_THROW(constData.at({1, 3, 2}), std::out_of_range);
704 BOOST_CHECK_THROW(constData.at({2, 0, 2}), std::out_of_range);
705 BOOST_CHECK_THROW(constData.at({2, 1, 2}), std::out_of_range);
706 BOOST_CHECK_THROW(constData.at({2, 2, 2}), std::out_of_range);
707 BOOST_CHECK_THROW(constData.at({2, 3, 2}), std::out_of_range);
710 auto const cb = constData.begin();
711 auto const ce = constData.end();
712 BOOST_TEST(static_cast<size_t>(ce - cb) ==
N);
716 for (
auto&
value: constData) {
717 static_assert(std::is_same_v
718 <decltype(
value), std::decay_t<decltype(constData)>::const_reference>
721 readout::ROPID const expected_ID = constData.mapper().ID(expected_index);
722 BOOST_TEST(
value == constData[expected_ID]);
726 BOOST_TEST(constData.size() == expected_index);
730 for (
auto&& [ ID,
value ]: constData.items()) {
732 static_assert(std::is_same_v
733 <decltype(
value), std::decay_t<decltype(constData)>::const_reference>
736 readout::ROPID const expected_ID = constData.mapper().ID(expected_index);
737 BOOST_TEST(ID == expected_ID);
738 BOOST_TEST(
value == constData[expected_ID]);
742 BOOST_TEST(constData.size() == expected_index);
746 for (
auto c: util::counter<unsigned int>(NCryostats))
747 for (
auto s: util::counter<unsigned short int>(NTPCsets))
748 for (
auto r: util::counter<unsigned int>(NROPs))
749 BOOST_TEST((data[{ c,
s,
r }]) == 14);
751 data.
apply([](
int& v){ v *= 2; });
752 for (
auto c: util::counter<unsigned int>(NCryostats))
753 for (
auto s: util::counter<unsigned short int>(NTPCsets))
754 for (
auto r: util::counter<unsigned int>(NROPs))
755 BOOST_TEST((data[{ c,
s,
r }]) == 28);
760 BOOST_TEST(summer.
get() ==
N * 28);
764 (std::is_same_v<decltype(constData.apply(summer)),
Summer<int>&>);
765 constData.apply(summer);
766 BOOST_TEST(summer.
get() ==
N * 28);
769 BOOST_TEST(summer1.get() ==
N * 28);
772 BOOST_TEST(summer2.get() ==
N * 28);
775 for (
auto c: util::counter<unsigned int>(NCryostats))
776 for (
auto s: util::counter<unsigned short int>(NTPCsets))
777 for (
auto r: util::counter<unsigned int>(NROPs))
778 BOOST_TEST((data[{ c,
s,
r }]) == 0);
781 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.
IDparameter< readout::ROPID > ROPID
Member type of validated readout::ROPID parameter.
size_type capacity() const
Returns the number of elements the container has memory for.
reference last()
Returns the element for the last ID (unchecked).
Class identifying a set of planes sharing readout channels.
reference first()
Returns the element for the first ID (unchecked).
void clear()
Makes the container empty, with no usable storage space.
void fill(value_type value)
Sets all elements to the specified value (copied).
then echo File list $list not found else cat $list while read file do echo $file sed s
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).
Op apply(Op &&op)
Applies an operation on all elements.