File indexing completed on 2025-08-06 08:11:32
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 <vector>
0023
0024 namespace Acts::Test {
0025
0026
0027 BOOST_AUTO_TEST_CASE(BinAdjustment_Radial) {
0028 RadialBounds bound(50, 75, M_PI, 0);
0029 BinUtility bu;
0030 bu += BinUtility(1, 0, 1, Acts::open, Acts::binR);
0031 bu += BinUtility(1, 0, 1, Acts::closed, Acts::binPhi);
0032
0033 BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0034
0035 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, 50);
0036 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 75);
0037 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, float(-M_PI));
0038 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, float(M_PI));
0039 }
0040
0041
0042 BOOST_AUTO_TEST_CASE(BinAdjustment_Cylinder) {
0043 CylinderBounds bound(25, 50, M_PI / 4, 0);
0044 BinUtility bu;
0045 bu += BinUtility(1, 0, 1, Acts::open, Acts::binPhi);
0046 bu += BinUtility(1, 0, 1, Acts::open, Acts::binZ);
0047
0048 BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0049
0050 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, float(-M_PI / 4));
0051 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, float(M_PI / 4));
0052 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -50);
0053 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, 50);
0054 }
0055
0056
0057 BOOST_AUTO_TEST_CASE(BinAdjustment_Rectangle) {
0058 RectangleBounds bound(20, 30);
0059 BinUtility bu;
0060 bu += BinUtility(1, 0, 1, Acts::open, Acts::binX);
0061 bu += BinUtility(1, 0, 1, Acts::open, Acts::binY);
0062
0063 BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0064
0065 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, -20);
0066 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 20);
0067 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -30);
0068 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, 30);
0069 }
0070
0071
0072 BOOST_AUTO_TEST_CASE(BinAdjustment_Trapezoid) {
0073 TrapezoidBounds bound(5, 15, 30);
0074 BinUtility bu;
0075 bu += BinUtility(1, 0, 1, Acts::open, Acts::binX);
0076 bu += BinUtility(1, 0, 1, Acts::open, Acts::binY);
0077
0078 BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0079
0080 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, -15);
0081 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 15);
0082 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -30);
0083 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, 30);
0084 }
0085
0086 }