Skip to content

Commit

Permalink
Add missing force_positive parameter to convolute_subgrid
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwan committed Feb 23, 2024
1 parent af80b17 commit b52c8ce
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
5 changes: 5 additions & 0 deletions pineappl_cli/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ pub fn convolute_subgrid(
order: usize,
bin: usize,
lumi: usize,
force_positive: bool,
) -> Array3<f64> {
// if the field 'Particle' is missing we assume it's a proton PDF
let pdf_pdg_id = lhapdf
Expand All @@ -260,6 +261,10 @@ pub fn convolute_subgrid(
.map_or(Ok(2212), |string| string.parse::<i32>())
.unwrap();

if force_positive {
lhapdf.set_force_positive(1);
}

let x_max = lhapdf.x_max();
let x_min = lhapdf.x_min();
let mut pdf = |id, x, q2| {
Expand Down
22 changes: 18 additions & 4 deletions pineappl_cli/src/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,24 @@ impl Subcommand for Opts {
unc1.hypot(unc2)
};

let res1 = helpers::convolute_subgrid(&grid, &mut pdfset1[0], order, bin, lumi)
.sum_axis(Axis(0));
let res2 = helpers::convolute_subgrid(&grid, &mut pdfset2[0], order, bin, lumi)
.sum_axis(Axis(0));
let res1 = helpers::convolute_subgrid(
&grid,
&mut pdfset1[0],
order,
bin,
lumi,
cfg.force_positive,
)
.sum_axis(Axis(0));
let res2 = helpers::convolute_subgrid(
&grid,
&mut pdfset2[0],
order,
bin,
lumi,
cfg.force_positive,
)
.sum_axis(Axis(0));

let subgrid = grid.subgrid(order, bin, lumi);
//let q2 = subgrid.q2_grid();
Expand Down

0 comments on commit b52c8ce

Please sign in to comment.