LHAPDF is hosted by Hepforge, IPPP Durham
LHAPDF  6.2.1
LHAPDF::PDF Class Referenceabstract

PDF is the general interface for access to parton density information. More...

#include <PDF.h>

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

Public Member Functions

virtual ~PDF ()
 Virtual destructor, to allow unfettered inheritance. More...
 
void print (std::ostream &os=std::cout, int verbosity=1) const
 Summary printout.
 
Ranges of validity
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 PDF is set to only return positive (definite) values or not. More...
 
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 inRangeQ2 (double q2) const =0
 Grid range check for Q2. More...
 
virtual bool inRangeX (double x) const =0
 Grid range check for x. 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.
 
Generic member-level metadata (including cascaded metadata from set & config level)
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...
 
Member-level metadata
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)
 
Parton content and QCD parameters
virtual const std::vector< int > & flavors () const
 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.
 
QCD running coupling calculation
void setAlphaS (AlphaS *alphas)
 Set the AlphaS calculator by pointer. More...
 
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...
 

Protected Types

typedef AlphaSAlphaSPtr
 

Protected Member Functions

 PDF ()
 
void _loadAlphaS ()
 
std::string _setname () const
 Get the set name from the member data file path (for internal use only)
 
Helper methods for info loading / path setting, used by derived types
void _loadInfo (const std::string &mempath)
 
void _loadInfo (const std::string &setname, int member)
 
void _loadInfo (int lhaid)
 

Protected Attributes

std::string _mempath
 Member data file path.
 
PDFInfo _info
 Metadata container.
 
vector< int > _flavors
 Locally cached list of supported PIDs.
 
AlphaSPtr _alphas
 Optionally loaded AlphaS object.
 
int _forcePos
 Cached flag for whether to return only positive (or postive definite) PDF values. More...
 

PDF values

virtual double _xfxQ2 (int id, double x, double q2) const =0
 Calculate the PDF xf(x) value at (x,q2) for the given PID. 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...
 

Detailed Description

PDF is the general interface for access to parton density information.

The PDF interface declares the general form of all PDF types, such as Grid based or analytic.

Examples:
/examples/compatibility.cc, /examples/testpdf.cc, /tests/testalphas.cc, and /tests/testgrid.cc.

Member Typedef Documentation

◆ AlphaSPtr

typedef AlphaS* LHAPDF::PDF::AlphaSPtr
protected

Internal convenience typedef for the AlphaS object handle

Todo:
Reinstate this unique_ptr when C++98 header compatibility is no longer an issue

Constructor & Destructor Documentation

◆ PDF()

LHAPDF::PDF::PDF ( )
inlineprotected

Force initialization of the only non-class member.

Todo:
Remove _alphas initialisation when it can be a smart ptr again

◆ ~PDF()

virtual LHAPDF::PDF::~PDF ( )
inlinevirtual

Virtual destructor, to allow unfettered inheritance.

Todo:
Remove this delete when C++98 is gone, and unique_ptr can be reinstated

Member Function Documentation

◆ _xfxQ2()

virtual double LHAPDF::PDF::_xfxQ2 ( int  id,
double  x,
double  q2 
) const
protectedpure virtual

Calculate the PDF xf(x) value at (x,q2) for the given PID.

This is the key function to be overridden in concrete PDF types, since it actually does the calculation of xf(x,Q2) by analytic, interpolation, or other means. The user-called xfxQ2 method exists so that the physical range and PID checks need only be done in one place, rather than need to be re-implemented in each concrete implementation.

Parameters
idParton ID in the PDG scheme
xMomentum fraction
q2Squared energy (renormalization) scale
Returns
the value of xf(x,q2)

Implemented in LHAPDF::GridPDF.

◆ alphasQ()

double LHAPDF::PDF::alphasQ ( double  q) const
inline

Value of alpha_s(Q2) used by this PDF.

Calculated numerically, analytically, or interpolated according to metadata, using the AlphaS classes.

◆ alphasQ2()

double LHAPDF::PDF::alphasQ2 ( double  q2) const
inline

Value of alpha_s(Q2) used by this PDF.

Calculated numerically, analytically, or interpolated according to metadata, using the AlphaS classes.

◆ flavors()

virtual const std::vector<int>& LHAPDF::PDF::flavors ( ) const
inlinevirtual

List of flavours defined by this PDF set.

This list is stored locally after its initial read from the Info object to avoid unnecessary lookups and string decoding, since e.g. it is looked at by every call to the GridPDF's Interpolator and Extrapolator classes.

