LHAPDF is hosted by Hepforge, IPPP Durham
LHAPDF  6.1.6
LHAPDF Namespace Reference

Namespace for all LHAPDF functions and classes. More...

Classes

class  AlphaS
 Calculator interface for computing alpha_s(Q2) in various ways. More...
 
class  AlphaS_Analytic
 Calculate alpha_s(Q2) by an analytic approximation. More...
 
class  AlphaS_Ipol
 
class  AlphaS_ODE
 Solve the differential equation in alphaS using an implementation of RK4. More...
 
class  AlphaSArray
 Internal storage class for alpha_s interpolation grids. More...
 
class  AlphaSError
 Error for general AlphaS computation problems. More...
 
struct  bad_lexical_cast
 Local alternative to Boost bad_lexical_cast. More...
 
class  BicubicInterpolator
 Implementation of bicubic interpolation. More...
 
class  BilinearInterpolator
 Implementation of bilinear interpolation. More...
 
class  CompositePDF
 A PDF defined by multiplicative combination of several constituent PDFs. More...
 
class  Config
 Class for PDF set metadata and manipulation. More...
 
class  ContinuationExtrapolator
 
class  ErrExtrapolator
 Extrapolates using the closest point on the Grid. More...
 
class  Exception
 Generic unspecialised LHAPDF runtime error. More...
 
class  Extrapolator
 The general interface for extrapolating beyond grid boundaries. More...
 
class  FactoryError
 Error to be raised by object factories given invalid requests. More...
 
class  FlavorError
 Error for requests for unsupported/invalid flavour PIDs. More...
 
class  GridError
 Error for general PDF grid problems. More...
 
class  GridPDF
 A PDF defined via an interpolation grid. More...
 
class  IndexError
 Error to be raised when a LHAPDF ID indexing fails. More...
 
class  Info
 Metadata base class for PDFs, PDF sets, or global configuration. More...
 
class  Interpolator
 The general interface for interpolating between grid points. More...
 
class  KnotArray1F
 Internal storage class for PDF data point grids. More...
 
class  KnotArrayNF
 A collection of {KnotArray1F}s accessed by PID code. More...
 
class  LogBicubicInterpolator
 Implementation of bicubic interpolation. More...
 
class  LogBilinearInterpolator
 Implementation of bilinear interpolation. More...
 
class  LogicError
 Error for places where it should not have been possible to get to! More...
 
class  MetadataError
 Error for unfound or broken metadata entries. More...
 
class  NearestPointExtrapolator
 Extrapolates using the closest point on the Grid. More...
 
class  NotImplementedError
 This feature doesn't exist yet. More...
 
class  PDF
 PDF is the general interface for access to parton density information. More...
 
class  PDFInfo
 Metadata class for PDF members. More...
 
class  PDFSet
 Class for PDF set metadata and manipulation. More...
 
struct  PDFUncertainty
 Structure for storage of uncertainty info calculated over a PDF error set. More...
 
class  RangeError
 Error to be thrown when out of the valid range of a PDF. More...
 
class  ReadError
 Error for file reading errors. More...
 
class  UserError
 Problem exists between keyboard and chair. More...
 
class  VersionError
 Error to be raised when a newer LHAPDF version is needed. More...
 

Functions

const std::vector< std::string > & availablePDFSets ()
 Get the names of all available PDF sets in the search path. More...
 
std::string version ()
 Get the LHAPDF library version code (as a string)
 
Convenient verbosity control
int verbosity ()
 
void setVerbosity (int v)
 
Factory functions for various Info objects
InfogetConfig ()
 
PDFSetgetPDFSet (const std::string &setname)
 
PDFInfomkPDFInfo (const std::string &setname, int member)
 
PDFInfomkPDFInfo (int lhaid)
 
Factory functions for making single PDF members
PDFmkPDF (const std::string &setname, int member)
 
PDFmkPDF (int lhaid)
 
PDFmkPDF (const std::string &setname_nmem)
 
Factory functions for making all PDF members in a set
void mkPDFs (const std::string &setname, std::vector< PDF * > &pdfs)
 Get all PDFs in a named set (return by filling the supplied vector).
 
std::vector< PDF * > mkPDFs (const std::string &setname)
 Get all PDFs in a named set (return by a new vector).
 
