File indexing completed on 2025-10-17 08:01:04
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/CuboidVolumeBounds.hpp"
0017 #include "Acts/Geometry/GeometryContext.hpp"
0018 #include "Acts/Surfaces/RectangleBounds.hpp"
0019 #include "Acts/Surfaces/Surface.hpp"
0020 #include "Acts/Surfaces/SurfaceBounds.hpp"
0021 #include "Acts/Surfaces/TrapezoidBounds.hpp"
0022 #include "ActsPlugins/GeoModel/GeoModelConverters.hpp"
0023 #include "ActsTests/CommonHelpers/FloatComparisons.hpp"
0024
0025 #include <GeoModelKernel/GeoBox.h>
0026 #include <GeoModelKernel/GeoFullPhysVol.h>
0027 #include <GeoModelKernel/GeoLogVol.h>
0028 #include <GeoModelKernel/GeoMaterial.h>
0029 #include <GeoModelKernel/GeoTrap.h>
0030 #include <GeoModelKernel/GeoTrd.h>
0031 #include <GeoModelKernel/GeoVPhysVol.h>
0032
0033 using namespace Acts;
0034 using namespace ActsPlugins;
0035
0036 namespace ActsTests {
0037
0038 BOOST_AUTO_TEST_SUITE(GeoModelSuite)
0039
0040
0041 BOOST_AUTO_TEST_CASE(GeoBoxToSensitiveConversion) {
0042 auto material = make_intrusive<GeoMaterial>("Material", 1.0);
0043
0044
0045
0046 std::vector<double> hls = {100, 200, 2};
0047 auto box = make_intrusive<GeoBox>(hls[0], hls[1], hls[2]);
0048 auto logBox = make_intrusive<GeoLogVol>("Box", box, material);
0049 auto physBox = make_intrusive<GeoFullPhysVol>(logBox);
0050
0051
0052 GeoModelDetectorObjectFactory::Config gmConfig;
0053 gmConfig.convertBox = {"Box"};
0054 GeometryContext gContext;
0055 GeoModelDetectorObjectFactory::Cache gmCache;
0056
0057
0058 GeoModelDetectorObjectFactory factory(gmConfig);
0059
0060 factory.convertFpv("Box", physBox, gmCache, gContext);
0061 BOOST_CHECK(!gmCache.volumeBoxFPVs.empty());
0062 const auto& volumeBox = gmCache.volumeBoxFPVs[0].volume;
0063 const auto* bounds =
0064 dynamic_cast<const CuboidVolumeBounds*>(&volumeBox->volumeBounds());
0065 std::vector<double> convHls = bounds->values();
0066 for (std::size_t i = 0; i < hls.size(); i++) {
0067 BOOST_CHECK(hls[i] == convHls[i]);
0068 }
0069 }
0070
0071 BOOST_AUTO_TEST_SUITE_END()
0072
0073 }