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/Geometry/CuboidVolumeBounds.hpp"
0013 #include "Acts/Geometry/CutoutCylinderVolumeBounds.hpp"
0014 #include "Acts/Geometry/CylinderVolumeBounds.hpp"
0015 #include "Acts/Utilities/BinAdjustmentVolume.hpp"
0016 #include "Acts/Utilities/BinUtility.hpp"
0017 #include "Acts/Utilities/BinningType.hpp"
0018
0019 #include <cmath>
0020 #include <memory>
0021 #include <numbers>
0022 #include <vector>
0023
0024 namespace Acts::Test {
0025
0026
0027 BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_Cylinder) {
0028 CylinderVolumeBounds bound(10, 50, 150, std::numbers::pi / 2., 0);
0029 BinUtility bu;
0030 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisR);
0031 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisPhi);
0032 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisZ);
0033
0034 BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0035
0036 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, 10);
0037 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 50);
0038 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min,
0039 -static_cast<float>(std::numbers::pi / 2.));
0040 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max,
0041 static_cast<float>(std::numbers::pi / 2.));
0042 BOOST_CHECK_EQUAL(buAdjust.binningData()[2].min, -150);
0043 BOOST_CHECK_EQUAL(buAdjust.binningData()[2].max, 150);
0044 }
0045
0046
0047 BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_CutoutCylinder) {
0048 CutoutCylinderVolumeBounds bound(10, 20, 50, 100, 15);
0049 BinUtility bu;
0050 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisR);
0051 bu += BinUtility(1, 0, 1, Acts::closed, Acts::AxisDirection::AxisPhi);
0052 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisZ);
0053
0054 BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0055
0056 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, 10);
0057 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 50);
0058 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -std::numbers::pi_v<float>);
0059 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, std::numbers::pi_v<float>);
0060 BOOST_CHECK_EQUAL(buAdjust.binningData()[2].min, -100);
0061 BOOST_CHECK_EQUAL(buAdjust.binningData()[2].max, 100);
0062 }
0063
0064
0065 BOOST_AUTO_TEST_CASE(BinAdjustmentVolume_Cuboid) {
0066 CuboidVolumeBounds bound(13, 23, 42);
0067 BinUtility bu;
0068 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisX);
0069 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisY);
0070 bu += BinUtility(1, 0, 1, Acts::open, Acts::AxisDirection::AxisZ);
0071
0072 BinUtility buAdjust = adjustBinUtility(bu, bound, Transform3::Identity());
0073
0074 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].min, -13);
0075 BOOST_CHECK_EQUAL(buAdjust.binningData()[0].max, 13);
0076 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].min, -23);
0077 BOOST_CHECK_EQUAL(buAdjust.binningData()[1].max, 23);
0078 BOOST_CHECK_EQUAL(buAdjust.binningData()[2].min, -42);
0079 BOOST_CHECK_EQUAL(buAdjust.binningData()[2].max, 42);
0080 }
0081
0082 }