template<typename PTR >
void mkPDFs (const std::string &setname, std::vector< PTR > &pdfs)
 
Factory functions for making grid interpolators/extrapolators
InterpolatormkInterpolator (const std::string &name)
 
ExtrapolatormkExtrapolator (const std::string &name)
 
Factory functions for making AlphaS objects
AlphaSmkAlphaS (const Info &info)
 Make an AlphaS object from an Info object. More...
 
AlphaSmkAlphaS (const std::string &setname)
 Make an AlphaS object for the named PDF set. More...
 
AlphaSmkAlphaS (const std::string &setname, int member)
 Make an AlphaS object for the specified PDF. More...
 
AlphaSmkAlphaS (int lhaid)
 Make an AlphaS object for the specified PDF. More...
 
AlphaSmkBareAlphaS (const std::string &type)
 Make an AlphaS object of the requested type without a PDF reference. More...
 
File searching and search path handling functions
std::vector< std::string > paths ()
 Get the ordered list of search paths, from $LHAPDF_DATA_PATH and the install location. More...
 
void setPaths (const std::string &pathstr)
 Set the search paths list as a colon-separated string.
 
void setPaths (std::vector< string > paths)
 Set the search paths list.
 
void pathsPrepend (const std::string &p)
 Prepend to the search paths list.
 
void pathsAppend (const std::string &p)
 Append to the search paths list.
 
std::string findFile (const std::string &target)
 
Functions for handling standard LHAPDF filename structures
std::string pdfmempath (const std::string &setname, int member)
 
std::string findpdfmempath (const std::string &setname, int member)
 
std::string pdfsetinfopath (const std::string &setname)
 
std::string findpdfsetinfopath (const std::string &setname)
 
Functions for PDF lookup by LHAPDF ID index file
std::map< int, std::string > & getPDFIndex ()
 Get the singleton LHAPDF set ID -> PDF index map.
 
pair< std::string, int > lookupPDF (int lhaid)
 
int lookupLHAPDFID (const std::string &setname, int nmem)
 
Single beam reweighting functions
double weightxQ2 (int id, double x, double Q2, const PDF &basepdf, const PDF &newpdf, double aschk=5e-2)
 
template<typename PDFPTR >
double weightxQ2 (int id, double x, double Q2, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2)
 
double weightxQ (int id, double x, double Q, const PDF &basepdf, const PDF &newpdf, double aschk=5e-2)
 
template<typename PDFPTR >
double weightxQ (int id, double x, double Q, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2)
 
Two-beam reweighting functions
double weightxxQ2 (int id1, int id2, double x1, double x2, double Q2, const PDF &basepdf, const PDF &newpdf, double aschk=5e-2)
 
template<typename PDFPTR >
double weightxxQ2 (int id1, int id2, double x1, double x2, double Q2, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2)
 
double weightxxQ (int id1, int id2, double x1, double x2, double Q, const PDF &basepdf, const PDF &newpdf, double aschk=5e-2)
 
template<typename PDFPTR >
double weightxxQ (int id1, int id2, double x1, double x2, double Q, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2)
 
String handling utility functions
template<typename T , typename U >
lexical_cast (const U &in)
 Convert between any types via stringstream. More...
 
template<typename T >
std::string to_str (const T &val)
 Make a string representation of val.
 
template<typename T >
std::string to_str (const std::vector< T > &vec)
 Make a string representation of a vector vec.
 
std::string to_str_zeropad (int val, size_t nchars=4)
 Format an integer val as a zero-padded string of length nchars.
 
std::string join (const std::vector< std::string > &svec, const std::string &sep)
 Concatenate strings with separator strings between each element.
 
std::vector< std::string > split (const std::string &s, const std::string &sep)
 Split a string by a given separator.
 
bool contains (const std::string &s, const std::string &sub)
 Does a string s contain the sub substring?
 
bool startswith (const std::string &s, const std::string &sub)
 Does a string s start with the sub substring?
 
bool endswith (const std::string &s, const std::string &sub)
 Does a string s end with the sub substring?
 
size_t countchar (const std::string &s, const char c)
 How many times does a string s contain the character c?
 
