File indexing completed on 2025-10-15 08:05:22
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/Detector/KdtSurfacesProvider.hpp"
0013 #include "Acts/Geometry/Extent.hpp"
0014 #include "Acts/Geometry/GeometryContext.hpp"
0015 #include "Acts/Geometry/LayerCreator.hpp"
0016 #include "Acts/Surfaces/Surface.hpp"
0017 #include "Acts/Utilities/BinningType.hpp"
0018 #include "Acts/Utilities/Enumerate.hpp"
0019 #include "Acts/Utilities/GridAxisGenerators.hpp"
0020 #include "ActsTests/CommonHelpers/CylindricalTrackingGeometry.hpp"
0021
0022 #include <algorithm>
0023 #include <cstddef>
0024 #include <iterator>
0025 #include <memory>
0026 #include <utility>
0027 #include <vector>
0028
0029 using namespace Acts;
0030 using namespace Acts::Experimental;
0031 using namespace ActsTests;
0032
0033 GeometryContext tContext;
0034 CylindricalTrackingGeometry cGeometry = CylindricalTrackingGeometry(tContext);
0035
0036 namespace {
0037
0038
0039
0040 std::vector<std::shared_ptr<Surface>> unpackSurfaces(
0041 const std::vector<Surface*>& surfaces) {
0042 std::vector<std::shared_ptr<Surface>> uSurfaces;
0043 uSurfaces.reserve(surfaces.size());
0044 for (auto* s : surfaces) {
0045 uSurfaces.push_back(s->getSharedPtr());
0046 }
0047 return uSurfaces;
0048 }
0049
0050 std::vector<std::shared_ptr<Surface>> pixelSurfaces(
0051 CylindricalTrackingGeometry::DetectorStore& dStore) {
0052
0053 std::vector<std::shared_ptr<Surface>> pixelSurfaces;
0054
0055 std::vector<double> pixelDiscs = {-800., -700., -600., 600., 700., 800.};
0056 for (const auto& z : pixelDiscs) {
0057 auto rSurfaces = cGeometry.surfacesRing(dStore, 6.4, 12.4, 36., 0.125, 0.,
0058 55., z, 2., 22u);
0059 auto urSurfaces = unpackSurfaces(rSurfaces);
0060 pixelSurfaces.insert(pixelSurfaces.end(), urSurfaces.begin(),
0061 urSurfaces.end());
0062 }
0063
0064 std::vector<double> pixelBarrels = {32., 72., 116., 172.};
0065 std::vector<std::pair<int, int>> pixelBinning = {
0066 {16, 14}, {32, 14}, {52, 14}, {78, 14}};
0067 for (auto [ir, r] : enumerate(pixelBarrels)) {
0068 auto cSurfaces = cGeometry.surfacesCylinder(dStore, 8.4, 36., 0.15, 0.145,
0069 r, 3., 2., pixelBinning[ir]);
0070
0071 auto ucSurfaces = unpackSurfaces(cSurfaces);
0072 pixelSurfaces.insert(pixelSurfaces.end(), ucSurfaces.begin(),
0073 ucSurfaces.end());
0074 }
0075 return pixelSurfaces;
0076 }
0077
0078 }
0079
0080 namespace ActsTests {
0081
0082 BOOST_AUTO_TEST_SUITE(DetectorSuite)
0083
0084
0085 BOOST_AUTO_TEST_CASE(KdtSurfacesProvider_misconfigured) {
0086 Extent region;
0087 BOOST_CHECK_THROW(Experimental::KdtSurfacesProvider<> end3(nullptr, region),
0088 std::invalid_argument);
0089 }
0090
0091
0092 BOOST_AUTO_TEST_CASE(KdtSurfacesProvider) {
0093
0094 CylindricalTrackingGeometry::DetectorStore dStore;
0095 auto pSurfaces = pixelSurfaces(dStore);
0096
0097 std::size_t refNumber = 6u * 22u + 14u * (16u + 32u + 52u + 78u);
0098 BOOST_CHECK_EQUAL(pSurfaces.size(), refNumber);
0099
0100 using KDTS = Experimental::KdtSurfaces<>;
0101 auto skdt = std::make_shared<KDTS>(
0102 KDTS(tContext, pSurfaces, {AxisDirection::AxisZ, AxisDirection::AxisR}));
0103
0104
0105 Extent regionND3;
0106 regionND3.set(AxisDirection::AxisZ, -820, -780);
0107 regionND3.set(AxisDirection::AxisR, 0., 200.);
0108 Experimental::KdtSurfacesProvider<> end3(skdt, regionND3);
0109
0110 auto nd3 = end3.surfaces(tContext);
0111 BOOST_CHECK_EQUAL(nd3.size(), 22u);
0112
0113
0114 Extent regionB1;
0115 regionB1.set(AxisDirection::AxisZ, -580, 580);
0116 regionB1.set(AxisDirection::AxisR, 60., 80.);
0117
0118 Experimental::KdtSurfacesProvider<> ba1(skdt, regionB1);
0119
0120 auto b1 = ba1.surfaces(tContext);
0121 refNumber = 32u * 14u;
0122 BOOST_CHECK_EQUAL(b1.size(), refNumber);
0123 }
0124
0125 BOOST_AUTO_TEST_SUITE_END()
0126
0127 }