diff --git a/core/include/detray/core/detector.hpp b/core/include/detray/core/detector.hpp index 19259f89d..9dbcd4391 100644 --- a/core/include/detray/core/detector.hpp +++ b/core/include/detray/core/detector.hpp @@ -123,20 +123,15 @@ class detector { using volume_finder = typename metadata::template volume_finder; - // TODO: Remove - using detector_view_type = detector_view; - - // TODO: rename back to 'view_type' etc, once covfie is wrapped in the - // container view/buffer formalism /// Detector view types - using view_t = dmulti_view< + using view_type = dmulti_view< dvector_view, typename transform_container::view_type, typename mask_container::view_type, typename material_container::view_type, typename surface_container::view_type, dvector_view, typename volume_finder::view_type>; - using const_view_t = + using const_view_type = dmulti_view, typename transform_container::const_view_type, typename mask_container::const_view_type, @@ -146,7 +141,7 @@ class detector { typename volume_finder::const_view_type>; /// Detector buffer types - using buffer_t = dmulti_buffer< + using buffer_type = dmulti_buffer< dvector_buffer, typename transform_container::buffer_type, typename mask_container::buffer_type, typename material_container::buffer_type, @@ -175,20 +170,17 @@ class detector { _resource(&resource) {} /// Constructor with detector_data - template , - bool> = true> - DETRAY_HOST_DEVICE explicit detector(detector_data_type &det_data) - : _volumes(detray::detail::get<0>(det_data._detector_data.m_view)), - _transforms(detray::detail::get<1>(det_data._detector_data.m_view)), - _masks(detray::detail::get<2>(det_data._detector_data.m_view)), - _materials(detray::detail::get<3>(det_data._detector_data.m_view)), - _surfaces(detray::detail::get<4>(det_data._detector_data.m_view)), - _surface_lookup( - detray::detail::get<5>(det_data._detector_data.m_view)), - _volume_finder( - detray::detail::get<6>(det_data._detector_data.m_view)) {} + template , bool> = true> + DETRAY_HOST_DEVICE explicit detector(detector_view_t &det_data) + : _volumes(detray::detail::get<0>(det_data.m_view)), + _transforms(detray::detail::get<1>(det_data.m_view)), + _masks(detray::detail::get<2>(det_data.m_view)), + _materials(detray::detail::get<3>(det_data.m_view)), + _surfaces(detray::detail::get<4>(det_data.m_view)), + _surface_lookup(detray::detail::get<5>(det_data.m_view)), + _volume_finder(detray::detail::get<6>(det_data.m_view)) {} /// @} /// Add a new volume and retrieve a reference to it. @@ -519,6 +511,24 @@ class detector { return *std::max_element(n_candidates.begin(), n_candidates.end()); } + /// @returns view of a detector + DETRAY_HOST auto get_data() -> view_type { + return view_type{ + detray::get_data(_volumes), detray::get_data(_transforms), + detray::get_data(_masks), detray::get_data(_materials), + detray::get_data(_surfaces), detray::get_data(_surface_lookup), + detray::get_data(_volume_finder)}; + } + + /// @returns const view of a detector + DETRAY_HOST auto get_data() const -> const_view_type { + return const_view_type{ + detray::get_data(_volumes), detray::get_data(_transforms), + detray::get_data(_masks), detray::get_data(_materials), + detray::get_data(_surfaces), detray::get_data(_surface_lookup), + detray::get_data(_volume_finder)}; + } + /// @param names maps a volume to its string representation. /// @returns a string representation of the detector. DETRAY_HOST @@ -588,113 +598,4 @@ class detector { vecmem::memory_resource *_resource = nullptr; }; -/// @brief The detector data buffer -/// -/// Contains the buffers for all detector components plus the covfie device -/// field type, which is being copied to device when this type gets constructed -template -struct detector_buffer { - - using detector_type = detector; - - /// Automatic buffer creation with the given parameters - detector_buffer(detector_type &det, vecmem::memory_resource &mr, - vecmem::copy &cpy, - detray::copy cpy_type = detray::copy::sync, - vecmem::data::buffer_type buff_type = - vecmem::data::buffer_type::fixed_size) - : _detector_buffer(detray::get_buffer(detray::get_data(det.volumes()), - mr, cpy, cpy_type, buff_type), - detray::get_buffer(det.transform_store(), mr, cpy, - cpy_type, buff_type), - detray::get_buffer(det.mask_store(), mr, cpy, - cpy_type, buff_type), - detray::get_buffer(det.material_store(), mr, cpy, - cpy_type, buff_type), - detray::get_buffer(det.surface_store(), mr, cpy, - cpy_type, buff_type), - detray::get_buffer(det.surface_lookup(), mr, cpy, - cpy_type, buff_type), - detray::get_buffer(det.volume_search_grid(), mr, cpy, - cpy_type, buff_type)) {} - - /// Buffers were created manually - detector_buffer( - detail::get_buffer_t - &&vol_buffer, - typename detector_type::transform_container::buffer_type &&trf_buffer, - typename detector_type::mask_container::buffer_type &&msk_buffer, - typename detector_type::material_container::buffer_type &&mat_buffer, - typename detector_type::surface_container::buffer_type &&sf_buffer, - detail::get_buffer_t - &&sf_lkp_buffer, - typename detector_type::volume_finder::buffer_type &&vgrd_buffer) - : _detector_buffer(std::move(vol_buffer), std::move(trf_buffer), - std::move(msk_buffer), std::move(mat_buffer), - std::move(sf_buffer), std::move(sf_lkp_buffer), - std::move(vgrd_buffer)) {} - - /// Buffers for the vecemem types - typename detector_type::buffer_t _detector_buffer; -}; - -/// @brief The detector view -/// -/// Contains the views for all detector components, including the device view -/// of the bfield -template -struct detector_view { - - using detector_type = detector; - - detector_view(detector_type &det) - : _detector_data(detray::get_data(det.volumes()), - detray::get_data(det.transform_store()), - detray::get_data(det.mask_store()), - detray::get_data(det.material_store()), - detray::get_data(det.surface_store()), - detray::get_data(det.surface_lookup()), - detray::get_data(det.volume_search_grid())) {} - - detector_view(detector_buffer &det_buff) - : _detector_data(detray::get_data(det_buff._detector_buffer)) {} - - /// Views for the vecmem types - typename detector_type::view_t _detector_data; -}; - -/// Stand-alone function that @returns the detector view for transfer to -/// device. -/// -/// @param detector the detector to be tranferred -template -inline detector_view get_data( - detector &det) { - return {det}; -} - -/// Stand-alone function that @returns the detector buffer for transfer to -/// device. -/// -/// @param detector the detector to be transferred -template -inline detector_buffer get_buffer( - detector &det, - vecmem::memory_resource &mr, vecmem::copy &cpy, - detray::copy cpy_type = detray::copy::sync, - vecmem::data::buffer_type buff_type = - vecmem::data::buffer_type::fixed_size) { - return {det, mr, cpy, cpy_type, buff_type}; -} - -/// Stand-alone function that @returns the detector view for transfer to -/// device. -/// -/// @param detector the detector to be transferred -template -inline detector_view get_data( - detector_buffer &det_buff) { - return {det_buff}; -} - } // namespace detray diff --git a/core/include/detray/surface_finders/grid/detail/axis_helpers.hpp b/core/include/detray/surface_finders/grid/detail/axis_helpers.hpp index 76a575098..9376ff0bb 100644 --- a/core/include/detray/surface_finders/grid/detail/axis_helpers.hpp +++ b/core/include/detray/surface_finders/grid/detail/axis_helpers.hpp @@ -49,7 +49,7 @@ struct multi_axis_data { multi_axis_data() = default; /// Construct containers using a specific memory resources - DETRAY_HOST_DEVICE + DETRAY_HOST multi_axis_data(vecmem::memory_resource &resource) : m_axes_data(&resource), m_edges(&resource) {} diff --git a/core/include/detray/surface_finders/grid/detail/grid_helpers.hpp b/core/include/detray/surface_finders/grid/detail/grid_helpers.hpp index 9539d320c..9a3c4ed38 100644 --- a/core/include/detray/surface_finders/grid/detail/grid_helpers.hpp +++ b/core/include/detray/surface_finders/grid/detail/grid_helpers.hpp @@ -30,7 +30,7 @@ struct grid_data { grid_data() = default; /// Construct containers using a memory resources - DETRAY_HOST_DEVICE + DETRAY_HOST grid_data(vecmem::memory_resource &resource) : m_bin_data(&resource) {} /// Construct grid data from containers - move diff --git a/io/include/detray/io/common/read_bfield.hpp b/io/include/detray/io/common/read_bfield.hpp index adaed92b9..d8888b4c1 100644 --- a/io/include/detray/io/common/read_bfield.hpp +++ b/io/include/detray/io/common/read_bfield.hpp @@ -15,13 +15,19 @@ // System include(s) #include +#include +#include #include namespace detray::io { /// @brief Function that reads the first 4 bytes of a potential bfield file and /// checks that it contains data for a covfie field -inline bool check_covfie_file(io::detail::file_handle& file) { +inline bool check_covfie_file(const std::string& file_name) { + + // Open binary file + io::detail::file_handle file{file_name, + std::ios_base::in | std::ios_base::binary}; // See "covfie/lib/core/utility/binary_io.hpp" std::uint32_t hdr = covfie::utility::read_binary(*file); @@ -32,14 +38,16 @@ inline bool check_covfie_file(io::detail::file_handle& file) { /// @brief function that reads a covfie field from file template -bfield_t read_bfield(const std::string& file_name) { +inline bfield_t read_bfield(const std::string& file_name) { + + if (not check_covfie_file(file_name)) { + throw std::runtime_error("Not a valid covfie file: " + file_name); + } // Open binary file io::detail::file_handle file{file_name, std::ios_base::in | std::ios_base::binary}; - check_covfie_file(file); - return bfield_t(*file); } diff --git a/tests/benchmarks/cuda/benchmark_propagator_cuda.cpp b/tests/benchmarks/cuda/benchmark_propagator_cuda.cpp index 31d3e1ec9..b1645c0c2 100644 --- a/tests/benchmarks/cuda/benchmark_propagator_cuda.cpp +++ b/tests/benchmarks/cuda/benchmark_propagator_cuda.cpp @@ -47,7 +47,7 @@ static void BM_PROPAGATOR_CPU(benchmark::State &state) { // Create the toy geometry and bfield auto [det, names] = create_toy_geometry(host_mr, toy_cfg); vector3 B{0.f, 0.f, 2.f * unit::T}; - auto bfield = test::create_const_field(B); + auto bfield = bfield::create_const_field(B); // Create RK stepper rk_stepper_type s; @@ -106,7 +106,7 @@ static void BM_PROPAGATOR_CUDA(benchmark::State &state) { // Create the toy geometry auto [det, names] = create_toy_geometry(bp_mng_mr, toy_cfg); vector3 B{0.f, 0.f, 2.f * unit::T}; - auto bfield = test::create_const_field(B); + auto bfield = bfield::create_const_field(B); // Get detector data auto det_data = detray::get_data(det); diff --git a/tests/benchmarks/cuda/benchmark_propagator_cuda_kernel.cu b/tests/benchmarks/cuda/benchmark_propagator_cuda_kernel.cu index 69d8565ec..f512b625d 100644 --- a/tests/benchmarks/cuda/benchmark_propagator_cuda_kernel.cu +++ b/tests/benchmarks/cuda/benchmark_propagator_cuda_kernel.cu @@ -11,8 +11,8 @@ namespace detray { __global__ void __launch_bounds__(256, 4) propagator_benchmark_kernel( - typename detector_host_type::detector_view_type det_data, - covfie::field_view field_view, + typename detector_host_type::view_type det_data, + covfie::field_view field_data, vecmem::data::vector_view> tracks_data, vecmem::data::jagged_vector_view candidates_data, const propagate_option opt) { @@ -45,7 +45,7 @@ __global__ void __launch_bounds__(256, 4) propagator_benchmark_kernel( auto actor_states = tie(transporter_state, interactor_state, resetter_state); // Create the propagator state - propagator_device_type::state p_state(tracks.at(gid), field_view, det, + propagator_device_type::state p_state(tracks.at(gid), field_data, det, candidates.at(gid)); // Run propagation @@ -57,8 +57,8 @@ __global__ void __launch_bounds__(256, 4) propagator_benchmark_kernel( } void propagator_benchmark( - typename detector_host_type::detector_view_type det_data, - covfie::field_view field_view, + typename detector_host_type::view_type det_data, + covfie::field_view field_data, vecmem::data::vector_view>& tracks_data, vecmem::data::jagged_vector_view& candidates_data, const propagate_option opt) { @@ -69,7 +69,7 @@ void propagator_benchmark( // run the test kernel propagator_benchmark_kernel<<>>( - det_data, field_view, tracks_data, candidates_data, opt); + det_data, field_data, tracks_data, candidates_data, opt); // cuda error check DETRAY_CUDA_ERROR_CHECK(cudaGetLastError()); diff --git a/tests/benchmarks/cuda/benchmark_propagator_cuda_kernel.hpp b/tests/benchmarks/cuda/benchmark_propagator_cuda_kernel.hpp index 6004c6af1..ea332e933 100644 --- a/tests/benchmarks/cuda/benchmark_propagator_cuda_kernel.hpp +++ b/tests/benchmarks/cuda/benchmark_propagator_cuda_kernel.hpp @@ -10,6 +10,7 @@ // Project include(s) #include "detray/definitions/algebra.hpp" #include "detray/definitions/units.hpp" +#include "detray/detectors/bfield.hpp" #include "detray/detectors/create_toy_geometry.hpp" #include "detray/propagator/actor_chain.hpp" #include "detray/propagator/actors/aborters.hpp" @@ -34,7 +35,7 @@ using intersection_t = using navigator_host_type = navigator; using navigator_device_type = navigator; -using field_type = test::const_field_t; +using field_type = bfield::const_field_t; using rk_stepper_type = rk_stepper; using actor_chain_t = actor_chain, pointwise_material_interactor, @@ -53,8 +54,8 @@ namespace detray { /// test function for propagator with single state void propagator_benchmark( - typename detector_host_type::detector_view_type det_data, - typename field_type::view_t field_view, + typename detector_host_type::view_type det_data, + typename field_type::view_t field_data, vecmem::data::vector_view>& tracks_data, vecmem::data::jagged_vector_view& candidates_data, const propagate_option opt); diff --git a/tests/common/include/tests/common/test_base/propagator_test.hpp b/tests/common/include/tests/common/test_base/propagator_test.hpp index b51161e8f..5ba29e966 100644 --- a/tests/common/include/tests/common/test_base/propagator_test.hpp +++ b/tests/common/include/tests/common/test_base/propagator_test.hpp @@ -10,6 +10,7 @@ // Project include(s). #include "detray/definitions/algebra.hpp" #include "detray/definitions/units.hpp" +#include "detray/detectors/bfield.hpp" #include "detray/detectors/create_toy_geometry.hpp" #include "detray/propagator/actor_chain.hpp" #include "detray/propagator/actors/aborters.hpp" @@ -22,7 +23,6 @@ #include "detray/propagator/rk_stepper.hpp" #include "detray/simulation/event_generator/track_generators.hpp" #include "detray/tracks/tracks.hpp" -#include "tests/common/bfield.hpp" // Vecmem include(s) #include @@ -159,7 +159,7 @@ inline auto run_propagation_host(vecmem::memory_resource *mr, vecmem::jagged_vector> { // Construct propagator from stepper and navigator - auto stepr = rk_stepper_t::view_t>{}; + auto stepr = rk_stepper_t::view_t>{}; auto nav = navigator_t{}; using propagator_host_t = diff --git a/tests/include/detray/test/bfield.hpp b/tests/include/detray/test/bfield.hpp deleted file mode 100644 index 314a7c429..000000000 --- a/tests/include/detray/test/bfield.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/** Detray library, part of the ACTS project (R&D line) - * - * (c) 2023 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -#pragma once - -// Project include(s) -#include "detray/io/common/read_bfield.hpp" - -// Covfie include(s) -#include -#include -#include -#include -#include - -namespace detray::test { - -/// Constant bfield (host and device) -using const_bknd_t = - covfie::backend::constant, - covfie::vector::vector_d>; - -using const_field_t = covfie::field; - -/// Inhomogeneous field (host) -using inhom_bknd_t = covfie::backend::affine< - covfie::backend::nearest_neighbour>>>>; - -using inhom_field_t = covfie::field; - -/// @returns a constant covfie field constructed from the field vector @param B -const_field_t create_const_field(const __plugin::vector3 &B) { - return const_field_t{covfie::make_parameter_pack( - const_bknd_t::configuration_t{B[0], B[1], B[2]})}; -} - -/// @returns a constant covfie field constructed from the field vector @param B -inhom_field_t create_inhom_field() { - return io::read_bfield( - !std::getenv("DETRAY_BFIELD_FILE") ? "" - : std::getenv("DETRAY_BFIELD_FILE")); -} - -} // namespace detray::test diff --git a/tests/unit_tests/cpu/tools_guided_navigator.cpp b/tests/unit_tests/cpu/tools_guided_navigator.cpp index cc677f2cb..e4eaba151 100644 --- a/tests/unit_tests/cpu/tools_guided_navigator.cpp +++ b/tests/unit_tests/cpu/tools_guided_navigator.cpp @@ -6,6 +6,7 @@ */ #include "detray/definitions/units.hpp" +#include "detray/detectors/bfield.hpp" #include "detray/detectors/create_telescope_detector.hpp" #include "detray/masks/masks.hpp" #include "detray/masks/unbounded.hpp" @@ -18,7 +19,6 @@ #include "detray/test/types.hpp" #include "detray/tracks/tracks.hpp" #include "detray/utils/inspectors.hpp" -#include "tests/common/bfield.hpp" // vecmem include(s) #include @@ -56,7 +56,7 @@ GTEST_TEST(detray_propagator, guided_navigator) { object_tracer; using inspector_t = aggregate_inspector; - using b_field_t = test::const_field_t; + using b_field_t = bfield::const_field_t; using runge_kutta_stepper = rk_stepper; @@ -70,7 +70,7 @@ GTEST_TEST(detray_propagator, guided_navigator) { const vector3 mom{0.f, 0.f, 1.f}; free_track_parameters track(pos, 0.f, mom, -1.f); const vector3 B{0.f, 0.f, 1.f * unit::T}; - const b_field_t b_field = test::create_const_field(B); + const b_field_t b_field = bfield::create_const_field(B); // Actors pathlimit_aborter::state pathlimit{200.f * unit::cm}; diff --git a/tests/unit_tests/cpu/tools_propagator.cpp b/tests/unit_tests/cpu/tools_propagator.cpp index 458863b1a..5b6d35a8d 100644 --- a/tests/unit_tests/cpu/tools_propagator.cpp +++ b/tests/unit_tests/cpu/tools_propagator.cpp @@ -7,6 +7,7 @@ // Project include(s) #include "detray/definitions/units.hpp" +#include "detray/detectors/bfield.hpp" #include "detray/detectors/create_toy_geometry.hpp" #include "detray/geometry/surface.hpp" #include "detray/intersection/detail/trajectories.hpp" @@ -24,7 +25,6 @@ #include "detray/test/types.hpp" #include "detray/tracks/tracks.hpp" #include "detray/utils/inspectors.hpp" -#include "tests/common/bfield.hpp" // Vecmem include(s) #include @@ -170,7 +170,7 @@ class PropagatorWithRkStepper TEST_P(PropagatorWithRkStepper, rk4_propagator_const_bfield) { // Constant magnetic field type - using bfield_t = test::const_field_t; + using bfield_t = bfield::const_field_t; // Toy detector using detector_t = detector; @@ -193,7 +193,7 @@ TEST_P(PropagatorWithRkStepper, rk4_propagator_const_bfield) { // Build detector and magnetic field const auto [det, names] = create_toy_geometry(host_mr, toy_cfg); - const bfield_t bfield = test::create_const_field(std::get<2>(GetParam())); + const bfield_t bfield = bfield::create_const_field(std::get<2>(GetParam())); // Propagator is built from the stepper and navigator propagator_t p(stepper_t{}, navigator_t{}); @@ -271,7 +271,7 @@ TEST_P(PropagatorWithRkStepper, rk4_propagator_const_bfield) { TEST_P(PropagatorWithRkStepper, rk4_propagator_inhom_bfield) { // Magnetic field map using nearest neightbor interpolation - using bfield_t = test::inhom_field_t; + using bfield_t = bfield::inhom_field_t; // Toy detector using detector_t = detector; @@ -293,7 +293,7 @@ TEST_P(PropagatorWithRkStepper, rk4_propagator_inhom_bfield) { // Build detector and magnetic field const auto [det, names] = create_toy_geometry(host_mr, toy_cfg); - const bfield_t bfield = test::create_inhom_field(); + const bfield_t bfield = bfield::create_inhom_field(); // Propagator is built from the stepper and navigator propagator_t p(stepper_t{}, navigator_t{}); diff --git a/tests/unit_tests/cpu/tools_stepper.cpp b/tests/unit_tests/cpu/tools_stepper.cpp index b0859d0b7..8cd6814cf 100644 --- a/tests/unit_tests/cpu/tools_stepper.cpp +++ b/tests/unit_tests/cpu/tools_stepper.cpp @@ -7,6 +7,7 @@ // detray include(s) #include "detray/definitions/units.hpp" +#include "detray/detectors/bfield.hpp" #include "detray/geometry/surface.hpp" #include "detray/intersection/detail/trajectories.hpp" #include "detray/io/common/detail/file_handle.hpp" @@ -15,7 +16,6 @@ #include "detray/simulation/event_generator/track_generators.hpp" #include "detray/test/types.hpp" #include "detray/tracks/tracks.hpp" -#include "tests/common/bfield.hpp" // google-test include(s) #include @@ -138,11 +138,11 @@ GTEST_TEST(detray_propagator, rk_stepper) { using namespace step; // Constant magnetic field - using bfield_t = test::const_field_t; + using bfield_t = bfield::const_field_t; vector3 B{1.f * unit::T, 1.f * unit::T, 1.f * unit::T}; - const bfield_t hom_bfield = test::create_const_field(B); + const bfield_t hom_bfield = bfield::create_const_field(B); // RK stepper rk_stepper_t rk_stepper; @@ -244,8 +244,8 @@ TEST(detray_propagator, rk_stepper_inhomogeneous_bfield) { using namespace step; // Read the magnetic field map - using bfield_t = test::inhom_field_t; - bfield_t inhom_bfield = test::create_inhom_field(); + using bfield_t = bfield::inhom_field_t; + bfield_t inhom_bfield = bfield::create_inhom_field(); // RK stepper rk_stepper_t rk_stepper; diff --git a/tests/unit_tests/device/cuda/detector_cuda_kernel.cu b/tests/unit_tests/device/cuda/detector_cuda_kernel.cu index d2ff369aa..cc939b938 100644 --- a/tests/unit_tests/device/cuda/detector_cuda_kernel.cu +++ b/tests/unit_tests/device/cuda/detector_cuda_kernel.cu @@ -12,7 +12,7 @@ namespace detray { // cuda kernel to copy sub-detector objects __global__ void detector_test_kernel( - typename detector_host_t::detector_view_type det_data, + typename detector_host_t::view_type det_data, vecmem::data::vector_view volumes_data, vecmem::data::vector_view surfaces_data, vecmem::data::vector_view transforms_data, @@ -84,7 +84,7 @@ __global__ void detector_test_kernel( } /// implementation of the test function for detector -void detector_test(typename detector_host_t::detector_view_type det_data, +void detector_test(typename detector_host_t::view_type det_data, vecmem::data::vector_view volumes_data, vecmem::data::vector_view surfaces_data, vecmem::data::vector_view transforms_data, diff --git a/tests/unit_tests/device/cuda/detector_cuda_kernel.hpp b/tests/unit_tests/device/cuda/detector_cuda_kernel.hpp index 088f08867..9067e1b3f 100644 --- a/tests/unit_tests/device/cuda/detector_cuda_kernel.hpp +++ b/tests/unit_tests/device/cuda/detector_cuda_kernel.hpp @@ -36,7 +36,7 @@ using disc_t = typename mask_defs::template get_type::type; using cylinder_t = typename mask_defs::template get_type::type; /// declaration of a test function for detector -void detector_test(typename detector_host_t::detector_view_type det_data, +void detector_test(typename detector_host_t::view_type det_data, vecmem::data::vector_view volumes_data, vecmem::data::vector_view surfaces_data, vecmem::data::vector_view transforms_data, diff --git a/tests/unit_tests/device/cuda/navigator_cuda_kernel.cu b/tests/unit_tests/device/cuda/navigator_cuda_kernel.cu index 4237f050d..2cf6ccd90 100644 --- a/tests/unit_tests/device/cuda/navigator_cuda_kernel.cu +++ b/tests/unit_tests/device/cuda/navigator_cuda_kernel.cu @@ -11,7 +11,7 @@ namespace detray { __global__ void navigator_test_kernel( - typename detector_host_t::detector_view_type det_data, + typename detector_host_t::view_type det_data, vecmem::data::vector_view> tracks_data, vecmem::data::jagged_vector_view candidates_data, vecmem::data::jagged_vector_view volume_records_data, @@ -63,7 +63,7 @@ __global__ void navigator_test_kernel( } void navigator_test( - typename detector_host_t::detector_view_type det_data, + typename detector_host_t::view_type det_data, vecmem::data::vector_view>& tracks_data, vecmem::data::jagged_vector_view& candidates_data, vecmem::data::jagged_vector_view& volume_records_data, diff --git a/tests/unit_tests/device/cuda/navigator_cuda_kernel.hpp b/tests/unit_tests/device/cuda/navigator_cuda_kernel.hpp index 6b97584eb..3602b124f 100644 --- a/tests/unit_tests/device/cuda/navigator_cuda_kernel.hpp +++ b/tests/unit_tests/device/cuda/navigator_cuda_kernel.hpp @@ -55,7 +55,7 @@ namespace detray { /// test function for navigator with single state void navigator_test( - typename detector_host_t::detector_view_type det_data, + typename detector_host_t::view_type det_data, vecmem::data::vector_view>& tracks_data, vecmem::data::jagged_vector_view& candidates_data, vecmem::data::jagged_vector_view& volume_records_data, diff --git a/tests/unit_tests/device/cuda/propagator_cuda.cpp b/tests/unit_tests/device/cuda/propagator_cuda.cpp index e2a92a117..30af1ecee 100644 --- a/tests/unit_tests/device/cuda/propagator_cuda.cpp +++ b/tests/unit_tests/device/cuda/propagator_cuda.cpp @@ -6,8 +6,8 @@ */ // Project include(s) +#include "detray/detectors/bfield.hpp" #include "propagator_cuda_kernel.hpp" -#include "tests/common/bfield.hpp" // Vecmem include(s) #include @@ -29,12 +29,12 @@ TEST_P(CudaPropConstBFieldMng, propagator) { // Get the magnetic field const vector3_t B = GetParam(); - auto field = test::create_const_field(B); + auto field = bfield::create_const_field(B); // Create the toy geometry auto [det, names] = create_toy_geometry(mng_mr, toy_cfg); - run_propagation_test( + run_propagation_test( &mng_mr, det, detray::get_data(det), std::move(field)); } @@ -51,14 +51,14 @@ TEST_P(CudaPropConstBFieldCpy, propagator) { // Get the magnetic field const vector3_t B = GetParam(); - auto field = test::create_const_field(B); + auto field = bfield::create_const_field(B); // Create the toy geometry auto [det, names] = create_toy_geometry(host_mr, toy_cfg); auto det_buff = detray::get_buffer(det, dev_mr, cuda_cpy); - run_propagation_test( + run_propagation_test( &mng_mr, det, detray::get_data(det_buff), std::move(field)); } @@ -113,7 +113,7 @@ TEST(CudaPropagatorValidation10, inhomogeneous_bfield_cpy) { vecmem::cuda::copy cuda_cpy; // Get the magnetic field - auto field = test::create_inhom_field(); + auto field = bfield::create_inhom_field(); // Create the toy geometry with inhomogeneous bfield from file auto [det, names] = create_toy_geometry(host_mr, toy_cfg); diff --git a/tests/unit_tests/device/cuda/propagator_cuda_kernel.cu b/tests/unit_tests/device/cuda/propagator_cuda_kernel.cu index d3b679dd2..e44f29d0d 100644 --- a/tests/unit_tests/device/cuda/propagator_cuda_kernel.cu +++ b/tests/unit_tests/device/cuda/propagator_cuda_kernel.cu @@ -12,8 +12,8 @@ namespace detray { template __global__ void propagator_test_kernel( - typename detector_t::template detector_view_type det_data, - covfie::field_view field_view, + typename detector_t::view_type det_data, + covfie::field_view field_data, vecmem::data::vector_view tracks_data, vecmem::data::jagged_vector_view> candidates_data, @@ -57,7 +57,7 @@ __global__ void propagator_test_kernel( ::detray::tie(insp_state, aborter_state, transporter_state, interactor_state, resetter_state); // Create the propagator state - typename propagator_device_t::state state(tracks[gid], field_view, det, + typename propagator_device_t::state state(tracks[gid], field_data, det, candidates.at(gid)); state._stepping.set_tolerance(rk_tolerance); @@ -72,8 +72,8 @@ __global__ void propagator_test_kernel( /// Launch the device kernel template void propagator_test( - typename detector_t::template detector_view_type det_view, - covfie::field_view field_view, + typename detector_t::view_type det_view, + covfie::field_view field_data, vecmem::data::vector_view& tracks_data, vecmem::data::jagged_vector_view>& candidates_data, @@ -86,7 +86,7 @@ void propagator_test( // run the test kernel propagator_test_kernel - <<>>(det_view, field_view, tracks_data, + <<>>(det_view, field_data, tracks_data, candidates_data, path_lengths_data, positions_data, jac_transports_data); @@ -96,8 +96,8 @@ void propagator_test( } /// Explicit instantiation for a constant magnetic field -template void propagator_test( - detector_host_t::detector_view_type, covfie::field_view, +template void propagator_test( + detector_host_t::view_type, covfie::field_view, vecmem::data::vector_view&, vecmem::data::jagged_vector_view>&, vecmem::data::jagged_vector_view&, @@ -106,8 +106,7 @@ template void propagator_test( /// Explicit instantiation for an inhomogeneous magnetic field template void propagator_test( - detector_host_t::detector_view_type, - covfie::field_view, + detector_host_t::view_type, covfie::field_view, vecmem::data::vector_view&, vecmem::data::jagged_vector_view>&, vecmem::data::jagged_vector_view&, diff --git a/tests/unit_tests/device/cuda/propagator_cuda_kernel.hpp b/tests/unit_tests/device/cuda/propagator_cuda_kernel.hpp index f9db9e16c..8200fe648 100644 --- a/tests/unit_tests/device/cuda/propagator_cuda_kernel.hpp +++ b/tests/unit_tests/device/cuda/propagator_cuda_kernel.hpp @@ -7,6 +7,7 @@ #pragma once +// Project include(s) #include "tests/common/test_base/propagator_test.hpp" // Vecmem include(s) @@ -31,7 +32,7 @@ using inhom_bknd_t = covfie::backend::affine< /// Launch the propagation test kernel template void propagator_test( - typename detector_t::detector_view_type, covfie::field_view, + typename detector_t::view_type, covfie::field_view, vecmem::data::vector_view &, vecmem::data::jagged_vector_view> &, vecmem::data::jagged_vector_view &, @@ -42,8 +43,8 @@ void propagator_test( template inline auto run_propagation_device( vecmem::memory_resource *mr, detector_t &det, - typename detector_t::detector_view_type det_view, - covfie::field_view field_view, dvector &tracks, + typename detector_t::view_type det_view, + covfie::field_view field_data, dvector &tracks, const vecmem::jagged_vector &host_positions) -> std::tuple, vecmem::jagged_vector, @@ -80,7 +81,7 @@ inline auto run_propagation_device( // Run the propagator test for GPU device propagator_test( - det_view, field_view, tracks_data, candidates_buffer, + det_view, field_data, tracks_data, candidates_buffer, path_lengths_buffer, positions_buffer, jac_transports_buffer); vecmem::jagged_vector device_path_lengths(mr); @@ -97,11 +98,11 @@ inline auto run_propagation_device( } /// Test chain for the propagator -template -inline auto run_propagation_test( - vecmem::memory_resource *mr, detector_t &det, - typename detector_t::detector_view_type det_view, - covfie::field &&field) { +template +inline auto run_propagation_test(vecmem::memory_resource *mr, detector_t &det, + typename detector_t::view_type det_view, + covfie::field &&field) { // Create the vector of initial track parameterizations auto tracks_host = generate_tracks(mr); @@ -112,9 +113,10 @@ inline auto run_propagation_test( run_propagation_host(mr, det, field, tracks_host); // Device propagation (device backend specific implementation) + covfie::field device_field(field); auto &&[device_path_lengths, device_positions, device_jac_transports] = - run_propagation_device(mr, det, det_view, field, - tracks_device, host_positions); + run_propagation_device( + mr, det, det_view, device_field, tracks_device, host_positions); // Check the results compare_propagation_results(host_positions, device_positions, diff --git a/tests/unit_tests/device/sycl/propagator_kernel.sycl b/tests/unit_tests/device/sycl/propagator_kernel.sycl index 22dec4175..739c9c781 100644 --- a/tests/unit_tests/device/sycl/propagator_kernel.sycl +++ b/tests/unit_tests/device/sycl/propagator_kernel.sycl @@ -13,7 +13,8 @@ namespace detray { /// Test function for propagator template void propagator_test( - typename detector_t::template detector_view_type det_data, + typename detector_t::view_type det_data, + covfie::field_view field_data, vecmem::data::vector_view& tracks_data, vecmem::data::jagged_vector_view>& candidates_data, @@ -35,7 +36,7 @@ void propagator_test( path_lengths_data, positions_data, jac_transports_data]( ::sycl::nd_item<1> item) { - detector_device_t dev_det(det_data); + detector_device_t dev_det(det_data); vecmem::device_vector tracks(tracks_data); vecmem::jagged_device_vector> @@ -52,9 +53,8 @@ void propagator_test( return; } - auto stepr = rk_stepper_t< - typename detector_device_t::bfield_type>{}; - auto nav = navigator_t>{}; + auto stepr = rk_stepper_t>{}; + auto nav = navigator_t{}; // Create propagator using propagator_device_t = @@ -78,8 +78,7 @@ void propagator_test( interactor_state, resetter_state); // Create the propagator state typename propagator_device_t::state state( - tracks[gid], dev_det.get_bfield(), dev_det, - candidates.at(gid)); + tracks[gid], field_data, dev_det, candidates.at(gid)); state._stepping.set_tolerance(rk_tolerance); @@ -94,26 +93,21 @@ void propagator_test( } /// Explicit instantiation for a constant magnetic field -template void -propagator_test>( - detector_host_t::template detector_view_type< - bfield::const_bknd_t>, +template void propagator_test( + detector_host_t::view_type, covfie::field_view, vecmem::data::vector_view&, - vecmem::data::jagged_vector_view< - intersection_t>>&, + vecmem::data::jagged_vector_view>&, vecmem::data::jagged_vector_view&, vecmem::data::jagged_vector_view&, vecmem::data::jagged_vector_view&, detray::sycl::queue_wrapper); /// Explicit instantiation for an inhomogeneous magnetic field -/*template void propagator_test>( - detector_host_t::detector_view_type< - bfield::sycl::inhom_bknd_t>, +/*template void propagator_test( + detector_host_t::view_type, + covfie::field_view, vecmem::data::vector_view&, - vecmem::data::jagged_vector_view< - intersection_t>>&, + vecmem::data::jagged_vector_view>&, vecmem::data::jagged_vector_view&, vecmem::data::jagged_vector_view&, vecmem::data::jagged_vector_view&, diff --git a/tests/unit_tests/device/sycl/propagator_sycl_kernel.hpp b/tests/unit_tests/device/sycl/propagator_sycl_kernel.hpp index cedc4db9a..3fd35cd1a 100644 --- a/tests/unit_tests/device/sycl/propagator_sycl_kernel.hpp +++ b/tests/unit_tests/device/sycl/propagator_sycl_kernel.hpp @@ -19,7 +19,7 @@ namespace detray { /// Launch the propagation test kernel template void propagator_test( - typename detector_t::template detector_view_type, + typename detector_t::view_type, covfie::field_view, vecmem::data::vector_view &, vecmem::data::jagged_vector_view> &, vecmem::data::jagged_vector_view &, @@ -30,8 +30,9 @@ void propagator_test( template inline auto run_propagation_device( vecmem::memory_resource *mr, detector_t &det, - typename detector_t::template detector_view_type det_view, - sycl::queue_wrapper queue, dvector &tracks, + typename detector_t::view_type det_view, + covfie::field_view field_data, sycl::queue_wrapper queue, + dvector &tracks, const vecmem::jagged_vector &host_positions) -> std::tuple, vecmem::jagged_vector, @@ -68,8 +69,8 @@ inline auto run_propagation_device( // Run the propagator test for GPU device propagator_test( - det_view, tracks_data, candidates_buffer, path_lengths_buffer, - positions_buffer, jac_transports_buffer, queue); + det_view, field_data, tracks_data, candidates_buffer, + path_lengths_buffer, positions_buffer, jac_transports_buffer, queue); vecmem::jagged_vector device_path_lengths(mr); vecmem::jagged_vector device_positions(mr); @@ -85,10 +86,12 @@ inline auto run_propagation_device( } /// Test chain for the propagator -template -inline auto run_propagation_test( - vecmem::memory_resource *mr, ::sycl::queue *q, detector_t &det, - typename detector_t::template detector_view_type det_view) { +template +inline auto run_propagation_test(vecmem::memory_resource *mr, ::sycl::queue *q, + detector_t &det, + typename detector_t::view_type det_view, + covfie::field &field) { // Create the vector of initial track parameterizations auto tracks_host = generate_tracks(mr); @@ -96,14 +99,16 @@ inline auto run_propagation_test( // Host propagation auto &&[host_path_lengths, host_positions, host_jac_transports] = - run_propagation_host(mr, det, tracks_host); + run_propagation_host(mr, det, field, tracks_host); // Device propagation detray::sycl::queue_wrapper queue(q); + covfie::field device_field(field); auto &&[device_path_lengths, device_positions, device_jac_transports] = - run_propagation_device(mr, det, det_view, queue, - tracks_device, host_positions); + run_propagation_device( + mr, det, det_view, device_field, queue, tracks_device, + host_positions); // Check the results compare_propagation_results(host_positions, device_positions, diff --git a/tests/validation/include/detray/validation/helix_navigation.hpp b/tests/validation/include/detray/validation/helix_navigation.hpp index c7f38e994..a1c98d9c4 100644 --- a/tests/validation/include/detray/validation/helix_navigation.hpp +++ b/tests/validation/include/detray/validation/helix_navigation.hpp @@ -8,6 +8,7 @@ #pragma once // Project include(s) +#include "detray/detectors/bfield.hpp" #include "detray/intersection/detail/trajectories.hpp" #include "detray/propagator/actor_chain.hpp" #include "detray/propagator/actors/aborters.hpp" @@ -18,7 +19,6 @@ #include "detray/tracks/tracks.hpp" #include "detray/utils/inspectors.hpp" #include "detray/validation/detail/navigation_check_helper.hpp" -#include "tests/common/bfield.hpp" #include "tests/common/test_base/fixture_base.hpp" #include "tests/common/tools/particle_gun.hpp" @@ -100,7 +100,7 @@ class helix_navigation : public test::fixture_base<> { // Navigation with inspection using navigator_t = navigator; // Runge-Kutta stepper - using bfield_t = test::const_field_t; + using bfield_t = bfield::const_field_t; using stepper_t = rk_stepper; // Propagator with pathlimit aborter using actor_chain_t = actor_chain; @@ -113,7 +113,7 @@ class helix_navigation : public test::fixture_base<> { const typename fixture_type::point3 B{0.f * unit::T, 0.f * unit::T, 2.f * unit::T}; - bfield_t hom_bfield = test::create_const_field(B); + bfield_t hom_bfield = bfield::create_const_field(B); // Iterate through uniformly distributed momentum directions std::size_t n_tracks{0u}; diff --git a/tutorials/src/device/cuda/CMakeLists.txt b/tutorials/src/device/cuda/CMakeLists.txt index 408c1b692..ad1245b0e 100644 --- a/tutorials/src/device/cuda/CMakeLists.txt +++ b/tutorials/src/device/cuda/CMakeLists.txt @@ -26,6 +26,6 @@ detray_add_tutorial( propagation_cuda "propagation.cpp" "propagation.hpp" "propagation_kernel.cu" - LINK_LIBRARIES vecmem::cuda detray::core_array covfie::core + LINK_LIBRARIES vecmem::cuda detray::core_array covfie::core covfie::cuda detray::tutorial detray::utils) target_compile_definitions(detray_tutorial_propagation_cuda PRIVATE array=array) diff --git a/tutorials/src/device/cuda/detector_construction.cpp b/tutorials/src/device/cuda/detector_construction.cpp index a548b5602..481af92a7 100644 --- a/tutorials/src/device/cuda/detector_construction.cpp +++ b/tutorials/src/device/cuda/detector_construction.cpp @@ -8,6 +8,8 @@ // Project include(s) #include "detector_construction.hpp" +#include "detray/detectors/bfield.hpp" + // Vecmem include(s) #include #include @@ -93,7 +95,7 @@ int main() { vecmem::data::buffer_type::fixed_size); // Assemble the detector buffer - auto det_custom_buff = detray::detector_buffer( + auto det_custom_buff = typename decltype(det_host)::buffer_type( std::move(vol_buff), std::move(trf_buff), std::move(msk_buff), std::move(mat_buff), std::move(sf_buff), std::move(sf_lkp_buff), std::move(vgrid_buff)); diff --git a/tutorials/src/device/cuda/detector_construction.cu b/tutorials/src/device/cuda/detector_construction.cu index efab22e99..c9b52d09f 100644 --- a/tutorials/src/device/cuda/detector_construction.cu +++ b/tutorials/src/device/cuda/detector_construction.cu @@ -12,7 +12,7 @@ namespace detray::tutorial { /// Kernel that runs the entire propagation loop __global__ void print_kernel( - typename detray::tutorial::detector_host_t::detector_view_type det_data) { + typename detray::tutorial::detector_host_t::view_type det_data) { int gid = threadIdx.x + blockIdx.x * blockDim.x; @@ -41,8 +41,7 @@ __global__ void print_kernel( det.surface_store().get().size()); } -void print( - typename detray::tutorial::detector_host_t::detector_view_type det_data) { +void print(typename detray::tutorial::detector_host_t::view_type det_data) { // run the tutorial kernel print_kernel<<<1, 1>>>(det_data); diff --git a/tutorials/src/device/cuda/detector_construction.hpp b/tutorials/src/device/cuda/detector_construction.hpp index c0d92c3c4..7a4304d2e 100644 --- a/tutorials/src/device/cuda/detector_construction.hpp +++ b/tutorials/src/device/cuda/detector_construction.hpp @@ -8,7 +8,6 @@ #pragma once // Project include(s). -#include "detray/definitions/bfield_backends.hpp" #include "detray/definitions/units.hpp" #include "detray/detectors/create_toy_geometry.hpp" #include "detray/tutorial/types.hpp" @@ -24,6 +23,6 @@ using mask_id = typename detector_host_t::masks::id; using acc_id = typename detector_host_t::sf_finders::id; /// Detector construction tutorial function (prints some detector statistics) -void print(typename detector_host_t::detector_view_type det_data); +void print(typename detector_host_t::view_type det_data); } // namespace detray::tutorial diff --git a/tutorials/src/device/cuda/propagation.cpp b/tutorials/src/device/cuda/propagation.cpp index 173e3f4b8..0ab090dab 100644 --- a/tutorials/src/device/cuda/propagation.cpp +++ b/tutorials/src/device/cuda/propagation.cpp @@ -21,12 +21,14 @@ int main() { // VecMem memory resource(s) vecmem::cuda::managed_memory_resource mng_mr; - // Set the magnetic field vector - const auto B = - detray::tutorial::vector3{0. * detray::unit::T, - 0. * detray::unit::T, - 2. * detray::unit::T}; - auto bfield = test::create_const_field(B); + // Set the magnetic field + + // Define the name of the input file: use detray unittest data in this case + const std::string field_file = !std::getenv("DETRAY_BFIELD_FILE") + ? "" + : std::getenv("DETRAY_BFIELD_FILE"); + detray::tutorial::field_host_t bfield = + detray::io::read_bfield(field_file); // Create the toy geometry detray::toy_det_config toy_cfg{}; @@ -56,9 +58,13 @@ int main() { } // Get data for device - auto det_data = detray::get_data<>(det); + auto det_data = detray::get_data(det); auto tracks_data = detray::get_data(tracks); + // Get the device bfield + detray::tutorial::field_device_t device_field(bfield); + detray::tutorial::field_device_t::view_t device_field_view(device_field); + // Create navigator candidates buffer vecmem::copy copy; //< Helper object for performing memory copies. auto candidates_buffer = @@ -66,6 +72,6 @@ int main() { copy.setup(candidates_buffer); // Run the propagator test for GPU device - detray::tutorial::propagation(det_data, tracks_data, candidates_buffer, - field_view); + detray::tutorial::propagation(det_data, device_field_view, tracks_data, + candidates_buffer); } diff --git a/tutorials/src/device/cuda/propagation.hpp b/tutorials/src/device/cuda/propagation.hpp index a8e0dd7a7..452175abb 100644 --- a/tutorials/src/device/cuda/propagation.hpp +++ b/tutorials/src/device/cuda/propagation.hpp @@ -9,6 +9,7 @@ // Project include(s). #include "detray/definitions/units.hpp" +#include "detray/detectors/bfield.hpp" #include "detray/detectors/create_toy_geometry.hpp" #include "detray/propagator/actor_chain.hpp" #include "detray/propagator/actors/aborters.hpp" @@ -21,6 +22,9 @@ #include "detray/tracks/tracks.hpp" #include "detray/tutorial/types.hpp" +// Covfie include(s) +#include + namespace detray::tutorial { // Detector @@ -32,9 +36,18 @@ using detector_device_t = using navigator_t = navigator; using intersection_t = navigator_t::intersection_type; -// Stepper -using field_t = covfie::field; -using stepper_t = rk_stepper; +// Magnetic field types +using inhom_cuda_bknd_t = covfie::backend::affine< + covfie::backend::nearest_neighbour>>>>; +using field_host_t = covfie::field; +using field_device_t = covfie::field; + +// Stepper (only running device propagation, so need the device field type) +using stepper_t = + rk_stepper; // Actors using actor_chain_t = @@ -48,8 +61,8 @@ using propagator_t = propagator; /// Propagation tutorial function void propagation( - typename detector_host_t::detector_view_type det_data, - field_t::view_t field_view, + typename detector_host_t::view_type det_data, + covfie::field_view field_data, const vecmem::data::vector_view< free_track_parameters> tracks_data, diff --git a/tutorials/src/device/cuda/propagation_kernel.cu b/tutorials/src/device/cuda/propagation_kernel.cu index 433d0033d..832eff174 100644 --- a/tutorials/src/device/cuda/propagation_kernel.cu +++ b/tutorials/src/device/cuda/propagation_kernel.cu @@ -16,8 +16,8 @@ inline constexpr detray::scalar path_limit{2.f * /// Kernel that runs the entire propagation loop __global__ void propagation_kernel( - typename detray::tutorial::detector_host_t::detector_view_type det_data, - field_t::view_t field_view, + typename detray::tutorial::detector_host_t::view_type det_data, + covfie::field_view field_data, const vecmem::data::vector_view< detray::free_track_parameters> tracks_data, @@ -58,7 +58,7 @@ __global__ void propagation_kernel( interactor_state, resetter_state); // Create the propagator state for the track - detray::tutorial::propagator_t::state state(tracks[gid], field_view, det, + detray::tutorial::propagator_t::state state(tracks[gid], field_data, det, candidates.at(gid)); // Run propagation @@ -66,8 +66,8 @@ __global__ void propagation_kernel( } void propagation( - typename detray::tutorial::detector_host_t::detector_view_type det_data, - field_t::view_t field_view, + typename detray::tutorial::detector_host_t::view_type det_data, + covfie::field_view field_data, const vecmem::data::vector_view< detray::free_track_parameters> tracks_data, @@ -78,7 +78,7 @@ void propagation( int block_dim = tracks_data.size() / thread_dim + 1; // run the tutorial kernel - propagation_kernel<<>>(det_data, field_view, + propagation_kernel<<>>(det_data, field_data, tracks_data, candidates_data); // cuda error check diff --git a/tests/common/include/tests/common/bfield.hpp b/utils/include/detray/detectors/bfield.hpp similarity index 94% rename from tests/common/include/tests/common/bfield.hpp rename to utils/include/detray/detectors/bfield.hpp index 980a65683..0216913eb 100644 --- a/tests/common/include/tests/common/bfield.hpp +++ b/utils/include/detray/detectors/bfield.hpp @@ -8,6 +8,7 @@ #pragma once // Project include(s) +#include "detray/definitions/algebra.hpp" #include "detray/io/common/read_bfield.hpp" // Covfie include(s) @@ -17,7 +18,7 @@ #include #include -namespace detray::test { +namespace detray::bfield { /// Constant bfield (host and device) using const_bknd_t = @@ -48,4 +49,4 @@ inline inhom_field_t create_inhom_field() { : std::getenv("DETRAY_BFIELD_FILE")); } -} // namespace detray::test +} // namespace detray::bfield