Warning, file /acts/Tests/UnitTests/Fatras/Digitization/ChannelMergerTests.cpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Tolerance.hpp"
0013 #include "ActsFatras/Digitization/ChannelMerger.hpp"
0014 #include "ActsFatras/Digitization/DigitizationData.hpp"
0015 #include "ActsTests/CommonHelpers/FloatComparisons.hpp"
0016
0017 #include <array>
0018 #include <map>
0019 #include <unordered_set>
0020 #include <utility>
0021 #include <vector>
0022
0023 using namespace Acts;
0024 using namespace ActsFatras;
0025
0026 namespace ActsTests {
0027
0028 BOOST_AUTO_TEST_SUITE(Digitization)
0029
0030 BOOST_AUTO_TEST_CASE(ChannelMerger1D) {
0031
0032 Cell cell0(5, 10.5);
0033 Cell cell1(6, 11.5);
0034 Cell cell2(7, 12.5);
0035
0036 using Channel1D = Channel<double, 1>;
0037
0038
0039 std::vector<Channel1D> channels = {{{cell0}, 1., {5}},
0040 {{cell1}, 1., {5}},
0041 {{cell2}, 1., {5}},
0042 {{cell0}, 0.5, {6}}};
0043
0044 BOOST_CHECK_EQUAL(channels.size(), 4u);
0045 auto mergedChannels = mergeChannels(channels);
0046 BOOST_CHECK_EQUAL(mergedChannels.size(), 3u);
0047
0048 std::unordered_set<unsigned int> mergedLinks = {5, 6};
0049
0050 for (const auto& ch : mergedChannels) {
0051 if (ch.cellId[0].first == 5) {
0052
0053 CHECK_CLOSE_ABS(ch.value, 1.5, s_epsilon);
0054
0055 BOOST_CHECK_EQUAL(ch.links.size(), 2u);
0056 BOOST_CHECK(ch.links == mergedLinks);
0057 }
0058 }
0059 }
0060
0061 BOOST_AUTO_TEST_CASE(ChannelMerger2D) {
0062
0063 Cell cell00(5, 10.5);
0064 Cell cell01(6, 11.5);
0065 Cell cell02(7, 12.5);
0066
0067
0068 Cell cell10(10, 0.5);
0069 Cell cell11(10, 0.5);
0070 Cell cell12(11, 1.5);
0071
0072 using Channel2D = Channel<double, 2>;
0073
0074 std::vector<Channel2D> channels = {{{cell00, cell10}, 1., {5}},
0075 {{cell01, cell11}, 1., {5}},
0076 {{cell02, cell12}, 1., {5}},
0077 {{cell01, cell11}, 0.5, {6}}};
0078
0079 BOOST_CHECK_EQUAL(channels.size(), 4u);
0080 auto mergedChannels = mergeChannels(channels);
0081 BOOST_CHECK_EQUAL(mergedChannels.size(), 3u);
0082
0083 std::unordered_set<unsigned int> mergedLinks = {5, 6};
0084
0085 for (const auto& ch : mergedChannels) {
0086 if (ch.cellId[0].first == 6) {
0087
0088 CHECK_CLOSE_ABS(ch.value, 1.5, s_epsilon);
0089
0090 BOOST_CHECK_EQUAL(ch.links.size(), 2u);
0091 BOOST_CHECK(ch.links == mergedLinks);
0092 }
0093 }
0094 }
0095
0096 BOOST_AUTO_TEST_SUITE_END()
0097
0098 }