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/GeometryContext.hpp"
0017 #include "Acts/Geometry/TrapezoidVolumeBounds.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/GeoTrd.h>
0028
0029 BOOST_AUTO_TEST_SUITE(GeoModelPlugin)
0030
0031
0032 BOOST_AUTO_TEST_CASE(GeoTrdToVolumeConversion) {
0033 auto material = new GeoMaterial("Material", 1.0);
0034
0035 double geoHlX1 = 2, geoHlX2 = 2, geoHlY1 = 50, geoHlY2 = 80, geoHlZ = 60;
0036 auto trd = new GeoTrd(geoHlX1, geoHlX1, geoHlY1, geoHlY2, geoHlZ);
0037 auto logTrd = new GeoLogVol("Trd", trd, material);
0038 auto physTrd = make_intrusive<GeoFullPhysVol>(logTrd);
0039
0040
0041 auto errTrd = new GeoTrd(2, 3, 25, 40, 30);
0042 auto errLogTrd = new GeoLogVol("Trd", errTrd, material);
0043 auto errPhysTrd = make_intrusive<GeoFullPhysVol>(errLogTrd);
0044
0045
0046 Acts::GeoModelDetectorObjectFactory::Config gmConfig;
0047 gmConfig.convertBox = {"Trd"};
0048 Acts::GeometryContext gContext;
0049 Acts::GeoModelDetectorObjectFactory::Cache gmCache;
0050 Acts::GeoModelDetectorObjectFactory::Cache errCache;
0051
0052
0053 Acts::GeoModelDetectorObjectFactory factory(gmConfig);
0054
0055
0056 BOOST_CHECK_THROW(factory.convertFpv("Trd", errPhysTrd, errCache, gContext),
0057 std::runtime_error);
0058 factory.convertFpv("Trd", physTrd, gmCache, gContext);
0059 std::shared_ptr<Acts::Experimental::DetectorVolume> volumeTrd =
0060 gmCache.boundingBoxes[0];
0061 const auto* bounds = dynamic_cast<const Acts::TrapezoidVolumeBounds*>(
0062 &volumeTrd->volumeBounds());
0063 std::vector<double> convHls = bounds->values();
0064
0065 BOOST_CHECK(geoHlX1 == convHls[3]);
0066 BOOST_CHECK(geoHlX2 == convHls[3]);
0067 BOOST_CHECK(geoHlY1 == convHls[0]);
0068 BOOST_CHECK(geoHlY2 == convHls[1]);
0069 BOOST_CHECK(geoHlZ == convHls[2]);
0070 }
0071
0072 BOOST_AUTO_TEST_SUITE_END()