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