Skip to content

Commit

Permalink
Add fragmentation scaling factor to Grid::scale_by_order
Browse files Browse the repository at this point in the history
  • Loading branch information
t7phy committed Oct 17, 2024
1 parent e4604f3 commit 4e0214c
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 33 deletions.
4 changes: 3 additions & 1 deletion pineappl/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ impl Grid {
alpha: f64,
logxir: f64,
logxif: f64,
logxia: f64,
global: f64,
) {
for ((i, _, _), subgrid) in self.subgrids.indexed_iter_mut() {
Expand All @@ -749,7 +750,8 @@ impl Grid {
* alphas.powi(order.alphas.try_into().unwrap())
* alpha.powi(order.alpha.try_into().unwrap())
* logxir.powi(order.logxir.try_into().unwrap())
* logxif.powi(order.logxif.try_into().unwrap());
* logxif.powi(order.logxif.try_into().unwrap())
* logxia.powi(order.logxia.try_into().unwrap());

subgrid.scale(factor);
}
Expand Down
4 changes: 2 additions & 2 deletions pineappl/tests/drell_yan_lo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ fn perform_grid_tests(
let mut grid = Grid::read(&mut file)?;

// TEST 4: `scale_by_order`
grid.scale_by_order(10.0, 0.5, 10.0, 10.0, 1.0);
grid.scale_by_order(10.0, 1.0, 10.0, 10.0, 4.0);
grid.scale_by_order(10.0, 0.5, 10.0, 10.0, 1.0, 1.0);
grid.scale_by_order(10.0, 1.0, 10.0, 10.0, 1.0, 4.0);

// TEST 5: `convolve`
let mut convolution_cache = ConvolutionCache::new(
Expand Down
2 changes: 1 addition & 1 deletion pineappl_capi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ pub unsafe extern "C" fn pineappl_grid_scale_by_order(
) {
let grid = unsafe { &mut *grid };

grid.scale_by_order(alphas, alpha, logxir, logxif, global);
grid.scale_by_order(alphas, alpha, logxir, logxif, 1.0, global);
}

/// Return the value for `key` stored in `grid`. If `key` isn't found, `NULL` will be returned.
Expand Down
2 changes: 1 addition & 1 deletion pineappl_cli/src/import/applgrid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ pub fn convert_applgrid(grid: Pin<&mut grid>, alpha: u32) -> Result<Grid> {
}
}

grid0.scale_by_order(alphas_factor, 1.0, 1.0, 1.0, global);
grid0.scale_by_order(alphas_factor, 1.0, 1.0, 1.0, 1.0, global);

Ok(grid0)
}
Expand Down
2 changes: 1 addition & 1 deletion pineappl_cli/src/import/fastnlo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ pub fn convert_fastnlo_table(file: &fastNLOLHAPDF, alpha: u32) -> Result<Grid> {
result.merge(grid)?;
}

result.scale_by_order(1.0 / TAU, 1.0, 1.0, 1.0, 1.0);
result.scale_by_order(1.0 / TAU, 1.0, 1.0, 1.0, 1.0, 1.0);

let dimensions: usize = file_as_table.GetNumDiffBin().try_into().unwrap();
let mut limits = Vec::new();
Expand Down
6 changes: 3 additions & 3 deletions pineappl_cli/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,11 @@ impl Args for MoreArgs {
.arg(
Arg::new("scale_by_order")
.action(ArgAction::Append)
.help("Scales all grids with order-dependent factors")
.help("Scale subgrids with order-dependent factors")
.long("scale-by-order")
.num_args(1)
.value_delimiter(',')
.value_name("AS,AL,LR,LF")
.value_name("FAC1,FAC2,...")
.value_parser(value_parser!(f64)),
)
.arg(
Expand Down Expand Up @@ -581,7 +581,7 @@ impl Subcommand for Opts {
}
OpsArg::ScaleByBin(factors) => grid.scale_by_bin(factors),
OpsArg::ScaleByOrder(factors) => {
grid.scale_by_order(factors[0], factors[1], factors[2], factors[3], 1.0);
grid.scale_by_order(factors[0], factors[1], factors[2], factors[3], factors[4], 1.0);
}
OpsArg::SetKeyValue(key_value) => {
grid.metadata_mut()
Expand Down
48 changes: 24 additions & 24 deletions pineappl_cli/tests/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ Arguments:
<OUTPUT> Path of the modified PineAPPL file
Options:
--cc <IDX> Charge conjugate the convolution with the specified index
--dedup-channels[=<ULPS>] Deduplicate channels assuming numbers differing by ULPS are the same
--delete-bins <BIN1-BIN2,...> Delete bins with the specified indices
--delete-channels <CH1-CH2,...> Delete channels with the specified indices
--delete-orders <O1-O2,...> Delete orders with the specified indices
--delete-key <KEY> Delete an internal key-value pair
--merge-bins <BIN1-BIN2,...> Merge specific bins together
--optimize[=<ENABLE>] Optimize internal data structure to minimize memory and disk usage [possible values: true, false]
--optimize-fk-table <OPTIMI> Optimize internal data structure of an FkTable to minimize memory and disk usage [possible values: Nf6Ind, Nf6Sym, Nf5Ind, Nf5Sym, Nf4Ind, Nf4Sym, Nf3Ind, Nf3Sym]
--remap <REMAPPING> Modify the bin dimensions and widths
--remap-norm <NORM> Modify the bin normalizations with a common factor
--remap-norm-ignore <DIM1,...> Modify the bin normalizations by multiplying with the bin lengths for the given dimensions
--rewrite-channel <IDX> <CHAN> Rewrite the definition of the channel with index IDX
--rewrite-order <IDX> <ORDER> Rewrite the definition of the order with index IDX
--rotate-pid-basis <BASIS> Rotate the PID basis for this grid [possible values: PDG, EVOL]
-s, --scale <SCALE> Scales all grids with the given factor
--scale-by-bin <BIN1,BIN2,...> Scale each bin with a different factor
--scale-by-order <AS,AL,LR,LF> Scales all grids with order-dependent factors
--set-key-value <KEY> <VALUE> Set an internal key-value pair
--set-key-file <KEY> <FILE> Set an internal key-value pair, with value being read from a file
--split-channels[=<ENABLE>] Split the grid such that each channel contains only a single PID combination [possible values: true, false]
--upgrade[=<ENABLE>] Convert the file format to the most recent version [possible values: true, false]
-h, --help Print help
--cc <IDX> Charge conjugate the convolution with the specified index
--dedup-channels[=<ULPS>] Deduplicate channels assuming numbers differing by ULPS are the same
--delete-bins <BIN1-BIN2,...> Delete bins with the specified indices
--delete-channels <CH1-CH2,...> Delete channels with the specified indices
--delete-orders <O1-O2,...> Delete orders with the specified indices
--delete-key <KEY> Delete an internal key-value pair
--merge-bins <BIN1-BIN2,...> Merge specific bins together
--optimize[=<ENABLE>] Optimize internal data structure to minimize memory and disk usage [possible values: true, false]
--optimize-fk-table <OPTIMI> Optimize internal data structure of an FkTable to minimize memory and disk usage [possible values: Nf6Ind, Nf6Sym, Nf5Ind, Nf5Sym, Nf4Ind, Nf4Sym, Nf3Ind, Nf3Sym]
--remap <REMAPPING> Modify the bin dimensions and widths
--remap-norm <NORM> Modify the bin normalizations with a common factor
--remap-norm-ignore <DIM1,...> Modify the bin normalizations by multiplying with the bin lengths for the given dimensions
--rewrite-channel <IDX> <CHAN> Rewrite the definition of the channel with index IDX
--rewrite-order <IDX> <ORDER> Rewrite the definition of the order with index IDX
--rotate-pid-basis <BASIS> Rotate the PID basis for this grid [possible values: PDG, EVOL]
-s, --scale <SCALE> Scales all grids with the given factor
--scale-by-bin <BIN1,BIN2,...> Scale each bin with a different factor
--scale-by-order <FAC1,FAC2,...> Scale subgrids with order-dependent factors
--set-key-value <KEY> <VALUE> Set an internal key-value pair
--set-key-file <KEY> <FILE> Set an internal key-value pair, with value being read from a file
--split-channels[=<ENABLE>] Split the grid such that each channel contains only a single PID combination [possible values: true, false]
--upgrade[=<ENABLE>] Convert the file format to the most recent version [possible values: true, false]
-h, --help Print help
";

const CHANNEL_STR: &str = "c entry entry
Expand Down Expand Up @@ -771,7 +771,7 @@ fn scale_by_order() {
.unwrap()
.args([
"write",
"--scale-by-order=2,1,0.5,0.5",
"--scale-by-order=2,1,0.5,0.5,1.0",
"--scale=0.5",
"../test-data/LHCB_WP_7TEV_opt.pineappl.lz4",
output.path().to_str().unwrap(),
Expand Down

0 comments on commit 4e0214c

Please sign in to comment.