File indexing completed on 2025-10-17 08:01:05
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011
0012
0013
0014 #include "ActsPlugins/GeoModel/GeoModelDetectorObjectFactory.hpp"
0015
0016 #include "Acts/Geometry/CylinderVolumeBounds.hpp"
0017 #include "Acts/Geometry/GeometryContext.hpp"
0018 #include "Acts/Surfaces/Surface.hpp"
0019 #include "Acts/Surfaces/SurfaceBounds.hpp"
0020 #include "Acts/Surfaces/TrapezoidBounds.hpp"
0021 #include "ActsPlugins/GeoModel/GeoModelConverters.hpp"
0022 #include "ActsTests/CommonHelpers/FloatComparisons.hpp"
0023
0024 #include <GeoModelKernel/GeoFullPhysVol.h>
0025 #include <GeoModelKernel/GeoLogVol.h>
0026 #include <GeoModelKernel/GeoMaterial.h>
0027 #include <GeoModelKernel/GeoTrap.h>
0028 #include <GeoModelKernel/GeoTube.h>
0029 #include <GeoModelKernel/GeoVPhysVol.h>
0030
0031 using namespace Acts;
0032 using namespace ActsPlugins;
0033
0034 namespace ActsTests {
0035
0036 BOOST_AUTO_TEST_SUITE(GeoModelPlugin)
0037
0038
0039 BOOST_AUTO_TEST_CASE(GeoBoxToSensitiveConversion) {
0040 auto material = make_intrusive<GeoMaterial>("Material", 1.0);
0041
0042
0043
0044 std::vector<double> dims = {5, 6, 50};
0045 auto tube = make_intrusive<GeoTube>(dims[0], dims[1], dims[2]);
0046 auto logTube = make_intrusive<GeoLogVol>("Tube", tube, material);
0047 auto physTube = make_intrusive<GeoFullPhysVol>(logTube);
0048
0049
0050 GeoModelDetectorObjectFactory::Config gmConfig;
0051 gmConfig.convertBox = {"Tube"};
0052 GeometryContext gContext;
0053 GeoModelDetectorObjectFactory::Cache gmCache;
0054
0055
0056 GeoModelDetectorObjectFactory factory(gmConfig);
0057
0058 factory.convertFpv("Tube", physTube, gmCache, gContext);
0059 BOOST_CHECK(!gmCache.volumeBoxFPVs.empty());
0060 const auto& volumeTube = gmCache.volumeBoxFPVs[0].volume;
0061 const auto* bounds =
0062 dynamic_cast<const CylinderVolumeBounds*>(&volumeTube->volumeBounds());
0063 std::vector<double> convDims = bounds->values();
0064 for (std::size_t i = 0; i < dims.size(); i++) {
0065 BOOST_CHECK(dims[i] == convDims[i]);
0066 }
0067 }
0068
0069 BOOST_AUTO_TEST_SUITE_END()
0070
0071 }