File indexing completed on 2025-01-18 09:12:41
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/GeometryContext.hpp"
0013 #include "Acts/Geometry/SurfaceBinningMatcher.hpp"
0014 #include "Acts/Surfaces/DiscSurface.hpp"
0015 #include "Acts/Surfaces/RadialBounds.hpp"
0016 #include "Acts/Surfaces/Surface.hpp"
0017 #include "Acts/Utilities/BinningType.hpp"
0018
0019 #include <cmath>
0020 #include <memory>
0021 #include <numbers>
0022 #include <vector>
0023
0024 #include <boost/format.hpp>
0025
0026 namespace Acts::Test {
0027
0028
0029 GeometryContext tgContext = GeometryContext();
0030
0031 BOOST_AUTO_TEST_CASE(PlaneSurfaceMatcher) {
0032 auto identity = Transform3::Identity();
0033
0034 double rMin = 5.;
0035 double rMax = 10.;
0036 double rMinTol = 0.1;
0037 double rMaxTol = 0.5;
0038
0039 double phiTol = 0.1;
0040
0041 auto oneBounds =
0042 std::make_shared<RadialBounds>(rMin, rMax, std::numbers::pi / 16., 0.);
0043 auto oneSurface = Surface::makeShared<DiscSurface>(identity, oneBounds);
0044
0045 auto otherBounds = std::make_shared<RadialBounds>(
0046 2 * rMax, 4 * rMax, std::numbers::pi / 16., std::numbers::pi / 2.);
0047 auto otherSurface = Surface::makeShared<DiscSurface>(identity, otherBounds);
0048
0049 auto similarRbounds = std::make_shared<RadialBounds>(
0050 rMin - 0.5 * rMinTol, rMax + 0.5 * rMaxTol, std::numbers::pi / 1.,
0051 std::numbers::pi / 2.);
0052 auto similarRSurface =
0053 Surface::makeShared<DiscSurface>(identity, similarRbounds);
0054
0055 auto similarPhiBounds = std::make_shared<RadialBounds>(
0056 0.25 * rMin, 0.5 * rMin, std::numbers::pi / 16., 0.);
0057 auto similarPhiSurface =
0058 Surface::makeShared<DiscSurface>(identity, similarPhiBounds);
0059
0060 SurfaceBinningMatcher sbm;
0061 sbm.tolerances[toUnderlying(AxisDirection::AxisR)] = {rMinTol, rMaxTol};
0062 sbm.tolerances[toUnderlying(AxisDirection::AxisPhi)] = {phiTol, phiTol};
0063
0064
0065 for (AxisDirection ib : allAxisDirections()) {
0066 BOOST_CHECK(sbm(tgContext, ib, oneSurface.get(), oneSurface.get()));
0067 }
0068
0069 BOOST_CHECK(!sbm(tgContext, AxisDirection::AxisR, oneSurface.get(),
0070 otherSurface.get()));
0071
0072 BOOST_CHECK(!sbm(tgContext, AxisDirection::AxisPhi, oneSurface.get(),
0073 otherSurface.get()));
0074
0075
0076 BOOST_CHECK(sbm(tgContext, AxisDirection::AxisR, oneSurface.get(),
0077 similarRSurface.get()));
0078
0079 BOOST_CHECK(sbm(tgContext, AxisDirection::AxisPhi, oneSurface.get(),
0080 similarPhiSurface.get()));
0081 }
0082
0083 }