diff --git a/pineappl/src/empty_subgrid.rs b/pineappl/src/empty_subgrid.rs index 0f7db160..907d10cb 100644 --- a/pineappl/src/empty_subgrid.rs +++ b/pineappl/src/empty_subgrid.rs @@ -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] diff --git a/pineappl/src/evolution.rs b/pineappl/src/evolution.rs index 7a865894..0669dc8a 100644 --- a/pineappl/src/evolution.rs +++ b/pineappl/src/evolution.rs @@ -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; diff --git a/pineappl/src/grid.rs b/pineappl/src/grid.rs index 1bc73a81..bc3f1bd9 100644 --- a/pineappl/src/grid.rs +++ b/pineappl/src/grid.rs @@ -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; diff --git a/pineappl/src/lib.rs b/pineappl/src/lib.rs index ac05684c..f225dff0 100644 --- a/pineappl/src/lib.rs +++ b/pineappl/src/lib.rs @@ -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; diff --git a/pineappl/src/subgrid.rs b/pineappl/src/subgrid.rs index cb3bc91c..aefad922 100644 --- a/pineappl/src/subgrid.rs +++ b/pineappl/src/subgrid.rs @@ -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; diff --git a/pineappl/src/v0.rs b/pineappl/src/v0.rs index 0d45d643..b601ecf9 100644 --- a/pineappl/src/v0.rs +++ b/pineappl/src/v0.rs @@ -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; @@ -162,10 +162,7 @@ pub fn read_uncompressed_v0(mut reader: impl BufRead) -> Result .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")) diff --git a/pineappl_cli/src/helpers.rs b/pineappl_cli/src/helpers.rs index 747d5aaa..14a82383 100644 --- a/pineappl_cli/src/helpers.rs +++ b/pineappl_cli/src/helpers.rs @@ -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}; @@ -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), @@ -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!(), } } diff --git a/pineappl_cli/src/import/applgrid.rs b/pineappl_cli/src/import/applgrid.rs index 66fc2842..a3c03224 100644 --- a/pineappl_cli/src/import/applgrid.rs +++ b/pineappl_cli/src/import/applgrid.rs @@ -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}; diff --git a/pineappl_cli/src/import/fastnlo.rs b/pineappl_cli/src/import/fastnlo.rs index 82691d3f..0b3a260f 100644 --- a/pineappl_cli/src/import/fastnlo.rs +++ b/pineappl_cli/src/import/fastnlo.rs @@ -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::{ diff --git a/pineappl_cli/src/import/fktable.rs b/pineappl_cli/src/import/fktable.rs index 5517bc1a..d4bce61f 100644 --- a/pineappl_cli/src/import/fktable.rs +++ b/pineappl_cli/src/import/fktable.rs @@ -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; diff --git a/pineappl_cli/src/write.rs b/pineappl_cli/src/write.rs index 20af0a85..8435a551 100644 --- a/pineappl_cli/src/write.rs +++ b/pineappl_cli/src/write.rs @@ -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()