From cfeb189493503d8e28bdc117115b732c194c6293 Mon Sep 17 00:00:00 2001 From: Joana Niermann Date: Fri, 13 Dec 2024 16:27:15 +0100 Subject: [PATCH] Update ITk metadata and add ODD specific metadata --- .../detray/builders/material_map_builder.hpp | 31 ++- .../detray/detectors/default_metadata.hpp | 232 ++++++++++-------- .../include/detray/detectors/itk_metadata.hpp | 136 +++++----- .../include/detray/detectors/odd_metadata.hpp | 190 ++++++++++++++ .../detray/detectors/telescope_metadata.hpp | 60 +++-- .../include/detray/detectors/toy_metadata.hpp | 126 +++++----- 6 files changed, 524 insertions(+), 251 deletions(-) create mode 100644 detectors/include/detray/detectors/odd_metadata.hpp diff --git a/core/include/detray/builders/material_map_builder.hpp b/core/include/detray/builders/material_map_builder.hpp index b994c7e71..28bb67dee 100644 --- a/core/include/detray/builders/material_map_builder.hpp +++ b/core/include/detray/builders/material_map_builder.hpp @@ -246,21 +246,26 @@ struct add_sf_material_map { // The detector only knows the non-owning grid types using non_owning_t = typename decltype(mat_grid)::template type; - static_assert(materials_t::template is_defined()); - // Add the material slabs to the grid - for (const auto& bin : bin_data) { - mat_grid.template populate>(bin.local_bin_idx, - bin.single_element); + // Not every mask shape might be used for material maps + if constexpr (materials_t::template is_defined()) { + // Add the material slabs to the grid + for (const auto& bin : bin_data) { + mat_grid.template populate>(bin.local_bin_idx, + bin.single_element); + } + + // Add the material grid to the detector + constexpr auto gid{ + materials_t::template get_id()}; + mat_store.template push_back(mat_grid); + + // Return the index of the new material map + return {gid, static_cast( + mat_store.template size() - 1u)}; + } else { + return {materials_t::id::e_none, dindex_invalid}; } - - // Add the material grid to the detector - constexpr auto gid{materials_t::template get_id()}; - mat_store.template push_back(mat_grid); - - // Return the index of the new material map - return {gid, - static_cast(mat_store.template size() - 1u)}; } else { return {materials_t::id::e_none, dindex_invalid}; } diff --git a/detectors/include/detray/detectors/default_metadata.hpp b/detectors/include/detray/detectors/default_metadata.hpp index 1a0f3158a..317e55c13 100644 --- a/detectors/include/detray/detectors/default_metadata.hpp +++ b/detectors/include/detray/detectors/default_metadata.hpp @@ -37,6 +37,15 @@ struct default_metadata { /// Mask-to-(next)-volume link (potentially switchable for SoA) using nav_link = std::uint_least16_t; + /// How to store coordinate transform matrices + template