Skip to content

Commit

Permalink
fix python test
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Oct 23, 2024
1 parent c859c95 commit fdf63f9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
37 changes: 37 additions & 0 deletions Examples/Python/src/Navigation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -117,6 +119,33 @@ class NavigationPolicyFactory : public Acts::NavigationPolicyFactory {
std::make_unique<NavigationPolicyFactoryT<>>();
};

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");

Expand All @@ -139,6 +168,14 @@ void addNavigation(Context& ctx) {
std::make_shared<CylinderVolumeBounds>(30, 40, 100));
vol1->setVolumeName("TestVolume");

auto detElem = std::make_unique<Test::DetectorElementStub>();

auto surface = Surface::makeShared<CylinderSurface>(
Transform3::Identity(), std::make_shared<CylinderBounds>(30, 40));
surface->assignDetectorElement(*detElem);

vol1->addSurface(std::move(surface));

std::unique_ptr<INavigationPolicy> result =
self.build(GeometryContext{}, *vol1,
*getDefaultLogger("Test", Logging::VERBOSE));
Expand Down
2 changes: 1 addition & 1 deletion Examples/Python/tests/test_navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
)
Expand Down

0 comments on commit fdf63f9

Please sign in to comment.