File indexing completed on 2025-01-18 09:12:56
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/Surfaces/CylinderBounds.hpp"
0013 #include "Acts/Surfaces/RadialBounds.hpp"
0014 #include "Acts/Surfaces/RectangleBounds.hpp"
0015 #include "Acts/Surfaces/TrapezoidBounds.hpp"
0016 #include "Acts/Utilities/BinAdjustment.hpp"
0017 #include "Acts/Utilities/BinUtility.hpp"
0018 #include "Acts/Utilities/BinningType.hpp"
0019
0020 #include <cmath>
0021 #include <memory>
0022 #include <numbers>
0023 #include <vector>
0024
0025 namespace Acts::Test {
0026
0027
0028 BOOST_AUTO_TEST_CASE(BinAdjustment_Radial) {
0029 RadialBounds bound(50, 75, std::numbers::pi, 0);
0030 BinUtility bu;
0031 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisR);
0032 bu += BinUtility(1, 0, 1, Acts::closed, Acts::AxisDirection::AxisPhi);
0033
0034 BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0035
0036 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, 50);
0037 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 75);
0038 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -std::numbers::pi_v<float>);
0039 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, std::numbers::pi_v<float>);
0040 }
0041
0042
0043 BOOST_AUTO_TEST_CASE(BinAdjustment_Cylinder) {
0044 CylinderBounds bound(25, 50, std::numbers::pi / 4, 0);
0045 BinUtility bu;
0046 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisPhi);
0047 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisZ);
0048
0049 BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0050
0051 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min,
0052 -static_cast<float>(std::numbers::pi / 4.));
0053 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max,
0054 static_cast<float>(std::numbers::pi / 4.));
0055 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -50);
0056 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, 50);
0057 }
0058
0059
0060 BOOST_AUTO_TEST_CASE(BinAdjustment_Rectangle) {
0061 RectangleBounds bound(20, 30);
0062 BinUtility bu;
0063 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisX);
0064 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisY);
0065
0066 BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0067
0068 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, -20);
0069 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 20);
0070 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -30);
0071 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, 30);
0072 }
0073
0074
0075 BOOST_AUTO_TEST_CASE(BinAdjustment_Trapezoid) {
0076 TrapezoidBounds bound(5, 15, 30);
0077 BinUtility bu;
0078 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisX);
0079 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisY);
0080
0081 BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0082
0083 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, -15);
0084 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 15);
0085 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -30);
0086 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, 30);
0087 }
0088
0089 }