Draft: Add higher dimensional pdfs

Max Knobbe requested to merge add_higher_dimensional_pdfs into main

In this draft, I try to include higher-dimensional PDF's in LHAPDF. See detailed design decisions below.

Data Handling


  • added new key to .info files, GridDim: dim indicates the dimensionality of the PDF grid
  • based on GridDim, GridPDF::_loadData now decides whether to use GridPDF::_loadData2D, or GridPDF::_loadDataND. If GridDim is not set in .info, GridPDF::_loadData2D is used.
  • complete memory structure is reused from the 2D interpolations, with the exception of the knots. For 2D interpolations we had dedicated std::vectors for x,q2 knots, now reuse x-knots container for all knots
  • not support yet for discontinuities in the grids


  • add support for discontinuities in the grids
  • add sanity checks while reading in the grids
  • precompute log grids



  • this MR makes use of !25 (gathering all 1D interpolators in one header)
  • add (purely virtual) new function for interpolators, double _interpolateND(...). This might be the easiest method to ensure that no wrong interpolation is used by accident, since we have to implement the purely virtual functions anyways and we can throw an exception directly in the derived interpolators.
  • working tri-linear interpolator


  • automatically choose the interpolator with right dimensionality, depending on GridDim

"Outside" API

  • Added function Interpolator::interpolateXQ2(int id, double x, double q2, double p2) for 3D grids; (name is debatable)


  • what else do we need, 4D? ND? all pid-version(s)?
Edited by Max Knobbe

Merge request reports