std::string trim (const std::string &s)
 Strip leading and trailing spaces (not in-place)
 
std::string to_lower (const std::string &s)
 Convert a string to lower-case (not in-place)
 
std::string to_upper (const std::string &s)
 Convert a string to upper-case (not in-place)
 
Generic path functions in the LHAPDF namespace
bool path_exists (const std::string &p)
 Check if a path p (either file or dir) exists.
 
bool file_exists (const std::string &p)
 Check if a file p exists.
 
bool dir_exists (const std::string &p)
 Check if a dir p exists.
 
std::string operator/ (const std::string &a, const std::string &b)
 Operator for joining strings a and b with filesystem separators.
 
std::string basename (const std::string &p)
 Get the basename (i.e. terminal file name) from a path p.
 
std::string dirname (const std::string &p)
 Get the dirname (i.e. path to the penultimate directory) from a path p.
 
std::string file_stem (const std::string &f)
 Get the stem (i.e. part without a file extension) from a filename f.
 
std::string file_extn (const std::string &f)
 Get the file extension from a filename f.
 
Math functions in the LHAPDF namespace
Todo:
Add an abspath(p) function
template<typename N >
sqr (const N &x)
 Convenience function for squaring (of any type)
 
template<typename N >
int sgn (N val)
 Get the sign of a number.
 
int in_range (double x, double low, double high)
 Check if a number is in a range (closed-open)
 
int in_closed_range (double x, double low, double high)
 Check if a number is in a range (closed-closed)
 
int in_open_range (double x, double low, double high)
 Check if a number is in a range (open-open)
 
double norm_quantile (double p)
 Quantiles of the standard normal probability distribution function. More...
 
double chisquared_quantile (double p, double ndf)
 Quantiles of the chi-squared probability distribution function.
 
Container handling helpers
template<typename T >
bool contains (const std::vector< T > &container, const T &item)
 Does the vector<T> container contain item?
 
template<typename K , typename T >
bool has_key (const std::map< K, T > &container, const K &key)
 Does the map<K,T> container have a key K key?
 

Detailed Description

Namespace for all LHAPDF functions and classes.

Function Documentation

const std::vector<std::string>& LHAPDF::availablePDFSets ( )

Get the names of all available PDF sets in the search path.

Note
Taken from scanning the directories in the search path (i.e. LHAPDF_DATA_PATH) for viable PDF sets.
The result is cached when first called, to avoid repeated filesystem walking. It's assumed that new PDFs will not appear on the filesystem during a run: please let the authors know if that's not a good assumption!
Examples:
/tests/testinfo.cc, and /tests/testpaths.cc.
std::string LHAPDF::findFile ( const std::string &  target)

Return the first location in which a file is found

If no matching file is found, return an empty path.

Examples:
/tests/testpaths.cc.
std::string LHAPDF::findpdfsetinfopath ( const std::string &  setname)
inline
Todo:
Check that set info and mem=0 file are in same dir?
Info& LHAPDF::getConfig ( )

Get the global configuration object

The global config is populated by reading from lhapdf.conf if it is found in the search paths. It is a singleton, hence the 'get' rather than 'mk' function name.

Note
The LHAPDF system is responsible for deletion of the returned object. Do NOT delete it yourself! Hence the return by reference rather than pointer.
Examples:
/tests/testinfo.cc.
PDFSet& LHAPDF::getPDFSet ( const std::string &  setname)

Get the PDFSet with the given set name.

Returns a PDFSet by reference. When this function is used for access, only one PDFSet object is made per set name... hence the 'get' rather than 'mk' function name.

This function is intended particularly for use where it would be inefficient to have to repeatedly construct a PDFSet by name. The canonical use case is internal: the Info system uses this to ensure that cascading of config settings is efficient, and also allows the automatic application of set-level changes to all PDF member objects in that set.

Note
The LHAPDF system is responsible for deletion of the returned object. Do NOT delete it yourself! Hence the return by reference rather than pointer.
template<typename T , typename U >
T LHAPDF::lexical_cast ( const U &  in)

Convert between any types via stringstream.

Local alternative to Boost lexical_cast

int LHAPDF::lookupLHAPDFID ( const std::string &  setname,
int  nmem 
)
inline

Look up the member's LHAPDF index from the set name and member ID.