Todo:
Make virtual for AnalyticPDF? Or allow manual setting of the Info?
Examples:
/tests/testgrid.cc.

◆ forcePositive()

int LHAPDF::PDF::forcePositive ( ) const
inline

Check whether PDF is set to only return positive (definite) values or not.

This is to avoid overshooting in to negative values when interpolating/extrapolating PDFs that sharply decrease towards zero. 0 = unforced, 1 = forced positive, 2 = forced positive definite (>= 1e-10)

◆ inPhysicalRangeQ()

bool LHAPDF::PDF::inPhysicalRangeQ ( double  q) const
inline

Check whether the given Q is physically valid.

Returns false for Q less than 0 (Q must be positive).

◆ inPhysicalRangeQ2()

bool LHAPDF::PDF::inPhysicalRangeQ2 ( double  q2) const
inline

Check whether the given Q2 is physically valid.

Returns false for Q2 less than 0 (Q must be real-valued).

◆ inPhysicalRangeX()

bool LHAPDF::PDF::inPhysicalRangeX ( double  x) const
inline

Check whether the given x is physically valid.

Returns false for x less than 0 or greater than 1, since it is a momentum fraction and not valid outside those values.

◆ inRangeQ()

virtual bool LHAPDF::PDF::inRangeQ ( double  q) const
inlinevirtual

Grid range check for Q.

Return true when given Q is in the coverage range of this PDF. It actually squares the given Q and returns value from inRangeQ2.

Parameters
qEnergy scale
Returns
Whether q is in range

◆ inRangeQ2()

virtual bool LHAPDF::PDF::inRangeQ2 ( double  q2) const
pure virtual

Grid range check for Q2.

Return true when given Q2 is in the coverage range of this PDF.

Parameters
q2Squared energy scale
Returns
Whether q2 is in range

Implemented in LHAPDF::GridPDF.

◆ inRangeX()

virtual bool LHAPDF::PDF::inRangeX ( double  x) const
pure virtual

Grid range check for x.

Return true when given x is in the coverage range of this PDF.

Parameters
xMomentum fraction
Returns
Whether x is in range

Implemented in LHAPDF::GridPDF.

◆ lhapdfID()

int LHAPDF::PDF::lhapdfID ( ) const

PDF member global LHAPDF ID number.

Obtained from the member ID and the set's LHAPDF ID index

◆ memberID()

int LHAPDF::PDF::memberID ( ) const
inline

PDF member local ID number.

Obtained from the member file path, not Info-based metadata.

◆ orderQCD()

int LHAPDF::PDF::orderQCD ( ) const
inline

Order of QCD at which this PDF has been constructed.

"Order" is defined here and throughout LHAPDF as the maximum number of loops included in the matrix elements, in order to have an integer value for easy use in comparisons, as opposed to "LO", "NLO", etc. strings.

◆ qcdOrder()

int LHAPDF::PDF::qcdOrder ( ) const
inline
Deprecated:
Use orderQCD instead

◆ qMax()

virtual double LHAPDF::PDF::qMax ( )
inlinevirtual

Maximum valid Q value for this PDF (in GeV).

Note
This function calls sqrt(q2Max()). For better CPU efficiency and accuracy use q2Max() directly.

◆ qMin()

virtual double LHAPDF::PDF::qMin ( )
inlinevirtual

Minimum valid Q value for this PDF (in GeV).

Note
This function calls sqrt(q2Min()). For better CPU efficiency and accuracy use q2Min() directly.

◆ quarkMass()

double LHAPDF::PDF::quarkMass ( int  id) const

Get a quark mass in GeV by PDG code (|PID| = 1-6 only)

Convenience interface to the Mass* info keywords. Returns -1 for an undefined PID.

◆ set()

PDFSet& LHAPDF::PDF::set ( ) const
inline

Get the PDF set of which this is a member.

Obtained from the member file path, not Info-based metadata.

◆ setAlphaS()

void LHAPDF::PDF::setAlphaS ( AlphaS alphas)
inline

Set the AlphaS calculator by pointer.

The provided AlphaS 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 PDF goes out of scope or another setAlphaS call is made.

◆ xfxQ() [1/4]

double LHAPDF::PDF::xfxQ ( int  id,
double  x,
double  q 
) const
inline

Get the PDF xf(x) value at (x,q) for the given PID.

