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/Geometry/GeometryContext.hpp"
0013 #include "Acts/Plugins/TGeo/TGeoParser.hpp"
0014 #include "Acts/Plugins/TGeo/TGeoSurfaceConverter.hpp"
0015 #include "Acts/Tests/CommonHelpers/DataDirectory.hpp"
0016 #include "Acts/Utilities/BinningType.hpp"
0017 #include "Acts/Visualization/GeometryView3D.hpp"
0018 #include "Acts/Visualization/ObjVisualization3D.hpp"
0019
0020 #include <memory>
0021 #include <string>
0022 #include <utility>
0023 #include <vector>
0024
0025 #include "TGeoManager.h"
0026
0027 namespace Acts::Test {
0028
0029
0030 struct RootGeometry {
0031 RootGeometry() {
0032 auto path = Acts::Test::getDataPath("panda.root");
0033 TGeoManager::Import(path.c_str());
0034 }
0035 };
0036
0037 GeometryContext tgContext = GeometryContext();
0038
0039 RootGeometry rGeometry = RootGeometry();
0040
0041
0042 BOOST_AUTO_TEST_CASE(TGeoParser_Pixel) {
0043 if (gGeoManager != nullptr) {
0044 std::string volumeName = "*";
0045 TGeoParser::Options tgpOptions;
0046 tgpOptions.volumeNames = {volumeName};
0047 tgpOptions.targetNames = {"PixelActiveo2", "PixelActiveo4", "PixelActiveo5",
0048 "PixelActiveo6"};
0049 std::string axes = "XYZ";
0050 double scale = 10.;
0051
0052 TGeoParser::State tgpState;
0053 tgpState.volume = gGeoManager->GetTopVolume();
0054
0055
0056 TGeoParser::select(tgpState, tgpOptions);
0057
0058
0059 BOOST_CHECK_EQUAL(tgpState.selectedNodes.size(), 176u);
0060
0061
0062 ObjVisualization3D objVis;
0063 for (auto& snode : tgpState.selectedNodes) {
0064 const auto& shape = *(snode.node->GetVolume()->GetShape());
0065 const auto& transform = *(snode.transform.get());
0066 auto [surface, thickness] =
0067 TGeoSurfaceConverter::toSurface(shape, transform, axes, scale);
0068 GeometryView3D::drawSurface(objVis, *surface, tgContext);
0069 }
0070 objVis.write("PixelActive");
0071 }
0072 }
0073
0074
0075 BOOST_AUTO_TEST_CASE(TGeoParser_Pixel_SelectInnermost) {
0076 if (gGeoManager != nullptr) {
0077 std::string volumeName = "*";
0078 TGeoParser::Options tgpOptions;
0079 tgpOptions.volumeNames = {volumeName};
0080 tgpOptions.targetNames = {"PixelActiveo2", "PixelActiveo4", "PixelActiveo5",
0081 "PixelActiveo6"};
0082 tgpOptions.parseRanges.push_back({binR, {0., 40.}});
0083 tgpOptions.parseRanges.push_back({binZ, {-60., 15.}});
0084 tgpOptions.unit = 10.;
0085
0086 std::string axes = "XYZ";
0087
0088 TGeoParser::State tgpState;
0089 tgpState.volume = gGeoManager->GetTopVolume();
0090
0091
0092 TGeoParser::select(tgpState, tgpOptions);
0093
0094
0095 BOOST_CHECK_EQUAL(tgpState.selectedNodes.size(), 14u);
0096
0097
0098 ObjVisualization3D objVis;
0099 for (auto& snode : tgpState.selectedNodes) {
0100 const auto& shape = *(snode.node->GetVolume()->GetShape());
0101 const auto& transform = *(snode.transform.get());
0102 auto [surface, thickness] = TGeoSurfaceConverter::toSurface(
0103 shape, transform, axes, tgpOptions.unit);
0104 GeometryView3D::drawSurface(objVis, *surface, tgContext);
0105 }
0106 objVis.write("PixelActive_Innermost");
0107 }
0108 }
0109
0110 }