If lookup fails, -1 is returned, otherwise the LHAPDF ID code. NB. This function is relatively slow, since it requires std::map reverse lookup.

pair<std::string, int> LHAPDF::lookupPDF ( int  lhaid)
inline

Look up a PDF set name and member ID by the LHAPDF ID code

The set name and member ID are returned as an std::pair. If lookup fails, a pair ("", -1) is returned.

Examples:
/tests/testindex.cc.
AlphaS* LHAPDF::mkAlphaS ( const Info info)

Make an AlphaS object from an Info object.

The type and configuration of the returned AlphaS is chosen based on the PDF metadata Info object given as the argument.

Returns a 'new'ed AlphaS by pointer. Unless attached to a PDF, the caller is responsible for deletion of the created object.

AlphaS* LHAPDF::mkAlphaS ( const std::string &  setname)

Make an AlphaS object for the named PDF set.

The type and configuration of the returned AlphaS is chosen based on the named PDFSet's metadata.

Returns a 'new'ed AlphaS by pointer. Unless attached to a PDF, the caller is responsible for deletion of the created object.

AlphaS* LHAPDF::mkAlphaS ( const std::string &  setname,
int  member 
)

Make an AlphaS object for the specified PDF.

The type and configuration of the returned AlphaS is chosen based on the named PDFSet's nth member's metadata.

Returns a 'new'ed AlphaS by pointer. Unless attached to a PDF, the caller is responsible for deletion of the created object.

AlphaS* LHAPDF::mkAlphaS ( int  lhaid)

Make an AlphaS object for the specified PDF.

The type and configuration of the returned AlphaS is chosen based on the numbered PDF's metadata.

Returns a 'new'ed AlphaS by pointer. Unless attached to a PDF, the caller is responsible for deletion of the created object.

AlphaS* LHAPDF::mkBareAlphaS ( const std::string &  type)

Make an AlphaS object of the requested type without a PDF reference.

No values are initialised and have to be configured by the caller.

The caller is responsible for deletion of the created object.

Todo:
Actually, should we just make this mkAlphaS(0)?
Extrapolator* LHAPDF::mkExtrapolator ( const std::string &  name)

Extrapolator factory

Returns a 'new'ed Extrapolator by pointer. Unless passed to a GridPDF, the caller is responsible for deletion of the created object.

Interpolator* LHAPDF::mkInterpolator ( const std::string &  name)

Interpolator factory

Returns a 'new'ed Interpolator by pointer. Unless passed to a GridPDF, the caller is responsible for deletion of the created object.

PDF* LHAPDF::mkPDF ( const std::string &  setname,
int  member 
)

Create a new PDF with the given PDF set name and member ID.

Returns a 'new'ed PDF by pointer. The caller is responsible for deletion of the created object.

Examples:
/examples/compatibility.cc, /examples/testpdf.cc, /tests/testalphas.cc, and /tests/testgrid.cc.
PDF* LHAPDF::mkPDF ( int  lhaid)

Create a new PDF with the given LHAPDF ID code.

Returns a 'new'ed PDF by pointer. The caller is responsible for deletion of the created object.

PDF* LHAPDF::mkPDF ( const std::string &  setname_nmem)

Create a new PDF with the given PDF set name and member ID as a single string.

The format of the setname_nmem string is <setname>/<nmem> where <nmem> must be parseable as a positive integer. The / character is not permitted in set names due to clashes with Unix filesystem path syntax.

If no /<nmem> is given, member number 0 will be used.

Returns a 'new'ed PDF by pointer. The caller is responsible for deletion of the created object.

PDFInfo* LHAPDF::mkPDFInfo ( const std::string &  setname,
int  member 
)

Create a new Info object for the given set name and member number.

Returns a 'new'ed Info by pointer. The caller is responsible for deletion of the created object.

Examples:
/tests/testinfo.cc.
PDFInfo* LHAPDF::mkPDFInfo ( int  lhaid)

Create a new Info object with the given LHAPDF ID code.

Returns a 'new'ed Info by pointer. The caller is responsible for deletion of the created object.

template<typename PTR >
void LHAPDF::mkPDFs ( const std::string &  setname,
std::vector< PTR > &  pdfs 
)

