File indexing completed on 2025-01-18 09:12:44
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/CylinderVolumeBounds.hpp"
0013 #include "Acts/Geometry/CylinderVolumeBuilder.hpp"
0014 #include "Acts/Geometry/CylinderVolumeHelper.hpp"
0015 #include "Acts/Geometry/GeometryContext.hpp"
0016 #include "Acts/Geometry/LayerArrayCreator.hpp"
0017 #include "Acts/Geometry/LayerCreator.hpp"
0018 #include "Acts/Geometry/PassiveLayerBuilder.hpp"
0019 #include "Acts/Geometry/SurfaceArrayCreator.hpp"
0020 #include "Acts/Geometry/TrackingGeometry.hpp"
0021 #include "Acts/Geometry/TrackingVolumeArrayCreator.hpp"
0022 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0023 #include "Acts/Material/ProtoSurfaceMaterial.hpp"
0024 #include "Acts/Material/SurfaceMaterialMapper.hpp"
0025 #include "Acts/Propagator/Navigator.hpp"
0026 #include "Acts/Propagator/StraightLineStepper.hpp"
0027 #include "Acts/Utilities/BinUtility.hpp"
0028 #include "Acts/Utilities/BinningType.hpp"
0029 #include "Acts/Utilities/Logger.hpp"
0030
0031 #include <map>
0032 #include <memory>
0033 #include <string>
0034 #include <utility>
0035 #include <vector>
0036
0037 namespace Acts {
0038
0039
0040 std::shared_ptr<const TrackingGeometry> trackingGeometry() {
0041 using namespace Acts::UnitLiterals;
0042
0043 BinUtility zbinned(8, -40, 40, open, AxisDirection::AxisZ);
0044 auto matProxy = std::make_shared<const ProtoSurfaceMaterial>(zbinned);
0045
0046 Logging::Level surfaceLLevel = Logging::INFO;
0047 Logging::Level layerLLevel = Logging::INFO;
0048 Logging::Level volumeLLevel = Logging::INFO;
0049
0050
0051 auto surfaceArrayCreator = std::make_shared<const SurfaceArrayCreator>(
0052 getDefaultLogger("SurfaceArrayCreator", surfaceLLevel));
0053
0054 LayerCreator::Config lcConfig;
0055 lcConfig.surfaceArrayCreator = surfaceArrayCreator;
0056 auto layerCreator = std::make_shared<const LayerCreator>(
0057 lcConfig, getDefaultLogger("LayerCreator", layerLLevel));
0058
0059 LayerArrayCreator::Config lacConfig;
0060 auto layerArrayCreator = std::make_shared<const LayerArrayCreator>(
0061 lacConfig, getDefaultLogger("LayerArrayCreator", layerLLevel));
0062
0063
0064 TrackingVolumeArrayCreator::Config tvacConfig;
0065 auto tVolumeArrayCreator = std::make_shared<const TrackingVolumeArrayCreator>(
0066 tvacConfig, getDefaultLogger("TrackingVolumeArrayCreator", volumeLLevel));
0067
0068 CylinderVolumeHelper::Config cvhConfig;
0069 cvhConfig.layerArrayCreator = layerArrayCreator;
0070 cvhConfig.trackingVolumeArrayCreator = tVolumeArrayCreator;
0071 auto cylinderVolumeHelper = std::make_shared<const CylinderVolumeHelper>(
0072 cvhConfig, getDefaultLogger("CylinderVolumeHelper", volumeLLevel));
0073
0074 PassiveLayerBuilder::Config layerBuilderConfig;
0075 layerBuilderConfig.layerIdentification = "CentralBarrel";
0076 layerBuilderConfig.centralLayerRadii = {10., 20., 30.};
0077 layerBuilderConfig.centralLayerHalflengthZ = {40., 40., 40.};
0078 layerBuilderConfig.centralLayerThickness = {1., 1., 1.};
0079 layerBuilderConfig.centralLayerMaterial = {matProxy, matProxy, matProxy};
0080 auto layerBuilder = std::make_shared<const PassiveLayerBuilder>(
0081 layerBuilderConfig,
0082 getDefaultLogger("CentralBarrelBuilder", layerLLevel));
0083
0084 CylinderVolumeBuilder::Config cvbConfig;
0085 cvbConfig.trackingVolumeHelper = cylinderVolumeHelper;
0086 cvbConfig.volumeName = "BeamPipe";
0087 cvbConfig.layerBuilder = layerBuilder;
0088 cvbConfig.layerEnvelopeR = {1_mm, 1_mm};
0089 cvbConfig.buildToRadiusZero = true;
0090 auto centralVolumeBuilder = std::make_shared<const CylinderVolumeBuilder>(
0091 cvbConfig, getDefaultLogger("CentralVolumeBuilder", volumeLLevel));
0092
0093
0094 auto centralVolumeBounds =
0095 std::make_shared<const CylinderVolumeBounds>(0., 40., 110.);
0096
0097 GeometryContext gCtx;
0098 auto centralVolume =
0099 centralVolumeBuilder->trackingVolume(gCtx, nullptr, centralVolumeBounds);
0100
0101 return std::make_shared<const TrackingGeometry>(centralVolume);
0102 }
0103
0104 std::shared_ptr<const TrackingGeometry> tGeometry = trackingGeometry();
0105
0106 }
0107
0108 namespace Acts::Test {
0109
0110
0111 BOOST_AUTO_TEST_CASE(SurfaceMaterialMapper_tests) {
0112
0113 Navigator navigator({tGeometry});
0114 StraightLineStepper stepper;
0115 SurfaceMaterialMapper::StraightLinePropagator propagator(
0116 stepper, std::move(navigator));
0117
0118
0119 SurfaceMaterialMapper::Config smmConfig;
0120 SurfaceMaterialMapper smMapper(smmConfig, std::move(propagator));
0121
0122
0123 GeometryContext gCtx;
0124 MagneticFieldContext mfCtx;
0125
0126
0127 auto mState = smMapper.createState(gCtx, mfCtx, *tGeometry);
0128
0129
0130 BOOST_CHECK_EQUAL(mState.accumulatedMaterial.size(), 3u);
0131 }
0132
0133 }