File indexing completed on 2025-01-18 09:12:41
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Units.hpp"
0012 #include "Acts/Geometry/CylinderVolumeBuilder.hpp"
0013 #include "Acts/Geometry/CylinderVolumeHelper.hpp"
0014 #include "Acts/Geometry/GeometryContext.hpp"
0015 #include "Acts/Geometry/LayerArrayCreator.hpp"
0016 #include "Acts/Geometry/LayerCreator.hpp"
0017 #include "Acts/Geometry/PassiveLayerBuilder.hpp"
0018 #include "Acts/Geometry/SurfaceArrayCreator.hpp"
0019 #include "Acts/Geometry/TrackingGeometry.hpp"
0020 #include "Acts/Geometry/TrackingGeometryBuilder.hpp"
0021 #include "Acts/Geometry/TrackingVolumeArrayCreator.hpp"
0022 #include "Acts/Utilities/Logger.hpp"
0023
0024 #include <functional>
0025 #include <memory>
0026 #include <string>
0027 #include <utility>
0028 #include <vector>
0029
0030 using namespace Acts::UnitLiterals;
0031
0032 namespace Acts::Test {
0033
0034
0035 GeometryContext tgContext = GeometryContext();
0036
0037
0038
0039
0040 BOOST_AUTO_TEST_CASE(SimpleGeometryTest) {
0041 Logging::Level surfaceLLevel = Logging::INFO;
0042 Logging::Level layerLLevel = Logging::INFO;
0043 Logging::Level volumeLLevel = Logging::INFO;
0044
0045
0046 SurfaceArrayCreator::Config sacConfig;
0047 auto surfaceArrayCreator = std::make_shared<const SurfaceArrayCreator>(
0048 sacConfig, getDefaultLogger("SurfaceArrayCreator", surfaceLLevel));
0049
0050 LayerCreator::Config lcConfig;
0051 lcConfig.surfaceArrayCreator = surfaceArrayCreator;
0052 auto layerCreator = std::make_shared<const LayerCreator>(
0053 lcConfig, getDefaultLogger("LayerCreator", layerLLevel));
0054
0055 LayerArrayCreator::Config lacConfig;
0056 auto layerArrayCreator = std::make_shared<const LayerArrayCreator>(
0057 lacConfig, getDefaultLogger("LayerArrayCreator", layerLLevel));
0058
0059
0060 TrackingVolumeArrayCreator::Config tvacConfig;
0061 auto tVolumeArrayCreator = std::make_shared<const TrackingVolumeArrayCreator>(
0062 tvacConfig, getDefaultLogger("TrackingVolumeArrayCreator", volumeLLevel));
0063
0064 CylinderVolumeHelper::Config cvhConfig;
0065 cvhConfig.layerArrayCreator = layerArrayCreator;
0066 cvhConfig.trackingVolumeArrayCreator = tVolumeArrayCreator;
0067 auto cylinderVolumeHelper = std::make_shared<const CylinderVolumeHelper>(
0068 cvhConfig, getDefaultLogger("CylinderVolumeHelper", volumeLLevel));
0069
0070
0071 PassiveLayerBuilder::Config bplConfig;
0072 bplConfig.layerIdentification = "BeamPipe";
0073 bplConfig.centralLayerRadii = std::vector<double>(1, 3_mm);
0074 bplConfig.centralLayerHalflengthZ = std::vector<double>(1, 40_mm);
0075 bplConfig.centralLayerThickness = std::vector<double>(1, 0.8_mm);
0076 auto beamPipeBuilder = std::make_shared<const PassiveLayerBuilder>(
0077 bplConfig, getDefaultLogger("BeamPipeLayerBuilder", layerLLevel));
0078
0079 CylinderVolumeBuilder::Config bpvConfig;
0080 bpvConfig.trackingVolumeHelper = cylinderVolumeHelper;
0081 bpvConfig.volumeName = "BeamPipe";
0082 bpvConfig.layerBuilder = beamPipeBuilder;
0083 bpvConfig.layerEnvelopeR = {1_mm, 1_mm};
0084 bpvConfig.buildToRadiusZero = true;
0085 auto beamPipeVolumeBuilder = std::make_shared<const CylinderVolumeBuilder>(
0086 bpvConfig, getDefaultLogger("BeamPipeVolumeBuilder", volumeLLevel));
0087
0088 PassiveLayerBuilder::Config layerBuilderConfig;
0089 layerBuilderConfig.layerIdentification = "CentralBarrel";
0090 layerBuilderConfig.centralLayerRadii = {10_mm, 20_mm, 30_mm};
0091 layerBuilderConfig.centralLayerHalflengthZ = {40_mm, 40_mm, 40_mm};
0092 layerBuilderConfig.centralLayerThickness = {1_mm, 1_mm, 1_mm};
0093 auto layerBuilder = std::make_shared<const PassiveLayerBuilder>(
0094 layerBuilderConfig,
0095 getDefaultLogger("CentralBarrelBuilder", layerLLevel));
0096
0097 CylinderVolumeBuilder::Config cvbConfig;
0098 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
0099 cvbConfig.volumeName = "CentralBarrel";
0100 cvbConfig.layerBuilder = layerBuilder;
0101 cvbConfig.layerEnvelopeR = {1_mm, 1_mm};
0102 cvbConfig.buildToRadiusZero = false;
0103 auto centralVolumeBuilder = std::make_shared<const CylinderVolumeBuilder>(
0104 cvbConfig, getDefaultLogger("CentralVolumeBuilder", volumeLLevel));
0105
0106
0107 TrackingGeometryBuilder::Config tgbConfig;
0108 tgbConfig.trackingVolumeBuilders.push_back(
0109 [=](const auto& context, const auto& inner, const auto&) {
0110 return beamPipeVolumeBuilder->trackingVolume(context, inner);
0111 });
0112 tgbConfig.trackingVolumeBuilders.push_back(
0113 [=](const auto& context, const auto& inner, const auto&) {
0114 return centralVolumeBuilder->trackingVolume(context, inner);
0115 });
0116 tgbConfig.trackingVolumeHelper = cylinderVolumeHelper;
0117
0118 TrackingGeometryBuilder tgBuilder(tgbConfig);
0119 auto tGeometry = tgBuilder.trackingGeometry(tgContext);
0120
0121 BOOST_CHECK(tGeometry != nullptr);
0122 }
0123 }