Get all PDFs in a named set (return by filling the supplied vector).

This is a templated version for returning a vector of smart ptrs

double LHAPDF::norm_quantile ( double  p)

Quantiles of the standard normal probability distribution function.

Todo:
Add iszero() & equals(,) functions?
std::vector<std::string> LHAPDF::paths ( )

Get the ordered list of search paths, from $LHAPDF_DATA_PATH and the install location.

Note
The install prefix will be appended unless $LHAPDF_DATA_PATH ends with a double colon, i.e. '::'
Examples:
/tests/testgrid.cc, and /tests/testpaths.cc.
void LHAPDF::setVerbosity ( int  v)
inline

Convenient way to set the verbosity level

Note
Verbosity, like any other flag, can also be set at lower levels. But who does that, really?!?
int LHAPDF::verbosity ( )
inline

Convenient way to get the current verbosity level

Note
Verbosity, like any other flag, can also be set at lower levels. But who does that, really?!?
double LHAPDF::weightxQ ( int  id,
double  x,
double  Q,
const PDF basepdf,
const PDF newpdf,
double  aschk = 5e-2 
)
inline

Get the PDF reweighting factor for a beam with id,x,Q parameters, from basepdf to newpdf

Note
For NLO calculations, in general different PDF values enter for each counterterm: be careful.
template<typename PDFPTR >
double LHAPDF::weightxQ ( int  id,
double  x,
double  Q,
const PDFPTR  basepdf,
const PDFPTR  newpdf,
double  aschk = 5e-2 
)
inline

Get the PDF reweighting factor for a beam with id,x,Q parameters, from basepdf to newpdf

Note
For NLO calculations, in general different PDF values enter for each counterterm: be careful.
double LHAPDF::weightxQ2 ( int  id,
double  x,
double  Q2,
const PDF basepdf,
const PDF newpdf,
double  aschk = 5e-2 
)
inline

Get the PDF reweighting factor for a beam with id,x,Q parameters, from basepdf to newpdf

Note
For NLO calculations, in general different PDF values enter for each counterterm: be careful.
template<typename PDFPTR >
double LHAPDF::weightxQ2 ( int  id,
double  x,
double  Q2,
const PDFPTR  basepdf,
const PDFPTR  newpdf,
double  aschk = 5e-2 
)
inline

Get the PDF reweighting factor for a beam with id,x,Q parameters, from basepdf to newpdf

Note
For NLO calculations, in general different PDF values enter for each counterterm: be careful.
double LHAPDF::weightxxQ ( int  id1,
int  id2,
double  x1,
double  x2,
double  Q,
const PDF basepdf,
const PDF newpdf,
double  aschk = 5e-2 
)
inline

Get the PDF reweighting factor for two beams, one with id1,x1 and the other with id2,x2, from basepdf to newpdf

Note
For NLO calculations, in general different PDF values enter for each counterterm: be careful.
template<typename PDFPTR >
double LHAPDF::weightxxQ ( int  id1,
int  id2,
double  x1,
double  x2,
double  Q,
const PDFPTR  basepdf,
const PDFPTR  newpdf,
double  aschk = 5e-2 
)
inline

Get the PDF reweighting factor for two beams, one with id1,x1 and the other with id2,x2, from basepdf to newpdf

Note
For NLO calculations, in general different PDF values enter for each counterterm: be careful.
double LHAPDF::weightxxQ2 ( int  id1,
int  id2,
double  x1,
double  x2,
double  Q2,
const PDF basepdf,
const PDF newpdf,
double  aschk = 5e-2 
)
inline

Get the PDF reweighting factor for two beams, one with id1,x1 and the other with id2,x2, from basepdf to newpdf

Note
For NLO calculations, in general different PDF values enter for each counterterm: be careful.
template<typename PDFPTR >
double LHAPDF::weightxxQ2 ( int  id1,
int  id2,
double  x1,
double  x2,
double  Q2,
const PDFPTR  basepdf,
const PDFPTR  newpdf,
double  aschk = 5e-2 
)
inline

Get the PDF reweighting factor for two beams, one with id1,x1 and the other with id2,x2, from basepdf to newpdf

Note
For NLO calculations, in general different PDF values enter for each counterterm: be careful.