File indexing completed on 2025-08-06 08:11:22
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/data/test_case.hpp>
0010 #include <boost/test/unit_test.hpp>
0011
0012 #include "Acts/Definitions/Algebra.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Geometry/SurfaceBinningMatcher.hpp"
0015 #include "Acts/Surfaces/DiscSurface.hpp"
0016 #include "Acts/Surfaces/RadialBounds.hpp"
0017 #include "Acts/Surfaces/Surface.hpp"
0018 #include "Acts/Utilities/BinningType.hpp"
0019
0020 #include <cmath>
0021 #include <memory>
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 = std::make_shared<RadialBounds>(rMin, rMax, M_PI / 16, 0.);
0042 auto oneSurface = Surface::makeShared<DiscSurface>(identity, oneBounds);
0043
0044 auto otherBounds =
0045 std::make_shared<RadialBounds>(2 * rMax, 4 * rMax, M_PI / 16, 0.5 * M_PI);
0046 auto otherSurface = Surface::makeShared<DiscSurface>(identity, otherBounds);
0047
0048 auto similarRbounds = std::make_shared<RadialBounds>(
0049 rMin - 0.5 * rMinTol, rMax + 0.5 * rMaxTol, M_PI / 16, 0.5 * M_PI);
0050 auto similarRSurface =
0051 Surface::makeShared<DiscSurface>(identity, similarRbounds);
0052
0053 auto similarPhiBounds =
0054 std::make_shared<RadialBounds>(0.25 * rMin, 0.5 * rMin, M_PI / 16, 0.);
0055 auto similarPhiSurface =
0056 Surface::makeShared<DiscSurface>(identity, similarPhiBounds);
0057
0058 SurfaceBinningMatcher sbm;
0059 sbm.tolerances[binR] = {rMinTol, rMaxTol};
0060 sbm.tolerances[binPhi] = {phiTol, phiTol};
0061
0062
0063 for (int ib = 0; ib < binValues; ++ib) {
0064 BOOST_CHECK(
0065 sbm(tgContext, (BinningValue)ib, oneSurface.get(), oneSurface.get()));
0066 }
0067
0068 BOOST_CHECK(!sbm(tgContext, binR, oneSurface.get(), otherSurface.get()));
0069
0070 BOOST_CHECK(!sbm(tgContext, binPhi, oneSurface.get(), otherSurface.get()));
0071
0072
0073 BOOST_CHECK(sbm(tgContext, binR, oneSurface.get(), similarRSurface.get()));
0074
0075 BOOST_CHECK(
0076 sbm(tgContext, binPhi, oneSurface.get(), similarPhiSurface.get()));
0077 }
0078
0079 }