File indexing completed on 2025-01-18 09:12:32
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Detector/DetectorVolume.hpp"
0013 #include "Acts/Detector/PortalGenerators.hpp"
0014 #include "Acts/Detector/detail/DetectorVolumeConsistency.hpp"
0015 #include "Acts/Geometry/CuboidVolumeBounds.hpp"
0016 #include "Acts/Geometry/GeometryContext.hpp"
0017 #include "Acts/Navigation/InternalNavigation.hpp"
0018
0019 auto portalGenerator = Acts::Experimental::defaultPortalGenerator();
0020 auto tContext = Acts::GeometryContext();
0021
0022 BOOST_AUTO_TEST_SUITE(Detector)
0023
0024 BOOST_AUTO_TEST_CASE(DetectorVolumeConsistencyFail) {
0025
0026 auto box = std::make_shared<Acts::CuboidVolumeBounds>(10, 10, 10);
0027
0028
0029 auto volumeA = Acts::Experimental::DetectorVolumeFactory::construct(
0030 portalGenerator, tContext, "VolumeA", Acts::Transform3::Identity(), box,
0031 Acts::Experimental::tryAllPortals());
0032
0033
0034 auto transformB = Acts::Transform3::Identity();
0035 Acts::Vector3 translationB = Acts::Vector3::Zero();
0036 translationB[toUnderlying(Acts::AxisDirection::AxisX)] = 20;
0037 translationB[toUnderlying(Acts::AxisDirection::AxisY)] = 5;
0038 transformB.pretranslate(translationB);
0039
0040 auto volumeB = Acts::Experimental::DetectorVolumeFactory::construct(
0041 portalGenerator, tContext, "VolumeB", transformB, box,
0042 Acts::Experimental::tryAllPortals());
0043
0044 std::vector<std::shared_ptr<Acts::Experimental::DetectorVolume>> volumes = {
0045 volumeA, volumeB};
0046
0047 BOOST_CHECK_THROW(Acts::Experimental::detail::DetectorVolumeConsistency::
0048 checkCenterAlignment(tContext, {volumeA, volumeB},
0049 Acts::AxisDirection::AxisX),
0050 std::invalid_argument);
0051 }
0052
0053 BOOST_AUTO_TEST_CASE(DetectorVolumeConsistencyPass) {
0054
0055 auto box = std::make_shared<Acts::CuboidVolumeBounds>(10, 10, 10);
0056
0057
0058 auto volumeA = Acts::Experimental::DetectorVolumeFactory::construct(
0059 portalGenerator, tContext, "VolumeA", Acts::Transform3::Identity(), box,
0060 Acts::Experimental::tryAllPortals());
0061
0062
0063 auto transformB = Acts::Transform3::Identity();
0064 Acts::Vector3 translationB = Acts::Vector3::Zero();
0065 translationB[toUnderlying(Acts::AxisDirection::AxisX)] = 20;
0066 transformB.pretranslate(translationB);
0067
0068 auto volumeB = Acts::Experimental::DetectorVolumeFactory::construct(
0069 portalGenerator, tContext, "VolumeB", transformB, box,
0070 Acts::Experimental::tryAllPortals());
0071
0072 std::vector<std::shared_ptr<Acts::Experimental::DetectorVolume>> volumes = {
0073 volumeA, volumeB};
0074
0075 BOOST_CHECK_NO_THROW(Acts::Experimental::detail::DetectorVolumeConsistency::
0076 checkCenterAlignment(tContext, {volumeA, volumeB},
0077 Acts::AxisDirection::AxisX));
0078 }
0079
0080 BOOST_AUTO_TEST_SUITE_END()