LHAPDF  6.5.4
Public Member Functions | Protected Member Functions | Private Types | Private Attributes | List of all members
LHAPDF::GridPDF Class Reference

A PDF defined via an interpolation grid. More...

#include <GridPDF.h>

Inheritance diagram for LHAPDF::GridPDF:
LHAPDF::PDF

Public Member Functions

 GridPDF ()
 Default constructor, making an empty PDF to be populated by hand.
 
 GridPDF (const std::string &path)
 Constructor from a file path. More...
 
 GridPDF (const std::string &setname, int member)
 Constructor from a set name and member ID.
 
 GridPDF (int lhaid)
 Constructor from an LHAPDF ID.
 
virtual ~GridPDF ()
 Virtual destructor to allow inheritance.
 
Interpolators and extrapolators
void setInterpolator (Interpolator *ipol)
 Set the interpolator by pointer. More...
 
template<typename INTERPOLATOR >
void setInterpolator (INTERPOLATOR ipol)
 Set the interpolator by value. More...
 
void setInterpolator (const std::string &ipolname)
 Set the interpolator by name. More...
 
bool hasInterpolator () const
 Find whether an extrapolator has been set on this PDF.
 
const Interpolatorinterpolator () const
 Get the current interpolator.
 
void setExtrapolator (Extrapolator *xpol)
 Set the extrapolator by pointer. More...
 
template<typename EXTRAPOLATOR >
void setExtrapolator (EXTRAPOLATOR xpol)
 Set the extrapolator by value. More...
 
void setExtrapolator (const std::string &xpolname)
 Set the extrapolator by name. More...
 
bool hasExtrapolator () const
 Find whether an extrapolator has been set on this PDF.
 
const Extrapolatorextrapolator () const
 Get the current extrapolator.
 
Info about the grid, and access to the raw data points
const KnotArrayknotarray () const
 
KnotArrayData ()
 
const vector< double > & xKnots () const
 Return a representative list of interpolation knots in x. More...
 
const vector< double > & q2Knots () const
 Return a representative list of interpolation knots in Q2. More...
 
bool inRangeX (double x) const
 Check if x is in the grid range.
 
bool inRangeQ2 (double q2) const
 Check if q2 is in the grid range.
 
- Public Member Functions inherited from LHAPDF::PDF
virtual ~PDF ()
 Virtual destructor, to allow unfettered inheritance.
 
void print (std::ostream &os=std::cout, int verbosity=1) const
 Summary printout.
 
virtual double xMin ()
 Minimum valid x value for this PDF.
 
virtual double xMax ()
 Maximum valid x value for this PDF.
 
virtual double qMin ()
 
virtual double qMax ()
 Maximum valid Q value for this PDF (in GeV). More...
 
virtual double q2Min ()
 Minimum valid Q2 value for this PDF (in GeV2).
 
virtual double q2Max ()
 Maximum valid Q2 value for this PDF (in GeV2).
 
int forcePositive () const
 Check whether the PDF is set to only return positive (definite) values or not. More...
 
void setForcePositive (int mode)
 Set whether the PDF will only return positive (definite) values or not.
 
bool inPhysicalRangeX (double x) const
 Check whether the given x is physically valid. More...
 
bool inPhysicalRangeQ2 (double q2) const
 Check whether the given Q2 is physically valid. More...
 
bool inPhysicalRangeQ (double q) const
 Check whether the given Q is physically valid. More...
 
bool inPhysicalRangeXQ2 (double x, double q2) const
 Check whether the given (x,Q2) is physically valid.
 
bool inPhysicalRangeXQ (double x, double q) const
 Check whether the given (x,Q) is physically valid.
 
virtual bool inRangeQ (double q) const
 Grid range check for Q. More...
 
virtual bool inRangeXQ (double x, double q) const
 Combined range check for x and Q.
 
bool inRangeXQ2 (double x, double q2) const
 Combined range check for x and Q2.
 
PDFInfoinfo ()
 Get the info class that actually stores and handles the metadata.
 
const PDFInfoinfo () const
 Get the info class that actually stores and handles the metadata (const version)
 
PDFSetset () const
 Get the PDF set of which this is a member. More...
 
