diff --git a/pineappl_cli/src/import.rs b/pineappl_cli/src/import.rs index cf6a6ff0..7fb77871 100644 --- a/pineappl_cli/src/import.rs +++ b/pineappl_cli/src/import.rs @@ -51,7 +51,6 @@ fn convert_fastnlo( alpha: u32, conv_funs: &ConvFuns, member: usize, - dis_pid: i32, scales: usize, fnlo_mur: Option<&str>, fnlo_muf: Option<&str>, @@ -79,7 +78,7 @@ fn convert_fastnlo( } } - let grid = fastnlo::convert_fastnlo_table(&file, alpha, dis_pid)?; + let grid = fastnlo::convert_fastnlo_table(&file, alpha)?; let mut reader = ffi::downcast_lhapdf_to_reader_mut(file.as_mut().unwrap()); // TODO: scale-variation log conversion is only enabled for flex grids @@ -121,7 +120,6 @@ fn convert_fastnlo( _: u32, _: &ConvFuns, _: usize, - _: i32, _: usize, _: Option<&str>, _: Option<&str>, @@ -151,7 +149,6 @@ fn convert_grid( conv_funs: &mut [Pdf], fun_names: &ConvFuns, member: usize, - dis_pid: i32, scales: usize, fnlo_mur: Option<&str>, fnlo_muf: Option<&str>, @@ -164,9 +161,7 @@ fn convert_grid( .extension() .map_or(false, |ext| ext == "tab")) { - return convert_fastnlo( - input, alpha, fun_names, member, dis_pid, scales, fnlo_mur, fnlo_muf, - ); + return convert_fastnlo(input, alpha, fun_names, member, scales, fnlo_mur, fnlo_muf); } else if extension == "dat" { return convert_fktable(input); } else if extension == "appl" || extension == "root" { @@ -245,9 +240,6 @@ pub struct Opts { /// Do not optimize converted grid. #[arg(long)] no_optimize: bool, - /// Particle ID for the non-hadronic initial states if it cannot be determined from the grid. - #[arg(long, default_value_t = 11)] - dis_pid: i32, } impl Subcommand for Opts { @@ -263,7 +255,6 @@ impl Subcommand for Opts { &mut conv_funs, &self.conv_funs, 0, - self.dis_pid, self.scales, self.fnlo_mur.as_deref(), self.fnlo_muf.as_deref(), diff --git a/pineappl_cli/src/import/fastnlo.rs b/pineappl_cli/src/import/fastnlo.rs index 34d14fab..e4a219af 100644 --- a/pineappl_cli/src/import/fastnlo.rs +++ b/pineappl_cli/src/import/fastnlo.rs @@ -27,10 +27,9 @@ fn pid_to_pdg_id(pid: i32) -> i32 { fn reconstruct_channels( table: &fastNLOCoeffAddBase, comb: &fastNLOPDFLinearCombinations, - dis_pid: i32, ) -> Vec { - let dis_pid = if table.GetNPDF() == 2 { 0 } else { dis_pid }; let mut channels = Vec::new(); + let npdf = table.GetNPDF(); // if there's a (non-empty) PDF coefficient vector reconstruct the channels; the advantage is // that we preserve the order of the channels in the PineAPPL grid @@ -38,15 +37,13 @@ fn reconstruct_channels( let mut entries = Vec::new(); for entry in ffi::GetPDFCoeff(table, pdf_entry) { - let a = pid_to_pdg_id(entry.first); - let b = if dis_pid == 0 { - pid_to_pdg_id(entry.second) - } else { - dis_pid - }; - let f = 1.0; + let mut pids = vec![pid_to_pdg_id(entry.first)]; + + if npdf == 2 { + pids.push(pid_to_pdg_id(entry.second)); + } - entries.push((vec![a, b], f)); + entries.push((pids, 1.0)); } channels.push(Channel::new(entries)); @@ -54,6 +51,8 @@ fn reconstruct_channels( // if the PDF coefficient vector was empty, we must reconstruct the channels in a different way if channels.is_empty() { + assert_eq!(npdf, 2); + let nsubproc = table.GetNSubproc().try_into().unwrap(); let mut xfx1 = [0.0; 13]; @@ -96,7 +95,6 @@ fn convert_coeff_add_fix( comb: &fastNLOPDFLinearCombinations, bins: usize, alpha: u32, - dis_pid: i32, ) -> Grid { let table_as_add_base = ffi::downcast_coeff_add_fix_to_base(table); @@ -109,7 +107,7 @@ fn convert_coeff_add_fix( let mut grid = Grid::new( PidBasis::Pdg, - reconstruct_channels(table_as_add_base, comb, dis_pid), + reconstruct_channels(table_as_add_base, comb), vec![Order { alphas: table_as_add_base.GetNpow().try_into().unwrap(), alpha, @@ -122,37 +120,64 @@ fn convert_coeff_add_fix( .collect(), convolutions, // TODO: read out interpolation parameters from fastNLO - vec![ - Interp::new( - 1e2, - 1e8, - 40, - 3, - ReweightMeth::NoReweight, - Map::ApplGridH0, - InterpMeth::Lagrange, - ), - Interp::new( - 2e-7, - 1.0, - 50, - 3, - ReweightMeth::ApplGridX, - Map::ApplGridF2, - InterpMeth::Lagrange, - ), - Interp::new( - 2e-7, - 1.0, - 50, - 3, - ReweightMeth::ApplGridX, - Map::ApplGridF2, - InterpMeth::Lagrange, - ), - ], + if npdf == 2 { + vec![ + Interp::new( + 1e2, + 1e8, + 40, + 3, + ReweightMeth::NoReweight, + Map::ApplGridH0, + InterpMeth::Lagrange, + ), + Interp::new( + 2e-7, + 1.0, + 50, + 3, + ReweightMeth::ApplGridX, + Map::ApplGridF2, + InterpMeth::Lagrange, + ), + Interp::new( + 2e-7, + 1.0, + 50, + 3, + ReweightMeth::ApplGridX, + Map::ApplGridF2, + InterpMeth::Lagrange, + ), + ] + } else { + vec![ + Interp::new( + 1e2, + 1e8, + 40, + 3, + ReweightMeth::NoReweight, + Map::ApplGridH0, + InterpMeth::Lagrange, + ), + Interp::new( + 2e-7, + 1.0, + 50, + 3, + ReweightMeth::ApplGridX, + Map::ApplGridF2, + InterpMeth::Lagrange, + ), + ] + }, // TODO: change kinematics for DIS - vec![Kinematics::Scale(0), Kinematics::X1, Kinematics::X2], + if npdf == 2 { + vec![Kinematics::Scale(0), Kinematics::X1, Kinematics::X2] + } else { + vec![Kinematics::Scale(0), Kinematics::X1] + }, Scales { ren: ScaleFuncForm::Scale(0), fac: ScaleFuncForm::Scale(0), @@ -265,7 +290,6 @@ fn convert_coeff_add_flex( _bins: usize, _alpha: u32, _ipub_units: i32, - _dis_pid: i32, ) -> Grid { todo!() @@ -459,7 +483,7 @@ fn convert_coeff_add_flex( // grid } -pub fn convert_fastnlo_table(file: &fastNLOLHAPDF, alpha: u32, dis_pid: i32) -> Result { +pub fn convert_fastnlo_table(file: &fastNLOLHAPDF, alpha: u32) -> Result { let file_as_reader = ffi::downcast_lhapdf_to_reader(file); let file_as_table = ffi::downcast_lhapdf_to_table(file); @@ -500,7 +524,6 @@ pub fn convert_fastnlo_table(file: &fastNLOLHAPDF, alpha: u32, dis_pid: i32) -> bins, alpha, file_as_table.GetIpublunits(), - dis_pid, )); } } else { @@ -509,7 +532,6 @@ pub fn convert_fastnlo_table(file: &fastNLOLHAPDF, alpha: u32, dis_pid: i32) -> linear_combinations, bins, alpha, - dis_pid, )); } } diff --git a/pineappl_cli/tests/import.rs b/pineappl_cli/tests/import.rs index 25b0d1a0..1e0d6d94 100644 --- a/pineappl_cli/tests/import.rs +++ b/pineappl_cli/tests/import.rs @@ -22,7 +22,6 @@ Options: --digits-abs Set the number of fractional digits shown for absolute numbers [default: 7] --digits-rel Set the number of fractional digits shown for relative numbers [default: 7] --no-optimize Do not optimize converted grid - --dis-pid Particle ID for the non-hadronic initial states if it cannot be determined from the grid [default: 11] -h, --help Print help "; @@ -45,7 +44,6 @@ Options: --digits-abs Set the number of fractional digits shown for absolute numbers [default: 7] --digits-rel Set the number of fractional digits shown for relative numbers [default: 7] --no-optimize Do not optimize converted grid - --dis-pid Particle ID for the non-hadronic initial states if it cannot be determined from the grid [default: 11] -h, --help Print help ";