Skip to content

Commit

Permalink
Revert xgrid calculation displacement
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido authored and cschwan committed Oct 3, 2022
1 parent ad22780 commit 96e4661
Showing 1 changed file with 34 additions and 40 deletions.
74 changes: 34 additions & 40 deletions pineappl/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1531,46 +1531,6 @@ impl Grid {
})
.collect();

// the x1 and x2 grid values are the same across all non-zero subgrids
let first_non_zero_grid = self
.subgrids
.iter()
.find(|subgrid| !subgrid.is_empty())
.unwrap_or_else(|| unreachable!());
// source x1/x2 grid might differ and be differently sorted than the operator
let x1_grid = if has_pdf1 {
first_non_zero_grid
.x1_grid()
.iter()
.map(|x| {
eko_info
.grid_axes
.x_grid
.iter()
.position(|xi| approx_eq!(f64, *xi, *x, ulps = 64))
.unwrap_or_else(|| unreachable!())
})
.collect()
} else {
Vec::new()
};
let x2_grid = if has_pdf2 {
first_non_zero_grid
.x2_grid()
.iter()
.map(|x| {
eko_info
.grid_axes
.x_grid
.iter()
.position(|xi| approx_eq!(f64, *xi, *x, ulps = 64))
.unwrap_or_else(|| unreachable!())
})
.collect()
} else {
Vec::new()
};

// iterate over all bins, which are mapped one-to-one from the target to the source grid
for bin in 0..self.bin_info().bins() {
// iterate over the source grid luminosities
Expand Down Expand Up @@ -1619,6 +1579,40 @@ impl Grid {

let src_subgrid = &self.subgrids[[order, bin, src_lumi]];

// source x1/x2 grid might differ and be differently sorted than the operator
let x1_grid = if has_pdf1 {
src_subgrid
.x1_grid()
.iter()
.map(|x| {
eko_info
.grid_axes
.x_grid
.iter()
.position(|xi| approx_eq!(f64, *xi, *x, ulps = 64))
.unwrap_or_else(|| unreachable!())
})
.collect()
} else {
Vec::new()
};
let x2_grid = if has_pdf2 {
src_subgrid
.x2_grid()
.iter()
.map(|x| {
eko_info
.grid_axes
.x_grid
.iter()
.position(|xi| approx_eq!(f64, *xi, *x, ulps = 64))
.unwrap_or_else(|| unreachable!())
})
.collect()
} else {
Vec::new()
};

for ((iq2, ix1, ix2), &value) in src_subgrid.iter() {
let scale = src_subgrid.mu2_grid()[iq2].fac;
let src_iq2 = src_array_q2_grid
Expand Down

0 comments on commit 96e4661

Please sign in to comment.