Skip to content

Commit

Permalink
Show the use of pineappl_grid_bin_normalizations
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwan committed Nov 3, 2023
1 parent ed3fc6a commit a917fbc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions examples/cpp/convolute-grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double> 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 << ' ';
Expand All @@ -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);
Expand Down

0 comments on commit a917fbc

Please sign in to comment.