File indexing completed on 2025-08-06 08:11:45
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/data/test_case.hpp>
0010 #include <boost/test/unit_test.hpp>
0011
0012 #include "Acts/Definitions/Units.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Geometry/Layer.hpp"
0015 #include "Acts/Geometry/LayerCreator.hpp"
0016 #include "Acts/Geometry/ProtoLayerHelper.hpp"
0017 #include "Acts/Geometry/SurfaceArrayCreator.hpp"
0018 #include "Acts/Plugins/TGeo/TGeoLayerBuilder.hpp"
0019 #include "Acts/Surfaces/SurfaceArray.hpp"
0020 #include "Acts/Tests/CommonHelpers/DataDirectory.hpp"
0021 #include "Acts/Utilities/BinningType.hpp"
0022 #include "Acts/Utilities/Logger.hpp"
0023 #include "Acts/Visualization/GeometryView3D.hpp"
0024 #include "Acts/Visualization/ObjVisualization3D.hpp"
0025
0026 #include <array>
0027 #include <cstddef>
0028 #include <memory>
0029 #include <string>
0030 #include <utility>
0031 #include <vector>
0032
0033 #include "TGeoManager.h"
0034
0035 using namespace Acts::UnitLiterals;
0036
0037 namespace Acts::Test {
0038
0039
0040 struct RootGeometry {
0041 RootGeometry() {
0042 auto path = Acts::Test::getDataPath("panda.root");
0043 TGeoManager::Import(path.c_str());
0044 }
0045 };
0046
0047 RootGeometry rGeometry = RootGeometry();
0048
0049 GeometryContext tgContext = GeometryContext();
0050
0051
0052 BOOST_AUTO_TEST_CASE(TGeoLayerBuilderTests) {
0053 using TglConfig = TGeoLayerBuilder::LayerConfig;
0054
0055 TglConfig b0Config;
0056 b0Config.volumeName = "*";
0057 b0Config.sensorNames = {"PixelActiveo2", "PixelActiveo4", "PixelActiveo5",
0058 "PixelActiveo6"};
0059 b0Config.localAxes = "XYZ";
0060 b0Config.parseRanges = {{binR, {0., 40_mm}}, {binZ, {-60_mm, 15_mm}}};
0061 b0Config.envelope = {0_mm, 0_mm};
0062
0063 TglConfig eAllConfig;
0064 eAllConfig.volumeName = "*";
0065 eAllConfig.sensorNames = {"PixelActiveo2", "PixelActiveo4", "PixelActiveo5",
0066 "PixelActiveo6"};
0067 eAllConfig.localAxes = "XYZ";
0068 eAllConfig.parseRanges = {{binR, {0., 40_mm}}, {binZ, {16_mm, 60_mm}}};
0069 eAllConfig.splitConfigs = {{binZ, 5_mm}};
0070 eAllConfig.envelope = {0_mm, 0_mm};
0071
0072 std::vector<TglConfig> cConfigs = {b0Config};
0073 std::vector<TglConfig> pConfigs = {eAllConfig};
0074
0075 TGeoLayerBuilder::Config tglbConfig;
0076 tglbConfig.configurationName = "Pixels";
0077 tglbConfig.layerConfigurations[1] = cConfigs;
0078 tglbConfig.layerConfigurations[2] = pConfigs;
0079
0080 auto surfaceArrayCreator = std::make_shared<const SurfaceArrayCreator>(
0081 getDefaultLogger("SurfaceArrayCreator", Logging::VERBOSE));
0082
0083 LayerCreator::Config lcConfig;
0084 lcConfig.surfaceArrayCreator = surfaceArrayCreator;
0085 auto layerCreator = std::make_shared<const LayerCreator>(
0086 lcConfig, getDefaultLogger("LayerCreator", Logging::VERBOSE));
0087 tglbConfig.layerCreator = layerCreator;
0088
0089 ProtoLayerHelper::Config plhConfig;
0090 auto protoLayerHelper = std::make_shared<const ProtoLayerHelper>(
0091 plhConfig, getDefaultLogger("ProtoLayerHelper", Logging::VERBOSE));
0092 tglbConfig.protoLayerHelper = protoLayerHelper;
0093
0094 TGeoLayerBuilder tglb(tglbConfig,
0095 getDefaultLogger("TGeoLayerBuilder", Logging::VERBOSE));
0096
0097 ObjVisualization3D objVis;
0098
0099 auto centralLayers = tglb.centralLayers(tgContext);
0100 BOOST_CHECK_EQUAL(centralLayers.size(), 1u);
0101 BOOST_CHECK_EQUAL(tglb.detectorElements().size(), 14u);
0102
0103 auto positiveLayers = tglb.positiveLayers(tgContext);
0104
0105 std::size_t ipl = 0;
0106 BOOST_CHECK_EQUAL(positiveLayers.size(), 2u);
0107 BOOST_CHECK_EQUAL(tglb.detectorElements().size(), 14u + 16u);
0108 for (const auto& pLayer : positiveLayers) {
0109 auto sArray = pLayer->surfaceArray();
0110 if (sArray != nullptr) {
0111 for (auto& surface : sArray->surfaces()) {
0112 GeometryView3D::drawSurface(objVis, *surface, tgContext);
0113 }
0114 }
0115 objVis.write("PositiveLayer_" + std::to_string(ipl++));
0116 objVis.clear();
0117 }
0118 }
0119
0120 }