File indexing completed on 2025-12-21 09:02:56
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Geometry/GeometryContext.hpp"
0012 #include "Acts/Geometry/GeometryIdentifier.hpp"
0013 #include "Acts/Surfaces/Surface.hpp"
0014 #include "ActsTests/CommonHelpers/CubicTrackingGeometry.hpp"
0015 #include "ActsTests/CommonHelpers/CylindricalTrackingGeometry.hpp"
0016
0017 #include <optional>
0018
0019 using namespace Acts;
0020
0021 namespace ActsTests {
0022
0023
0024 GeometryContext tgContext = GeometryContext();
0025
0026 BOOST_AUTO_TEST_SUITE(GeometrySuite)
0027
0028 BOOST_AUTO_TEST_CASE(CylindricalTrackingGeometryTest) {
0029 CylindricalTrackingGeometry cGeometry(tgContext);
0030 auto tGeometry = cGeometry();
0031 BOOST_CHECK_NE(tGeometry, nullptr);
0032
0033 BOOST_CHECK(tGeometry->geometryVersion() ==
0034 TrackingGeometry::GeometryVersion::Gen1);
0035 }
0036
0037 BOOST_AUTO_TEST_CASE(CubicTrackingGeometryTest) {
0038 CubicTrackingGeometry cGeometry(tgContext);
0039 auto tGeometry = cGeometry();
0040 BOOST_CHECK_NE(tGeometry, nullptr);
0041 BOOST_CHECK(tGeometry->geometryVersion() ==
0042 TrackingGeometry::GeometryVersion::Gen1);
0043 }
0044
0045 BOOST_AUTO_TEST_CASE(SurfaceLookupTracksNonSensitiveSurfaces) {
0046 CubicTrackingGeometry builder(tgContext);
0047 auto geometry = builder();
0048 BOOST_REQUIRE_NE(geometry, nullptr);
0049
0050 std::optional<GeometryIdentifier> nonSensitiveSurfaceId;
0051 geometry->visitSurfaces(
0052 [&](const Surface* surface) {
0053 if (surface == nullptr) {
0054 return;
0055 }
0056 auto geoId = surface->geometryId();
0057 if (geoId == GeometryIdentifier{}) {
0058 return;
0059 }
0060 if (geoId.sensitive() == 0u) {
0061 nonSensitiveSurfaceId = geoId;
0062 }
0063 },
0064 false);
0065
0066 BOOST_REQUIRE(nonSensitiveSurfaceId.has_value());
0067
0068 BOOST_CHECK_MESSAGE(
0069 geometry->findSurface(*nonSensitiveSurfaceId) != nullptr,
0070 "TrackingGeometry::findSurface should return the surface with ID "
0071 << *nonSensitiveSurfaceId << " even when it is not sensitive");
0072 }
0073
0074 BOOST_AUTO_TEST_SUITE_END()
0075
0076 }