xfxQ will square the given q and return the value from xfxQ2. All grids are defined in q2 rather than q since the natural value in MC programs is squared, so we typically avoid an expensive sqrt() call.

Parameters
idPDG parton ID
xMomentum fraction
qEnergy (renormalization) scale
Returns
The value of xf(x,q2)
Examples:
/examples/compatibility.cc, and /tests/testgrid.cc.

◆ xfxQ() [2/4]

void LHAPDF::PDF::xfxQ ( double  x,
double  q,
std::map< int, double > &  rtn 
) const
inline

Get the PDF xf(x) value at (x,q) for all supported PIDs.

This version fills a user-supplied map to avoid container construction costs on every call.

Parameters
xMomentum fraction
qEnergy (renormalization) scale
rtnMap of PDF xf(x,q) values, to be filled

◆ xfxQ() [3/4]

void LHAPDF::PDF::xfxQ ( double  x,
double  q,
std::vector< double > &  rtn 
) const
inline

Get the PDF xf(x) value at (x,q) for "standard" PIDs.

This version fills a user-supplied vector to avoid container construction costs on every call.

The filled vector follows the LHAPDF5 convention, with 13 entries running in the PDF ID order [-6, -5, ..., -1, 21, 1, ... 5, 6], i.e. quark PDF values will be at vector index pid+6 and the gluon at index 6.

Parameters
xMomentum fraction
qEnergy (renormalization) scale
rtnVector of PDF xf(x,q) values, to be filled

◆ xfxQ() [4/4]

std::map<int, double> LHAPDF::PDF::xfxQ ( double  x,
double  q 
) const
inline

Get the PDF xf(x) value at (x,q) for all supported PIDs.

This version creates a new map on every call: prefer to use the fill-in-place version with a user-supplied map for many calls.

xfxQ will square the given q and return the value from xfxQ2. All grids are defined in q2 rather than q since the natural value in MC programs is squared, so we typically avoid an expensive sqrt() call.

Parameters
xMomentum fraction
qEnergy (renormalization) scale
Returns
A map of PDF xf(x,q) values

◆ xfxQ2() [1/4]

double LHAPDF::PDF::xfxQ2 ( int  id,
double  x,
double  q2 
) const

Get the PDF xf(x) value at (x,q2) for the given PID.

All grids are defined in Q2 rather than Q since the natural value in MC programs is squared, so we typically avoid an expensive sqrt() call.

Parameters
idPDG parton ID
xMomentum fraction
q2Squared energy (renormalization) scale
Returns
The value of xf(x,q2)
Examples:
/tests/testgrid.cc.

◆ xfxQ2() [2/4]

void LHAPDF::PDF::xfxQ2 ( double  x,
double  q2,
std::map< int, double > &  rtn 
) const

Get the PDF xf(x) value at (x,q2) for all supported PIDs.

This version fills a user-supplied map to avoid container construction costs on every call.

Parameters
xMomentum fraction
q2Squared energy (renormalization) scale
rtnMap of PDF xf(x,q2) values, to be filled

◆ xfxQ2() [3/4]

void LHAPDF::PDF::xfxQ2 ( double  x,
double  q2,
std::vector< double > &  rtn 
) const

Get the PDF xf(x) value at (x,q2) for "standard" PIDs.

This version fills a user-supplied vector to avoid container construction costs on every call.

The filled vector follows the LHAPDF5 convention, with 13 entries running in the PDF ID order [-6, -5, ..., -1, 21, 1, ... 5, 6], i.e. quark PDF values will be at vector index pid+6 and the gluon at index 6.

Parameters
xMomentum fraction
q2Squared energy (renormalization) scale
rtnVector of PDF xf(x,q2) values, to be filled

◆ xfxQ2() [4/4]

std::map<int, double> LHAPDF::PDF::xfxQ2 ( double  x,
double  q2 
) const

Get the PDF xf(x) value at (x,q2) for all supported PIDs.

This version creates a new map on every call: prefer to use the fill-in-place version with a user-supplied map for many calls.

Parameters
xMomentum fraction
q2Squared energy (renormalization) scale
Returns
A map of PDF xf(x,q2) values

Member Data Documentation

◆ _forcePos

int LHAPDF::PDF::_forcePos
mutableprotected

Cached flag for whether to return only positive (or postive definite) PDF values.

A negative value indicates that the flag has not been set. 0 = no forcing, 1 = force positive (i.e. 0 is permitted, negative values are not), 2 = force positive definite (i.e. no values less than 1e-10).


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