int memberID () const
 PDF member local ID number. More...
 
int lhapdfID () const
 PDF member global LHAPDF ID number. More...
 
std::string description () const
 Description of this PDF member.
 
int dataversion () const
 Version of this PDF's data file.
 
std::string type () const
 Get the type of PDF member that this object represents (central, error)
 
virtual const std::vector< int > & flavors () const
 List of flavours defined by this PDF set. More...
 
void setFlavors (std::vector< int > const &flavors)
 Manually set/override the list of flavours defined by this PDF set. More...
 
bool hasFlavor (int id) const
 Checks whether id is a valid parton for this PDF.
 
int orderQCD () const
 Order of QCD at which this PDF has been constructed. More...
 
int qcdOrder () const
 
double quarkMass (int id) const
 Get a quark mass in GeV by PDG code (|PID| = 1-6 only) More...
 
double quarkThreshold (int id) const
 Get a flavor scale threshold in GeV by PDG code (|PID| = 1-6 only) Convenience interface to the Mass* and Threshold* info keywords. Returns -1 for an undefined PID. More...
 
void setAlphaS (AlphaS *alphas)
 Set the AlphaS calculator by pointer. More...
 
void setAlphaS (AlphaSPtr alphas)
 Set the AlphaS calculator by smart pointer.
 
bool hasAlphaS () const
 Check if an AlphaS calculator is set.
 
AlphaSalphaS ()
 Retrieve the AlphaS object for this PDF.
 
const AlphaSalphaS () const
 Retrieve the AlphaS object for this PDF (const)
 
double alphasQ (double q) const
 Value of alpha_s(Q2) used by this PDF. More...
 
double alphasQ2 (double q2) const
 Value of alpha_s(Q2) used by this PDF. More...
 
double xfxQ2 (int id, double x, double q2) const
 Get the PDF xf(x) value at (x,q2) for the given PID. More...
 
double xfxQ (int id, double x, double q) const
 Get the PDF xf(x) value at (x,q) for the given PID. More...
 
void xfxQ2 (double x, double q2, std::map< int, double > &rtn) const
 Get the PDF xf(x) value at (x,q2) for all supported PIDs. More...
 
void xfxQ (double x, double q, std::map< int, double > &rtn) const
 Get the PDF xf(x) value at (x,q) for all supported PIDs. More...
 
void xfxQ2 (double x, double q2, std::vector< double > &rtn) const
 Get the PDF xf(x) value at (x,q2) for "standard" PIDs. More...
 
void xfxQ (double x, double q, std::vector< double > &rtn) const
 Get the PDF xf(x) value at (x,q) for "standard" PIDs. More...
 
std::map< int, double > xfxQ2 (double x, double q2) const
 Get the PDF xf(x) value at (x,q2) for all supported PIDs. More...
 
std::map< int, double > xfxQ (double x, double q) const
 Get the PDF xf(x) value at (x,q) for all supported PIDs. More...
 

Protected Member Functions

void _loadInterpolator ()
 Load the interpolator, based on current metadata.
 
void _loadExtrapolator ()
 Load the PDF grid data block, based on current metadata.
 
void _loadPlugins ()
 Load the alphaS, interpolator, and extrapolator based on current metadata.
 
void _loadData (const std::string &mempath)
 Load the PDF grid data block (not the metadata) from the given PDF member file.
 
void _computePolynomialCoefficients (bool logspace)
 Precompute polynomial coefficients and approximate derivatives at knot positions.
 
double _xfxQ2 (int id, double x, double q2) const
 Get PDF xf(x,Q2) value (via grid inter/extrapolators)
 
void _xfxQ2 (double x, double q2, std::vector< double > &ret) const
 
- Protected Member Functions inherited from LHAPDF::PDF
 PDF ()
 Force initialization of the only non-class member.
 
void _loadAlphaS ()
 
std::string _setname () const
 Get the set name from the member data file path (for internal use only)
 
void _loadInfo (const std::string &mempath)
 
void _loadInfo (const std::string &setname, int member)
 
void _loadInfo (int lhaid)
 

Private Types

