Skip to content

Commit

Permalink
Revert unintended changes from commit cb937f
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwan committed Aug 19, 2024
1 parent 67265c9 commit efdabd4
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 87 deletions.
5 changes: 0 additions & 5 deletions pineappl/src/empty_subgrid.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! TODO

use super::grid::Grid;
use super::subgrid::{Mu2, Stats, Subgrid, SubgridEnum, SubgridIndexedIter};
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
Expand All @@ -11,10 +10,6 @@ use std::iter;
pub struct EmptySubgridV1;

impl Subgrid for EmptySubgridV1 {
fn nodes(&self, _: &Grid) -> Cow<[Vec<f64>]> {
Cow::Borrowed(&[])
}

fn fill(&mut self, _: &[f64], _: f64) {
panic!("EmptySubgridV1 doesn't support the fill operation");
}
Expand Down
18 changes: 1 addition & 17 deletions pineappl/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use super::lagrange_subgrid::LagrangeSubgridV2;
use super::packed_array::PackedArray;
use super::packed_subgrid::PackedQ1X2SubgridV1;
use super::pids::{self, PidBasis};
use super::subgrid::{ExtraSubgridParams, Kinematics, Mu2, Subgrid, SubgridEnum, SubgridParams};
use super::subgrid::{ExtraSubgridParams, Mu2, Subgrid, SubgridEnum, SubgridParams};
use bitflags::bitflags;
use float_cmp::approx_eq;
use git_version::git_version;
Expand Down Expand Up @@ -149,7 +149,6 @@ pub struct Grid {
metadata: BTreeMap<String, String>,
convolutions: Vec<Convolution>,
pid_basis: PidBasis,
kinematics: Kinematics,
more_members: MoreMembers,
}

Expand Down Expand Up @@ -179,8 +178,6 @@ impl Grid {
convolutions,
// TODO: make this a new parameter
pid_basis: PidBasis::Pdg,
// TODO: make this a new parameter
kinematics: Kinematics::Q2rfX1X2,
channels,
subgrid_params,
}
Expand All @@ -202,8 +199,6 @@ impl Grid {
extra: ExtraSubgridParams,
subgrid_type: &str,
) -> Result<Self, GridError> {
// TODO: remove this constructor

let subgrid_template: SubgridEnum = match subgrid_type {
"LagrangeSubgrid" | "LagrangeSubgridV2" => {
LagrangeSubgridV2::new(&subgrid_params, &extra).into()
Expand All @@ -222,18 +217,11 @@ impl Grid {
metadata: default_metadata(),
convolutions: vec![Convolution::UnpolPDF(2212); channels[0].entry()[0].0.len()],
pid_basis: PidBasis::Pdg,
kinematics: Kinematics::Q2rfX1X2,
channels,
more_members: MoreMembers::V3(Mmv3::new(subgrid_template)),
})
}

/// Return the meaning of kinematic variables which each subgrid interpolates.
#[must_use]
pub const fn kinematics(&self) -> Kinematics {
self.kinematics
}

/// Return the convention by which the channels' PIDs are encoded.
#[must_use]
pub const fn pid_basis(&self) -> &PidBasis {
Expand Down Expand Up @@ -570,8 +558,6 @@ impl Grid {
_ => panic!("unknown PID basis '{lumi_id_types}'"),
}
}),
// TODO: when reading DIS grids, change this value
kinematics: Kinematics::Q2rfX1X2,
// TODO: make these proper members
more_members: MoreMembers::V3(Mmv3 {
remapper: grid.remapper().map(|r| {
Expand Down Expand Up @@ -1448,7 +1434,6 @@ impl Grid {
metadata: self.metadata.clone(),
convolutions: self.convolutions.clone(),
pid_basis: info.pid_basis,
kinematics: self.kinematics,
more_members: self.more_members.clone(),
};

Expand Down Expand Up @@ -1585,7 +1570,6 @@ impl Grid {
metadata: self.metadata.clone(),
convolutions: self.convolutions.clone(),
pid_basis: infos[0].pid_basis,
kinematics: self.kinematics,
more_members: self.more_members.clone(),
};

Expand Down
9 changes: 0 additions & 9 deletions pineappl/src/lagrange_subgrid.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Module containing the Lagrange-interpolation subgrid.

use super::convert::{f64_from_usize, usize_from_f64};
use super::grid::Grid;
use super::subgrid::{
ExtraSubgridParams, Mu2, Stats, Subgrid, SubgridEnum, SubgridIndexedIter, SubgridParams,
};
Expand Down Expand Up @@ -163,14 +162,6 @@ impl LagrangeSubgridV2 {
}

impl Subgrid for LagrangeSubgridV2 {
fn nodes(&self, _: &Grid) -> Cow<[Vec<f64>]> {
Cow::Owned(vec![
(0..self.ny1).map(|iy| fx(self.gety1(iy))).collect(),
(0..self.ny2).map(|iy| fx(self.gety2(iy))).collect(),
(0..self.ntau).map(|itau| fq2(self.gettau(itau))).collect(),
])
}

fn fill(&mut self, ntuple: &[f64], weight: f64) {
if weight == 0.0 {
return;
Expand Down
15 changes: 0 additions & 15 deletions pineappl/src/packed_subgrid.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! TODO

use super::grid::Grid;
use super::packed_array::PackedArray;
use super::subgrid::{Mu2, Stats, Subgrid, SubgridEnum, SubgridIndexedIter};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -40,20 +39,6 @@ impl PackedQ1X2SubgridV1 {
}

impl Subgrid for PackedQ1X2SubgridV1 {
fn nodes(&self, _: &Grid) -> Cow<[Vec<f64>]> {
Cow::Owned(vec![
self.x1_grid.clone(),
self.x2_grid.clone(),
self.mu2_grid
.iter()
.map(|&Mu2 { ren, fac, frg: _ }| {
assert_eq!(ren, fac);
ren
})
.collect(),
])
}

fn fill(&mut self, _: &[f64], _: f64) {
panic!("PackedQ1X2SubgridV1 doesn't support the fill operation");
}
Expand Down
1 change: 0 additions & 1 deletion pineappl/src/pids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ impl PidBasis {
// TODO: in the general case we should allow to return a vector of tuples
(Self::Evol, 100 | 103 | 108 | 115 | 124 | 135) => (pid, 1.0),
(Self::Evol, 200 | 203 | 208 | 215 | 224 | 235) => (pid, -1.0),
(Self::Evol | Self::Pdg, 21 | 22) => (pid, 1.0),
(Self::Evol | Self::Pdg, _) => (charge_conjugate_pdg_pid(pid), 1.0),
}
}
Expand Down
40 changes: 0 additions & 40 deletions pineappl/src/subgrid.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Module containing the trait `Subgrid` and supporting structs.

use super::empty_subgrid::EmptySubgridV1;
use super::grid::Grid;
use super::lagrange_subgrid::LagrangeSubgridV2;
use super::packed_subgrid::PackedQ1X2SubgridV1;
use enum_dispatch::enum_dispatch;
Expand Down Expand Up @@ -33,41 +32,6 @@ pub struct Mu2 {
pub frg: f64,
}

/// Enumeration describing the kinematic variables that are interpolated in a [`Subgrid`].
#[derive(Clone, Copy, Deserialize, Serialize)]
pub enum Kinematics {
/// Denotes a [`Subgrid`] with three kinematic variables: 1) one scale, which is the value of
/// both the renormalization and factorization scale, 2) a momentum fraction for the first
/// convolution and 3) a momentum fraction for the second convolution.
Q2rfX1X2,
// /// Denotes a [`Subgrid`] with four kinematic variables: two scales, 1) the renormalization and
// /// 2) factorization scale, 3) a momentum fraction for the first convolution and 3) a momentum
// /// fraction for the second convolution.
// Q2rQ2fX1X2,
// /// FK-table.
// Q2fX1X2,
}

// /// Return the renormalization scales for the `subgrid` contained in `grid`.
// pub fn ren<'a, 'b>(grid: &'a Grid, subgrid: &'b SubgridEnum) -> Cow<'b, [f64]> {
// match grid.kinematics() {
// Kinematics::Q2rfX1X2 => match subgrid.nodes(grid) {
// Cow::Borrowed(vec) => Cow::Borrowed(&vec[0]),
// Cow::Owned(mut vec) => Cow::Owned(vec.remove(0)),
// },
// }
// }
//
// /// Return the factorization scales for the `subgrid` contained in `grid`.
// pub fn fac<'a, 'b>(grid: &'a Grid, subgrid: &'b SubgridEnum) -> Cow<'b, [f64]> {
// match grid.kinematics() {
// Kinematics::Q2rfX1X2 => match subgrid.nodes(grid) {
// Cow::Borrowed(vec) => Cow::Borrowed(&vec[0]),
// Cow::Owned(mut vec) => Cow::Owned(vec.remove(0)),
// },
// }
// }

/// Size-related statistics for a subgrid.
#[derive(Debug, Eq, PartialEq)]
pub struct Stats {
Expand All @@ -91,10 +55,6 @@ pub struct Stats {
/// Trait each subgrid must implement.
#[enum_dispatch]
pub trait Subgrid {
/// Return the values of node points for each kinematical variable interpolated in this
/// subgrid.
fn nodes(&self, grid: &Grid) -> Cow<[Vec<f64>]>;

/// Return a slice of [`Mu2`] values corresponding to the (squared) renormalization and
/// factorization values of the grid. If the subgrid does not use a grid, this method should
/// return an empty slice.
Expand Down

0 comments on commit efdabd4

Please sign in to comment.