File indexing completed on 2025-01-18 09:10:53
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 struct SurfaceBinningMatcher {
0021
0022 using Range = std::pair<double, double>;
0023 std::vector<Range> tolerances{static_cast<int>(numAxisDirections()),
0024 {0., 0.}};
0025
0026 SurfaceBinningMatcher() = default;
0027
0028 SurfaceBinningMatcher(const std::vector<Range>& tolpars)
0029 : tolerances(tolpars) {}
0030
0031
0032
0033
0034
0035
0036
0037 bool operator()(const Acts::GeometryContext& gctx, Acts::AxisDirection aDir,
0038 const Acts::Surface* one, const Acts::Surface* other) const {
0039
0040 if (one == other) {
0041 return true;
0042 }
0043
0044 auto oneExt = one->polyhedronRepresentation(gctx, 1).extent();
0045 auto otherExt = other->polyhedronRepresentation(gctx, 1).extent();
0046
0047 double oneMin = oneExt.min(aDir);
0048 double oneMax = oneExt.max(aDir);
0049
0050 double otherMin = otherExt.min(aDir);
0051 double otherMax = otherExt.max(aDir);
0052
0053 return (
0054 std::abs(oneMin - otherMin) <= tolerances[toUnderlying(aDir)].first &&
0055 std::abs(oneMax - otherMax) <= tolerances[toUnderlying(aDir)].second);
0056 }
0057 };
0058
0059 }