diff --git a/Examples/Python/src/Covfie.cpp b/Examples/Python/src/Covfie.cpp index 27ceb17373f..8afb920e3f4 100644 --- a/Examples/Python/src/Covfie.cpp +++ b/Examples/Python/src/Covfie.cpp @@ -20,7 +20,7 @@ using namespace pybind11::literals; namespace Acts::Python { namespace { -template +template void declareCovfieField(py::module& m, const std::string& fieldName) { using view_t = typename field_t::view_t; m.def("toView", @@ -28,7 +28,7 @@ void declareCovfieField(py::module& m, const std::string& fieldName) { py::class_>(m, fieldName.c_str()); py::class_>( m, (fieldName + std::string("View")).c_str()) - .def("at", &view_t::template at); + .def("at", &view_t::template at); } } // namespace @@ -36,9 +36,15 @@ void addCovfie(Context& ctx) { auto main = ctx.get("main"); auto m = main.def_submodule("covfie", "Submodule for covfie conversion"); - declareCovfieField(m, - "CovfieConstantField"); - declareCovfieField( + py::class_, + std::shared_ptr>>(m, + "ArrayFloat3") + .def("at", [](const covfie::array::array& self, + std::size_t i) { return self[i]; }); + + declareCovfieField( + m, "CovfieConstantField"); + declareCovfieField( m, "CovfieAffineLinearStridedField"); m.def("makeCovfieField", diff --git a/Examples/Python/tests/test_covfie.py b/Examples/Python/tests/test_covfie.py index 3c1d7ca0d3d..bc8804883b0 100644 --- a/Examples/Python/tests/test_covfie.py +++ b/Examples/Python/tests/test_covfie.py @@ -13,8 +13,11 @@ def test_constant_field_conversion(): cf = covfie.makeCovfieField(af) view = covfie.toView(cf) points = [(0, 0, 1), (1, 1, 1), (1, 0, 2)] - for x, y, z in points: - assert view.at(x, y, z) == [1, 2, 3] + for [x, y, z] in points: + field = view.at(x, y, z) + assert field.at(0) == 1 + assert field.at(1) == 2 + assert field.at(2) == 3 @pytest.mark.skipif(not covfieEnabled, reason="Covfie plugin not available") @@ -51,10 +54,11 @@ def test_root_field_conversion(): error_margin_half_width = 0.0001 for x, y, z in points: - val = af.getField(acts.Vector3(x, y, z), fc) - Bx1, By1, Bz1 = val[0], val[1], val[2] + rfield = af.getField(acts.Vector3(x, y, z), fc) + Bx1, By1, Bz1 = rfield[0], rfield[1], rfield[2] - Bx2, By2, Bz2 = tuple(view.at(x, y, z)) + tfield = view.at(x, y, z) + Bx2, By2, Bz2 = tfield.at(0), tfield.at(1), tfield.at(2) assert ( abs(Bx1 - Bx2) < error_margin_half_width diff --git a/Plugins/Detray/include/Acts/Plugins/Detray/DetrayConverter.hpp b/Plugins/Detray/include/Acts/Plugins/Detray/DetrayConverter.hpp index 79cb1641d62..473d06451bb 100644 --- a/Plugins/Detray/include/Acts/Plugins/Detray/DetrayConverter.hpp +++ b/Plugins/Detray/include/Acts/Plugins/Detray/DetrayConverter.hpp @@ -80,7 +80,7 @@ class DetrayConverter { } // (2b) material grids - if constexpr (detray::concepts::has_material_rods) { + if constexpr (detray::concepts::has_material_maps) { if (options.convertMaterial) { detray::io::detector_grids_payload