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/CylinderVolumeBounds.hpp"
0017 #include "Acts/Geometry/GeometryContext.hpp"
0018 #include "Acts/Plugins/GeoModel/GeoModelConverters.hpp"
0019 #include "Acts/Surfaces/Surface.hpp"
0020 #include "Acts/Surfaces/SurfaceBounds.hpp"
0021 #include "Acts/Surfaces/TrapezoidBounds.hpp"
0022 #include "Acts/Tests/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 BOOST_AUTO_TEST_SUITE(GeoModelPlugin)
0032
0033
0034 BOOST_AUTO_TEST_CASE(GeoBoxToSensitiveConversion) {
0035 auto material = make_intrusive<GeoMaterial>("Material", 1.0);
0036
0037
0038
0039 std::vector<double> dims = {5, 6, 50};
0040 auto tube = new GeoTube(dims[0], dims[1], dims[2]);
0041 auto logTube = new GeoLogVol("Tube", tube, material);
0042 auto physTube = make_intrusive<GeoFullPhysVol>(logTube);
0043
0044
0045 Acts::GeoModelDetectorObjectFactory::Config gmConfig;
0046 gmConfig.convertBox = {"Tube"};
0047 Acts::GeometryContext gContext;
0048 Acts::GeoModelDetectorObjectFactory::Cache gmCache;
0049
0050
0051 Acts::GeoModelDetectorObjectFactory factory(gmConfig);
0052
0053 factory.convertFpv("Tube", physTube, gmCache, gContext);
0054 std::shared_ptr<Acts::Experimental::DetectorVolume> volumeTube =
0055 gmCache.boundingBoxes[0];
0056 const auto* bounds = dynamic_cast<const Acts::CylinderVolumeBounds*>(
0057 &volumeTube->volumeBounds());
0058 std::vector<double> convDims = bounds->values();
0059 for (std::size_t i = 0; i < dims.size(); i++) {
0060 BOOST_CHECK(dims[i] == convDims[i]);
0061 }
0062 }
0063
0064 BOOST_AUTO_TEST_SUITE_END()