Skip to content

Commit

Permalink
Allow varying the scales in convolve
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwan committed Nov 5, 2024
1 parent cbe04a4 commit 3944662
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- added new method `Grid::delete_orders` and the corresponding switch
`--delete-orders` in the subcommand `write` of the CLI
- added the switches `--xir` and `--xif`, which allow varying the
renormalization and factorization scales with a custom factor in the
subcommand `convolve`.

### Changed

Expand Down
10 changes: 8 additions & 2 deletions pineappl_cli/src/convolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ pub struct Opts {
value_parser = helpers::parse_order
)]
orders: Vec<(u32, u32)>,
/// Set the variation of the renormalization scale.
#[arg(default_value = "1.0", long, num_args = 1)]
xir: f64,
/// Set the variation of the factorization scale.
#[arg(default_value = "1.0", long, num_args = 1)]
xif: f64,
/// Set the number of fractional digits shown for absolute numbers.
#[arg(default_value_t = 7, long, value_name = "ABS")]
digits_abs: usize,
Expand All @@ -52,13 +58,13 @@ impl Subcommand for Opts {
let mut conv_funs_0 = helpers::create_conv_funs(&self.conv_funs[0])?;
let bins: Vec<_> = self.bins.iter().cloned().flatten().collect();

let results = helpers::convolve(
let results = helpers::convolve_scales(
&grid,
&mut conv_funs_0,
&self.orders,
&bins,
&[],
1,
&[(self.xir, self.xif)],
if self.integrated {
ConvoluteMode::Integrated
} else {
Expand Down
31 changes: 31 additions & 0 deletions pineappl_cli/tests/convolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Options:
-b, --bins <BINS> Selects a subset of bins
-i, --integrated Show integrated numbers (without bin widths) instead of differential ones
-o, --orders <ORDERS> Select orders manually
--xir <XIR> Set the variation of the renormalization scale [default: 1.0]
--xif <XIF> Set the variation of the factorization scale [default: 1.0]
--digits-abs <ABS> Set the number of fractional digits shown for absolute numbers [default: 7]
--digits-rel <REL> Set the number of fractional digits shown for relative numbers [default: 2]
-h, --help Print help
Expand Down Expand Up @@ -171,6 +173,19 @@ const WRONG_ORDERS_STR: &str = "error: invalid value 'a2a2as2' for '--orders <OR
For more information, try '--help'.
";

const XIR_XIF_STR: &str = "b etal dsig/detal
[] [pb]
-+----+----+-----------
0 2 2.25 7.6241231e2
1 2.25 2.5 6.9755130e2
2 2.5 2.75 6.0636076e2
3 2.75 3 4.9019741e2
4 3 3.25 3.6518490e2
5 3.25 3.5 2.4783934e2
6 3.5 4 1.1656958e2
7 4 4.5 2.7565811e1
";

#[test]
fn help() {
Command::cargo_bin("pineappl")
Expand Down Expand Up @@ -392,3 +407,19 @@ fn wrong_orders() {
.failure()
.stderr(WRONG_ORDERS_STR);
}

#[test]
fn xir_xif() {
Command::cargo_bin("pineappl")
.unwrap()
.args([
"convolve",
"--xir=2.34",
"--xif=1.79",
"../test-data/LHCB_WP_7TEV_opt.pineappl.lz4",
"NNPDF31_nlo_as_0118_luxqed",
])
.assert()
.success()
.stdout(XIR_XIF_STR);
}

0 comments on commit 3944662

Please sign in to comment.