From a917fbce958d0caff7b9f4d88ffb9cb13fe810ae Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Fri, 3 Nov 2023 13:42:24 +0100 Subject: [PATCH] Show the use of `pineappl_grid_bin_normalizations` --- examples/cpp/convolute-grid.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/cpp/convolute-grid.cpp b/examples/cpp/convolute-grid.cpp index dca50d45..699f6ddd 100644 --- a/examples/cpp/convolute-grid.cpp +++ b/examples/cpp/convolute-grid.cpp @@ -75,6 +75,13 @@ int main(int argc, char* argv[]) { pineappl_grid_convolute_with_one(grid, 2212, xfx, alphas, pdf, order_mask, channel_mask, xir, xif, dxsec.data()); + std::vector normalizations(bins); + + // read out the bin normalizations, which is usually the size of each bin + pineappl_grid_bin_normalizations(grid, normalizations.data()); + + std::cout << "idx left right dsig/dx dx\n"; + for (std::size_t bin = 0; bin != bins; ++bin) { // print the bin index std::cout << std::setw(3) << bin << ' '; @@ -87,8 +94,9 @@ int main(int argc, char* argv[]) { std::cout << std::setw(6) << left_limit << ' ' << std::setw(6) << right_limit << ' '; } - // print the result - std::cout << std::scientific << dxsec.at(bin) << std::defaultfloat << '\n'; + // print the result together with the normalization + std::cout << std::scientific << dxsec.at(bin) << std::defaultfloat << ' ' + << std::setw(6) << normalizations.at(bin) << '\n'; } pineappl_grid_delete(grid);