File indexing completed on 2025-01-18 09:13:10
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011
0012
0013
0014 #include "Acts/Plugins/GeoModel/GeoModelDetectorObjectFactory.hpp"
0015
0016 #include "Acts/Geometry/CuboidVolumeBounds.hpp"
0017 #include "Acts/Geometry/GeometryContext.hpp"
0018 #include "Acts/Plugins/GeoModel/GeoModelConverters.hpp"
0019 #include "Acts/Surfaces/RectangleBounds.hpp"
0020 #include "Acts/Surfaces/Surface.hpp"
0021 #include "Acts/Surfaces/SurfaceBounds.hpp"
0022 #include "Acts/Surfaces/TrapezoidBounds.hpp"
0023 #include "Acts/Tests/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 BOOST_AUTO_TEST_SUITE(GeoModelPlugin)
0034
0035
0036 BOOST_AUTO_TEST_CASE(GeoBoxToSensitiveConversion) {
0037 auto material = make_intrusive<GeoMaterial>("Material", 1.0);
0038
0039
0040
0041 std::vector<double> hls = {100, 200, 2};
0042 auto box = new GeoBox(hls[0], hls[1], hls[2]);
0043 auto logBox = new GeoLogVol("Box", box, material);
0044 auto physBox = make_intrusive<GeoFullPhysVol>(logBox);
0045
0046
0047 Acts::GeoModelDetectorObjectFactory::Config gmConfig;
0048 gmConfig.convertBox = {"Box"};
0049 Acts::GeometryContext gContext;
0050 Acts::GeoModelDetectorObjectFactory::Cache gmCache;
0051
0052
0053 Acts::GeoModelDetectorObjectFactory factory(gmConfig);
0054
0055 factory.convertFpv("Box", physBox, gmCache, gContext);
0056 std::shared_ptr<Acts::Experimental::DetectorVolume> volumeBox =
0057 gmCache.boundingBoxes[0];
0058 const auto* bounds =
0059 dynamic_cast<const Acts::CuboidVolumeBounds*>(&volumeBox->volumeBounds());
0060 std::vector<double> convHls = bounds->values();
0061 for (std::size_t i = 0; i < hls.size(); i++) {
0062 BOOST_CHECK(hls[i] == convHls[i]);
0063 }
0064 }
0065
0066 BOOST_AUTO_TEST_SUITE_END()