File indexing completed on 2025-10-17 08:00:24
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/Definitions/Units.hpp"
0013 #include "Acts/Detector/ProtoDetector.hpp"
0014 #include "Acts/Geometry/CylinderVolumeHelper.hpp"
0015 #include "Acts/Geometry/Extent.hpp"
0016 #include "Acts/Geometry/GeometryContext.hpp"
0017 #include "Acts/Geometry/KDTreeTrackingGeometryBuilder.hpp"
0018 #include "Acts/Geometry/LayerArrayCreator.hpp"
0019 #include "Acts/Geometry/LayerCreator.hpp"
0020 #include "Acts/Geometry/SurfaceArrayCreator.hpp"
0021 #include "Acts/Geometry/TrackingVolumeArrayCreator.hpp"
0022 #include "Acts/Surfaces/CylinderSurface.hpp"
0023 #include "Acts/Surfaces/Surface.hpp"
0024 #include "Acts/Utilities/BinningData.hpp"
0025 #include "Acts/Utilities/BinningType.hpp"
0026 #include "Acts/Utilities/Logger.hpp"
0027 #include "ActsTests/CommonHelpers/CylindricalTrackingGeometry.hpp"
0028
0029 #include <cstddef>
0030 #include <memory>
0031 #include <optional>
0032 #include <string>
0033 #include <utility>
0034 #include <vector>
0035
0036 using namespace Acts;
0037 using namespace Acts::UnitLiterals;
0038
0039 namespace ActsTests {
0040
0041 BOOST_AUTO_TEST_SUITE(GeometrySuite)
0042
0043 BOOST_AUTO_TEST_CASE(KDTreeTrackingGeometryBuilder_simple) {
0044 GeometryContext tContext;
0045 CylindricalTrackingGeometry ctGeometry(tContext);
0046 CylindricalTrackingGeometry::DetectorStore detectorStore;
0047
0048
0049 std::vector<std::shared_ptr<Surface>> layerSurfacePtrs;
0050
0051
0052 auto hTransform = Transform3::Identity();
0053 layerSurfacePtrs.push_back(
0054 Surface::makeShared<CylinderSurface>(hTransform, 15., 800.));
0055
0056
0057 std::vector<double> pLayerRadii = {32., 72., 116., 172.};
0058 std::vector<std::pair<int, int>> pLayerBinning = {
0059 {16, 14}, {32, 14}, {52, 14}, {78, 14}};
0060 std::vector<double> pModuleTiltPhi = {0.145, 0.145, 0.145, 0.145};
0061 std::vector<double> pModuleHalfX = {8.4, 8.4, 8.4, 8.4};
0062 std::vector<double> pModuleHalfY = {36., 36., 36., 36.};
0063 std::vector<double> pModuleThickness = {0.15, 0.15, 0.15, 0.15};
0064
0065
0066 for (std::size_t ilp = 0; ilp < pLayerRadii.size(); ++ilp) {
0067 std::vector<Surface*> layerSurfaces = ctGeometry.surfacesCylinder(
0068 detectorStore, pModuleHalfX[ilp], pModuleHalfY[ilp],
0069 pModuleThickness[ilp], pModuleTiltPhi[ilp], pLayerRadii[ilp], 2_mm,
0070 5_mm, pLayerBinning[ilp]);
0071
0072
0073 for (auto& sf : layerSurfaces) {
0074 layerSurfacePtrs.push_back(sf->getSharedPtr());
0075 }
0076 }
0077
0078
0079 std::vector<double> discZ = {-700., -600., 600., 700.};
0080 std::vector<double> discRadii = {60., 60., 60., 60.};
0081 std::vector<int> discModules = {22, 22, 22, 22};
0082
0083 std::vector<double> dModuleHalfXMinY = {6.4, 6.4, 6.4, 6.4};
0084 std::vector<double> dModuleHalfXMaxY = {12.4, 12.4, 12.4, 12.4};
0085 std::vector<double> dModuleHalfY = {36., 36., 36., 36.};
0086 std::vector<double> dModuleTilt = {0.075, 0.075, 0.075, 0.075};
0087 std::vector<double> dModuleThickness = {0.15, 0.15, 0.15, 0.15};
0088
0089 for (std::size_t ilp = 0; ilp < discZ.size(); ++ilp) {
0090 std::vector<Surface*> layerSurfaces = ctGeometry.surfacesRing(
0091 detectorStore, dModuleHalfXMinY[ilp], dModuleHalfXMaxY[ilp],
0092 dModuleHalfY[ilp], dModuleThickness[ilp], dModuleTilt[ilp],
0093 discRadii[ilp], discZ[ilp], 2., discModules[ilp]);
0094 for (auto& sf : layerSurfaces) {
0095 layerSurfacePtrs.push_back(sf->getSharedPtr());
0096 }
0097 }
0098
0099
0100 ProtoVolume beamPipeContainer;
0101 beamPipeContainer.name = "odd-beam-pipe";
0102 beamPipeContainer.extent.set(AxisDirection::AxisR, 0., 17);
0103 ProtoVolume beamPipe;
0104 beamPipe.name = "odd-beam-pipe-l";
0105 beamPipe.extent.set(AxisDirection::AxisR, 2., 16.);
0106 beamPipe.internal =
0107 ProtoVolume::InternalStructure{Surface::SurfaceType::Cylinder};
0108 beamPipeContainer.container = ProtoVolume::ContainerStructure{
0109 {beamPipe}, {BinningData(open, AxisDirection::AxisR, {0., 1.})}, true};
0110
0111
0112 ProtoVolume pixelContainer;
0113 pixelContainer.name = "odd-pixel";
0114 pixelContainer.extent.set(AxisDirection::AxisR, 18., 200);
0115
0116 ProtoVolume pixelNec;
0117 pixelNec.name = "odd-pixel-nec";
0118 pixelNec.extent.set(AxisDirection::AxisZ, -1000., -580);
0119
0120 ProtoVolume pixNecD1;
0121 pixNecD1.name = "odd-pixel-nec-d1";
0122 pixNecD1.extent.set(AxisDirection::AxisZ, -720., -680);
0123 ProtoVolume pixNecD0;
0124 pixNecD0.name = "odd-pixel-nec-d0";
0125 pixNecD0.extent.set(AxisDirection::AxisZ, -620., -580);
0126 pixelNec.container = ProtoVolume::ContainerStructure{
0127 {pixNecD1, pixNecD0},
0128 {BinningData(open, AxisDirection::AxisZ, {0., 1.})},
0129 true};
0130 for (auto& cv : pixelNec.container.value().constituentVolumes) {
0131 cv.internal = ProtoVolume::InternalStructure{Surface::SurfaceType::Disc};
0132 }
0133
0134 ProtoVolume pixelBarrel;
0135 pixelBarrel.name = "odd-pixel-barrel";
0136 pixelBarrel.extent.set(AxisDirection::AxisZ, -580., 580);
0137
0138 ProtoVolume pixBarrelL0;
0139 pixBarrelL0.name = "odd-pixel-barrel-l0";
0140 pixBarrelL0.extent.set(AxisDirection::AxisR, 28., 48.);
0141 pixBarrelL0.extent.set(AxisDirection::AxisZ, -580., 580);
0142 pixBarrelL0.internal =
0143 ProtoVolume::InternalStructure{Surface::SurfaceType::Cylinder};
0144 ProtoVolume pixBarrelL1;
0145 pixBarrelL1.name = "odd-pixel-barrel-l1";
0146 pixBarrelL1.extent.set(AxisDirection::AxisR, 62., 76);
0147 pixBarrelL1.extent.set(AxisDirection::AxisZ, -580., 580);
0148 pixBarrelL1.internal =
0149 ProtoVolume::InternalStructure{Surface::SurfaceType::Cylinder};
0150 ProtoVolume pixBarrelL2;
0151 pixBarrelL2.name = "odd-pixel-barrel-l2";
0152 pixBarrelL2.extent.set(AxisDirection::AxisR, 100., 120.);
0153 pixBarrelL2.extent.set(AxisDirection::AxisZ, -580., 580);
0154 pixBarrelL2.internal =
0155 ProtoVolume::InternalStructure{Surface::SurfaceType::Cylinder};
0156 ProtoVolume pixBarrelL3;
0157 pixBarrelL3.name = "odd-pixel-barrel-l3";
0158 pixBarrelL3.extent.set(AxisDirection::AxisR, 160., 180.);
0159 pixBarrelL3.extent.set(AxisDirection::AxisZ, -580., 580);
0160 pixBarrelL3.internal =
0161 ProtoVolume::InternalStructure{Surface::SurfaceType::Cylinder};
0162
0163 pixelBarrel.container = ProtoVolume::ContainerStructure{
0164 {pixBarrelL0, pixBarrelL1, pixBarrelL2, pixBarrelL3},
0165 {BinningData(open, AxisDirection::AxisR, {0., 1})},
0166 true};
0167
0168 ProtoVolume pixelPec;
0169 pixelPec.name = "odd-pixel-pec";
0170 pixelPec.extent.set(AxisDirection::AxisZ, 580., 1000.);
0171
0172 ProtoVolume pixPecD0;
0173 pixPecD0.name = "odd-pixel-pec-d0";
0174 pixPecD0.extent.set(AxisDirection::AxisZ, 580., 620);
0175 ProtoVolume pixPecD1;
0176 pixPecD1.name = "odd-pixel-pec-d1";
0177 pixPecD1.extent.set(AxisDirection::AxisZ, 680., 720);
0178
0179 pixelPec.container = ProtoVolume::ContainerStructure{
0180 {pixPecD0, pixPecD1},
0181 {BinningData(open, AxisDirection::AxisZ, {0., 1})},
0182 true};
0183 for (auto& cv : pixelPec.container.value().constituentVolumes) {
0184 cv.internal = ProtoVolume::InternalStructure{Surface::SurfaceType::Disc};
0185 }
0186
0187 pixelContainer.container = ProtoVolume::ContainerStructure{
0188 {pixelNec, pixelBarrel, pixelPec},
0189 {BinningData(open, AxisDirection::AxisZ, {-1000., -580., 580., 1000.})}};
0190
0191 ProtoVolume detectorContainer;
0192 detectorContainer.name = "odd-detector";
0193 detectorContainer.extent.set(AxisDirection::AxisR, 0., 200);
0194 detectorContainer.container = ProtoVolume::ContainerStructure{
0195 {beamPipeContainer, pixelContainer},
0196 {BinningData(open, AxisDirection::AxisR, {0., 17.5, 200.})}};
0197
0198 ProtoDetector detector;
0199 detector.name = "odd";
0200 detector.worldVolume = detectorContainer;
0201
0202 auto logLevel = Logging::VERBOSE;
0203
0204
0205 auto surfaceArrayCreator = std::make_shared<const SurfaceArrayCreator>(
0206 SurfaceArrayCreator::Config(),
0207 getDefaultLogger("SurfaceArrayCreator", logLevel));
0208
0209 LayerCreator::Config lcConfig;
0210 lcConfig.surfaceArrayCreator = surfaceArrayCreator;
0211 auto layerCreator = std::make_shared<LayerCreator>(
0212 lcConfig, getDefaultLogger("LayerCreator", logLevel));
0213
0214 LayerArrayCreator::Config lacConfig;
0215 auto layerArrayCreator = std::make_shared<const LayerArrayCreator>(
0216 lacConfig, getDefaultLogger("LayerArrayCreator", logLevel));
0217
0218 TrackingVolumeArrayCreator::Config tvacConfig;
0219 auto tVolumeArrayCreator = std::make_shared<const TrackingVolumeArrayCreator>(
0220 tvacConfig, getDefaultLogger("TrackingVolumeArrayCreator", logLevel));
0221
0222 CylinderVolumeHelper::Config cvhConfig;
0223 cvhConfig.layerArrayCreator = layerArrayCreator;
0224 cvhConfig.trackingVolumeArrayCreator = tVolumeArrayCreator;
0225 auto cylinderVolumeHelper = std::make_shared<const CylinderVolumeHelper>(
0226 cvhConfig, getDefaultLogger("CylinderVolumeHelper", logLevel));
0227
0228
0229 KDTreeTrackingGeometryBuilder::Config kdtgConfig;
0230 kdtgConfig.layerCreator = layerCreator;
0231 kdtgConfig.trackingVolumeHelper = cylinderVolumeHelper;
0232
0233 kdtgConfig.surfaces = layerSurfacePtrs;
0234
0235
0236 kdtgConfig.protoDetector = detector;
0237
0238
0239 auto kdtTrackingGeometryBuilder = KDTreeTrackingGeometryBuilder(
0240 kdtgConfig, getDefaultLogger("KDTreeTrackingGeometryBuilder", logLevel));
0241
0242 auto trackingGeometry = kdtTrackingGeometryBuilder.trackingGeometry(tContext);
0243 BOOST_CHECK(trackingGeometry != nullptr);
0244 }
0245
0246 BOOST_AUTO_TEST_SUITE_END()
0247
0248 }