File indexing completed on 2026-05-01 07:32:37
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Geometry/Extent.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/Surfaces/Surface.hpp"
0014
0015 #include <utility>
0016 #include <vector>
0017
0018 namespace Acts {
0019
0020
0021 struct SurfaceBinningMatcher {
0022
0023 using Range = std::pair<double, double>;
0024
0025 std::vector<Range> tolerances{static_cast<int>(numAxisDirections()),
0026 {0., 0.}};
0027
0028 SurfaceBinningMatcher() = default;
0029
0030
0031
0032 explicit SurfaceBinningMatcher(const std::vector<Range>& tolpars)
0033 : tolerances(tolpars) {}
0034
0035
0036
0037
0038
0039
0040
0041
0042 bool operator()(const Acts::GeometryContext& gctx, Acts::AxisDirection aDir,
0043 const Acts::Surface* one, const Acts::Surface* other) const {
0044
0045 if (one == other) {
0046 return true;
0047 }
0048
0049 auto oneExt = one->polyhedronRepresentation(gctx, 1).extent();
0050 auto otherExt = other->polyhedronRepresentation(gctx, 1).extent();
0051
0052 double oneMin = oneExt.min(aDir);
0053 double oneMax = oneExt.max(aDir);
0054
0055 double otherMin = otherExt.min(aDir);
0056 double otherMax = otherExt.max(aDir);
0057
0058 return (
0059 std::abs(oneMin - otherMin) <= tolerances[toUnderlying(aDir)].first &&
0060 std::abs(oneMax - otherMax) <= tolerances[toUnderlying(aDir)].second);
0061 }
0062 };
0063
0064 }