Skip to content

Commit

Permalink
Make 7 and 9-pt variation dependent on scales in grid
Browse files Browse the repository at this point in the history
  • Loading branch information
t7phy committed Oct 17, 2024
1 parent 9182bdb commit aeab8d2
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 36 deletions.
2 changes: 1 addition & 1 deletion pineappl/src/empty_subgrid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ impl Subgrid for EmptySubgridV1 {
#[cfg(test)]
mod tests {
use super::*;
use crate::packed_array::PackedArray;
use crate::import_subgrid::ImportSubgridV1;
use crate::packed_array::PackedArray;
use crate::v0;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion pineappl/src/evolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use super::boc::{Channel, Kinematics, Order};
use super::convolutions::ConvType;
use super::grid::{Grid, GridError};
use super::packed_array::PackedArray;
use super::import_subgrid::ImportSubgridV1;
use super::packed_array::PackedArray;
use super::pids::PidBasis;
use super::subgrid::{NodeValues, Subgrid, SubgridEnum};
use float_cmp::approx_eq;
Expand Down
4 changes: 2 additions & 2 deletions pineappl/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use super::convolutions::{Conv, ConvType, ConvolutionCache};
use super::empty_subgrid::EmptySubgridV1;
use super::evolution::{self, AlphasTable, EvolveInfo, OperatorSliceInfo};
use super::fk_table::FkTable;
use super::interpolation::Interp;
use super::interp_subgrid::InterpSubgridV1;
use super::import_subgrid::ImportSubgridV1;
use super::interp_subgrid::InterpSubgridV1;
use super::interpolation::Interp;
use super::pids::PidBasis;
use super::subgrid::{NodeValues, Subgrid, SubgridEnum};
use super::v0;
Expand Down
4 changes: 2 additions & 2 deletions pineappl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ pub mod empty_subgrid;
pub mod evolution;
pub mod fk_table;
pub mod grid;
pub mod interpolation;
pub mod import_subgrid;
pub mod interp_subgrid;
pub mod interpolation;
pub mod packed_array;
pub mod import_subgrid;
pub mod pids;
pub mod subgrid;
2 changes: 1 addition & 1 deletion pineappl/src/subgrid.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Module containing the trait `Subgrid` and supporting structs.
use super::empty_subgrid::EmptySubgridV1;
use super::interp_subgrid::InterpSubgridV1;
use super::import_subgrid::ImportSubgridV1;
use super::interp_subgrid::InterpSubgridV1;
use enum_dispatch::enum_dispatch;
// use float_cmp::approx_eq;
// use ndarray::Array3;
Expand Down
7 changes: 2 additions & 5 deletions pineappl/src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use super::boc::{Channel, Kinematics, Order, ScaleFuncForm, Scales};
use super::convolutions::{Conv, ConvType};
use super::empty_subgrid::EmptySubgridV1;
use super::grid::{Grid, GridError, Mmv4, MoreMembers};
use super::import_subgrid::ImportSubgridV1;
use super::interpolation::{Interp, InterpMeth, Map, ReweightMeth};
use super::packed_array::PackedArray;
use super::import_subgrid::ImportSubgridV1;
use super::pids::PidBasis;
use super::subgrid::{Mu2, NodeValues};
use ndarray::Array3;
Expand Down Expand Up @@ -162,10 +162,7 @@ pub fn read_uncompressed_v0(mut reader: impl BufRead) -> Result<Grid, GridError>
.into_iter()
.collect(),
interps: default_interps(convolutions.len()),
convolutions: convolutions
.into_iter()
.flatten()
.collect(),
convolutions: convolutions.into_iter().flatten().collect(),
pid_basis: grid
.key_values()
.and_then(|kv| kv.get("lumi_id_types"))
Expand Down
44 changes: 24 additions & 20 deletions pineappl_cli/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::GlobalConfiguration;
use anyhow::{anyhow, ensure, Context, Error, Result};
use lhapdf::{Pdf, PdfSet};
use ndarray::{Array3, Ix3};
use pineappl::boc::{ScaleFuncForm, Scales};
use pineappl::convolutions::{Conv, ConvType, ConvolutionCache};
use pineappl::grid::Grid;
use prettytable::format::{FormatBuilder, LinePosition, LineSeparator};
Expand Down Expand Up @@ -141,17 +142,17 @@ pub const SCALES_VECTOR_REN_FAC: [(f64, f64, f64); 9] = [
(0.5, 2.0, 1.0),
];

// const SCALES_VECTOR_REN_FRG: [(f64, f64, f64); 9] = [
// (1.0, 1.0, 1.0),
// (2.0, 1.0, 2.0),
// (0.5, 1.0, 0.5),
// (2.0, 1.0, 1.0),
// (1.0, 1.0, 2.0),
// (0.5, 1.0, 1.0),
// (1.0, 1.0, 0.5),
// (2.0, 1.0, 0.5),
// (0.5, 1.0, 2.0),
// ];
const SCALES_VECTOR_REN_FRG: [(f64, f64, f64); 9] = [
(1.0, 1.0, 1.0),
(2.0, 1.0, 2.0),
(0.5, 1.0, 0.5),
(2.0, 1.0, 1.0),
(1.0, 1.0, 2.0),
(0.5, 1.0, 1.0),
(1.0, 1.0, 0.5),
(2.0, 1.0, 0.5),
(0.5, 1.0, 2.0),
];

const SCALES_VECTOR_27: [(f64, f64, f64); 27] = [
(1.0, 1.0, 1.0),
Expand Down Expand Up @@ -348,15 +349,18 @@ pub fn convolve_scales(
}
}

pub fn scales_vector(_grid: &Grid, scales: usize) -> &[(f64, f64, f64)] {
match scales {
1 => &SCALES_VECTOR_27[0..1],
3 => &SCALES_VECTOR_27[0..3],
// TODO: fix 7 and 9 for cases where there is a fragmentation scale
7 => &SCALES_VECTOR_REN_FAC[0..7],
9 => &SCALES_VECTOR_REN_FAC[..],
17 => &SCALES_VECTOR_27[0..17],
27 => &SCALES_VECTOR_27[..],
pub fn scales_vector(grid: &Grid, scales: usize) -> &[(f64, f64, f64)] {
let Scales { fac, frg, .. } = grid.scales();

match (fac, frg, scales) {
(_, _, 1) => &SCALES_VECTOR_27[0..1],
(_, _, 3) => &SCALES_VECTOR_27[0..3],
(_, ScaleFuncForm::NoScale, 7) => &SCALES_VECTOR_REN_FAC[0..7],
(_, ScaleFuncForm::NoScale, 9) => &SCALES_VECTOR_REN_FAC[..],
(ScaleFuncForm::NoScale, _, 7) => &SCALES_VECTOR_REN_FRG[0..7],
(ScaleFuncForm::NoScale, _, 9) => &SCALES_VECTOR_REN_FRG[..],
(_, _, 17) => &SCALES_VECTOR_27[0..17],
(_, _, 27) => &SCALES_VECTOR_27[..],
_ => unreachable!(),
}
}
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 @@ -3,9 +3,9 @@ use lhapdf::Pdf;
use pineappl::boc::{Channel, Kinematics, Order, ScaleFuncForm, Scales};
use pineappl::convolutions::{Conv, ConvType};
use pineappl::grid::Grid;
use pineappl::import_subgrid::ImportSubgridV1;
use pineappl::interpolation::{Interp, InterpMeth, Map, ReweightMeth};
use pineappl::packed_array::PackedArray;
use pineappl::import_subgrid::ImportSubgridV1;
use pineappl::pids::PidBasis;
use pineappl::subgrid::{Mu2, NodeValues};
use pineappl_applgrid::ffi::{self, grid};
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 @@ -5,9 +5,9 @@ use pineappl::bin::BinRemapper;
use pineappl::boc::{Channel, Kinematics, Order, ScaleFuncForm, Scales};
use pineappl::convolutions::{Conv, ConvType};
use pineappl::grid::Grid;
use pineappl::import_subgrid::ImportSubgridV1;
use pineappl::interpolation::{Interp, InterpMeth, Map, ReweightMeth};
use pineappl::packed_array::PackedArray;
use pineappl::import_subgrid::ImportSubgridV1;
use pineappl::pids::PidBasis;
use pineappl::subgrid::{Mu2, NodeValues};
use pineappl_fastnlo::ffi::{
Expand Down
2 changes: 1 addition & 1 deletion pineappl_cli/src/import/fktable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use pineappl::boc::{Channel, Kinematics, Order, ScaleFuncForm, Scales};
use pineappl::channel;
use pineappl::convolutions::{Conv, ConvType};
use pineappl::grid::Grid;
use pineappl::import_subgrid::ImportSubgridV1;
use pineappl::interpolation::{Interp, InterpMeth, Map, ReweightMeth};
use pineappl::packed_array::PackedArray;
use pineappl::import_subgrid::ImportSubgridV1;
use pineappl::pids::PidBasis;
use pineappl::subgrid::NodeValues;
use std::fs::File;
Expand Down
4 changes: 3 additions & 1 deletion pineappl_cli/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,9 @@ 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], factors[4], 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

0 comments on commit aeab8d2

Please sign in to comment.