From fdf63f9db812c4a7e6b1564421c159fce7a8eb21 Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Wed, 23 Oct 2024 16:27:02 +0200 Subject: [PATCH] fix python test --- Examples/Python/src/Navigation.cpp | 37 ++++++++++++++++++++++++ Examples/Python/tests/test_navigation.py | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Examples/Python/src/Navigation.cpp b/Examples/Python/src/Navigation.cpp index c7e3df8779e..ac2f1a77ef6 100644 --- a/Examples/Python/src/Navigation.cpp +++ b/Examples/Python/src/Navigation.cpp @@ -12,6 +12,8 @@ #include "Acts/Navigation/SurfaceArrayNavigationPolicy.hpp" #include "Acts/Navigation/TryAllNavigationPolicy.hpp" #include "Acts/Plugins/Python/Utilities.hpp" +#include "Acts/Surfaces/CylinderBounds.hpp" +#include "Acts/Surfaces/CylinderSurface.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/TypeTag.hpp" @@ -117,6 +119,33 @@ class NavigationPolicyFactory : public Acts::NavigationPolicyFactory { std::make_unique>(); }; +namespace Test { +class DetectorElementStub : public DetectorElementBase { + public: + DetectorElementStub() : DetectorElementBase() {} + + const Transform3& transform(const GeometryContext&) const override { + return m_transform; + } + + /// Return surface representation - const return pattern + const Surface& surface() const override { + throw std::runtime_error("Not implemented"); + } + + /// Non-const return pattern + Surface& surface() override { throw std::runtime_error("Not implemented"); } + + /// Returns the thickness of the module + /// @return double that indicates the thickness of the module + double thickness() const override { return 0; } + + private: + Transform3 m_transform; +}; + +} // namespace Test + void addNavigation(Context& ctx) { auto m = ctx.get("main"); @@ -139,6 +168,14 @@ void addNavigation(Context& ctx) { std::make_shared(30, 40, 100)); vol1->setVolumeName("TestVolume"); + auto detElem = std::make_unique(); + + auto surface = Surface::makeShared( + Transform3::Identity(), std::make_shared(30, 40)); + surface->assignDetectorElement(*detElem); + + vol1->addSurface(std::move(surface)); + std::unique_ptr result = self.build(GeometryContext{}, *vol1, *getDefaultLogger("Test", Logging::VERBOSE)); diff --git a/Examples/Python/tests/test_navigation.py b/Examples/Python/tests/test_navigation.py index 8723049b061..55ec8ac9540 100644 --- a/Examples/Python/tests/test_navigation.py +++ b/Examples/Python/tests/test_navigation.py @@ -13,7 +13,7 @@ def test_navigation_policy_factory(): .add( acts.SurfaceArrayNavigationPolicy, acts.SurfaceArrayNavigationPolicy.Config( - layerType=acts.SurfaceArrayNavigationPolicy.LayerType.Plane, + layerType=acts.SurfaceArrayNavigationPolicy.LayerType.Disc, bins=(10, 10), ), )