typedef unique_ptr< InterpolatorInterpolatorPtr
 Typedef of smart pointer for ipol memory handling.
 
typedef unique_ptr< ExtrapolatorExtrapolatorPtr
 Typedef of smart pointer for xpol memory handling.
 

Private Attributes

KnotArray data
 
InterpolatorPtr _interpolator
 Associated interpolator (mutable to allow laziness)
 
ExtrapolatorPtr _extrapolator
 Associated extrapolator (mutable to allow laziness)
 

Additional Inherited Members

- Protected Types inherited from LHAPDF::PDF
typedef unique_ptr< AlphaSAlphaSPtr
 Internal convenience typedef for the AlphaS object handle.
 
- Protected Attributes inherited from LHAPDF::PDF
std::string _mempath
 Member data file path.
 
PDFInfo _info
 Metadata container.
 
vector< int > _flavors
 Locally cached list of supported PIDs (mutable for laziness/caching)
 
AlphaSPtr _alphas
 Optionally loaded AlphaS object (mutable for laziness/caching)
 
int _forcePos
 Cached flag for whether to return only positive (or positive definite) PDF values. More...
 

Detailed Description

A PDF defined via an interpolation grid.

Examples
/tests/testgrid.cc.

Constructor & Destructor Documentation

◆ GridPDF()

LHAPDF::GridPDF::GridPDF ( const std::string &  path)
inline

Constructor from a file path.

We allow this to exist and be user-callable for testing and other special case uses, since if you are explicitly instantiating a GridPDF rather than acquiring it via a pointer/reference of PDF type, then you probably (hopefully) know what you're doing and aren't putting it into public production code!

Member Function Documentation

◆ q2Knots()

const vector<double>& LHAPDF::GridPDF::q2Knots ( ) const

Return a representative list of interpolation knots in Q2.

Constructed and cached by walking over all subgrids and concatenating their Q2 lists: expensive!

◆ setExtrapolator() [1/3]

void LHAPDF::GridPDF::setExtrapolator ( const std::string &  xpolname)

Set the extrapolator by name.

Use the extrapolator specified by the given name, as passed to the createExtrapolator factory function.

◆ setExtrapolator() [2/3]

void LHAPDF::GridPDF::setExtrapolator ( Extrapolator xpol)

Set the extrapolator by pointer.

The provided Extrapolator must have been new'd, as it will not be copied and ownership passes to this GridPDF: delete will be called on this ptr when this GridPDF goes out of scope or another setExtrapolator call is made.

◆ setExtrapolator() [3/3]

template<typename EXTRAPOLATOR >
void LHAPDF::GridPDF::setExtrapolator ( EXTRAPOLATOR  xpol)
inline

Set the extrapolator by value.

The passed value must be a concrete instantiation of the Extrapolator interface. It will be copied and heap-assigned for use inside this GridPDF.

Todo:
Use SFINAE magic to restrict EXTRAPOLATOR to subclasses of Extrapolator?

◆ setInterpolator() [1/3]

void LHAPDF::GridPDF::setInterpolator ( const std::string &  ipolname)

Set the interpolator by name.

Use the interpolator specified by the given name, as passed to the createInterpolator factory function.

◆ setInterpolator() [2/3]

void LHAPDF::GridPDF::setInterpolator ( Interpolator ipol)

Set the interpolator by pointer.

The provided Interpolator must have been new'd, as it will not be copied and ownership passes to this GridPDF: delete will be called on this ptr when this GridPDF goes out of scope or another setInterpolator call is made.

◆ setInterpolator() [3/3]

template<typename INTERPOLATOR >
void LHAPDF::GridPDF::setInterpolator ( INTERPOLATOR  ipol)
inline

Set the interpolator by value.

The passed value must be a concrete instantiation of the Interpolator interface. It will be copied and heap-assigned for use inside this GridPDF.

Todo:
Use SFINAE magic to restrict INTERPOLATOR to subclasses of Interpolator?

◆ xKnots()

const vector<double>& LHAPDF::GridPDF::xKnots ( ) const

Return a representative list of interpolation knots in x.

The x knot array for the first flavor grid of the lowest-Q2 subgrid is returned.


The documentation for this class was generated from the following file: