20 namespace AxisJsonConverter {
31 namespace GridJsonConverter {
39 template <
typename gr
id_type>
43 auto axes = grid.axes();
47 if constexpr (grid_type::DIM == 1
u) {
49 for (
unsigned int ib0 = 1u; ib0 <= axes[0
u]->getNBins(); ++ib0) {
50 typename grid_type::index_t lbin;
52 jData.push_back(std::tie(lbin, grid.atLocalBins(lbin)));
56 if constexpr (grid_type::DIM == 2
u) {
60 for (
unsigned int ib0 = 1u; ib0 <= axes[0
u]->getNBins(); ++ib0) {
61 for (
unsigned int ib1 = 1u; ib1 <= axes[1
u]->getNBins(); ++ib1) {
62 typename grid_type::index_t lbin;
65 jData.push_back(std::tie(lbin, grid.atLocalBins(lbin)));
69 jGrid[
"axes"] = jAxes;
70 jGrid[
"data"] = jData;
86 template <
typename axis_generator_type>
88 const axis_generator_type& aGenerator) {
90 using GridType =
typename axis_generator_type::template grid_type<
91 std::vector<std::size_t>>;
92 GridType
grid(aGenerator());
93 nlohmann::json jData = jGrid[
"data"];
95 if constexpr (GridType::DIM == 1
u) {
96 for (
const auto& jd : jData) {
97 std::array<std::size_t, 1u> lbin = jd[0
u];
98 std::vector<std::size_t>
values = jd[1
u];
99 grid.atLocalBins(lbin) =
values;
102 if constexpr (GridType::DIM == 2
u) {
103 for (
const auto& jd : jData) {
104 std::array<std::size_t, 2u> lbin = jd[0
u];
105 std::vector<std::size_t>
values = jd[1
u];
106 grid.atLocalBins(lbin) =
values;
117 {{Acts::detail::AxisBoundaryType::Bound,
"Bound"},
118 {Acts::detail::AxisBoundaryType::Open,
"Open"},
119 {Acts::detail::AxisBoundaryType::Closed,
123 {{Acts::detail::AxisType::Equidistant,
125 {Acts::detail::AxisType::Variable,
"Variable"}})