lhapdf is hosted by Hepforge, IPPP Durham
LHAPDF  6.5.4
LHAPDF::PDFSet Class Reference

Class for PDF-set metadata and manipulation. More...

#include <PDFSet.h>

Inheritance diagram for LHAPDF::PDFSet:
LHAPDF::Info

Public Member Functions

 PDFSet ()
 
 PDFSet (const std::string &setname)
 
void print (std::ostream &os=std::cout, int verbosity=1) const
 Summary printout.
 
PDF set metadata specialisations
std::string name () const
 PDF set name. More...
 
std::string description () const
 Description of the set.
 
int lhapdfID () const
 First LHAPDF global index in this PDF set.
 
int dataversion () const
 Version of this PDF set's data files.
 
std::string errorType () const
 Get the type of PDF errors in this set (replicas, symmhessian, hessian, custom, etc.)
 
PDFErrInfo errorInfo () const
 Get the structured decomposition of the error-type string.
 
double errorConfLevel () const
 Get the confidence level of the Hessian eigenvectors, in percent. More...
 
size_t size () const
 Number of members in this set.
 
size_t errorSize () const
 
size_t errSize () const
 
Creating PDF members
PDFmkPDF (size_t member) const
 
template<typename PTR >
void mkPDFs (std::vector< PTR > &pdfs) const
 
std::vector< PDF * > mkPDFs () const
 
template<typename PTR >
std::vector< PTR > mkPDFs () const
 
Generic metadata cascading mechanism
Todo:
Add AlphaS getter for set-level alphaS?
std::vector< std::string > keys () const
 Get the keys defined on this object or higher.
 
bool has_key (const std::string &key) const
 Can this Info object return a value for the given key? (it may be defined non-locally)
 
const std::string & get_entry (const std::string &key) const
 Retrieve a metadata string by key name.
 
const std::string & get_entry (const std::string &key, const std::string &fallback) const
 Retrieve a metadata string by key name, with a fallback.
 
PDF set uncertainty functions

See the Calculating PDF uncertainties group for more details

PDFUncertainty uncertainty (const std::vector< double > &values, double cl=CL1SIGMA, bool alternative=false) const
 Calculate the central value and PDF uncertainty on an observable. More...
 
void uncertainty (PDFUncertainty &rtn, const std::vector< double > &values, double cl=CL1SIGMA, bool alternative=false) const
 Calculate the PDF uncertainty on an observable (as above), with efficient no-copy return to the rtn argument. More...
 
std::vector< PDFUncertaintyuncertainties (const std::vector< std::vector< double >> &observables_values, double cl=CL1SIGMA, bool alternative=false) const
 Calculate PDF uncertainties on multiple observables at once. More...
 
void uncertainties (std::vector< PDFUncertainty > &rtn, const std::vector< std::vector< double >> &observables_values, double cl=CL1SIGMA, bool alternative=false) const
 Calculate multiple PDF uncertainties (as above), with efficient no-copy return to the rtn argument. More...
 
double correlation (const std::vector< double > &valuesA, const std::vector< double > &valuesB) const
 Calculate the PDF correlation between valuesA and valuesB using appropriate formulae for this set. More...
 
double randomValueFromHessian (const std::vector< double > &values, const std::vector< double > &randoms, bool symmetrise=true) const
 Generate a random value from Hessian values and Gaussian random numbers. More...
 
void _checkPdfType (const std::vector< string > &pdftypes) const
 
- Public Member Functions inherited from LHAPDF::Info
 Info ()
 Default constructor.
 
 Info (const std::string &path)
 Constructor.
 
virtual ~Info ()
 Virtual destructor to allow inheritance.
 
void load (const std::string &filepath)
 
std::vector< std::string > keys_local () const
 Get the keys defined on this specific object.
 
std::vector< std::string > keys () const
 
bool has_key_local (const std::string &key) const
 Is a value defined for the given key on this specific object?
 
const std::string & get_entry_local (const std::string &key) const
 Retrieve a metadata string by key name, as defined on this specific object.
 
template<typename T >
get_entry_as (const std::string &key) const
 
template<typename T >
get_entry_as (const std::string &key, const T &fallback) const
 Retrieve a metadata entry by key name, with an inline type cast and default fallback.
 
template<typename T >
void set_entry (const std::string &key, const T &val)
 Set a keyed value entry.
 
template<>
bool get_entry_as (const std::string &key) const
 
template<>
std::vector< std::string > get_entry_as (const std::string &key) const
 
template<>
std::vector< int > get_entry_as (const std::string &key) const
 
template<>
std::vector< double > get_entry_as (const std::string &key) const
 

Private Attributes

std::string _setname
 Name of this set.
 
PDFErrInfo _errinfo
 Cached PDF error-info breakdown struct.
 

Additional Inherited Members

- Protected Attributes inherited from LHAPDF::Info
std::map< std::string,
std::string > 
_metadict
 The string -> string native metadata storage container.
 

Detailed Description

Class for PDF-set metadata and manipulation.

Examples:
/examples/testpdfunc.cc, and /tests/testinfo.cc.

Constructor & Destructor Documentation

LHAPDF::PDFSet::PDFSet ( )
inline

Default constructor (for container compatibility)

Todo:
Remove?
LHAPDF::PDFSet::PDFSet ( const std::string &  setname)

Constructor from a set name

Todo:
Remove?

Member Function Documentation

void LHAPDF::PDFSet::_checkPdfType ( const std::vector< string > &  pdftypes) const

Check that the type of each member matches the ErrorType of the set.

Todo:
We need to make the signature clearer – what is the arg? Why not automatically check the members? Why not a plural name? Why not on PDF? "Hiding" the name for now with the leading underscore.
double LHAPDF::PDFSet::correlation ( const std::vector< double > &  valuesA,
const std::vector< double > &  valuesB 
) const

Calculate the PDF correlation between valuesA and valuesB using appropriate formulae for this set.

The correlation can vary between -1 and +1 where values close to {-1,0,+1} mean that the two quantities A and B are {anticorrelated,uncorrelated,correlated}, respectively.

For a combined set, the parameter variations are not included in the calculation of the correlation.

See the Calculating PDF uncertainties group for more details

double LHAPDF::PDFSet::errorConfLevel ( ) const

Get the confidence level of the Hessian eigenvectors, in percent.

If not defined, assume 1-sigma = erf(1/sqrt(2)) =~ 68.268949% by default, unless this is a replica set for which return -1.

size_t LHAPDF::PDFSet::errorSize ( ) const
inline

Number of error members in this set

Note
Equal to size()-1
size_t LHAPDF::PDFSet::errSize ( ) const
inline

Number of error members in this set

Note
Alias for preferred/consistent errorSize()
PDF* LHAPDF::PDFSet::mkPDF ( size_t  member) const
inline

Make the nth PDF member in this set, returned by pointer

Note
As with the mkPDF factory method, the PDF pointer returned by this method is heap allocated and its memory management is now the responsibility of the caller.
template<typename PTR >
void LHAPDF::PDFSet::mkPDFs ( std::vector< PTR > &  pdfs) const
inline

Make all the PDFs in this set, filling a supplied vector with PDF pointers

This version may be preferred in many circumstances, since it can avoid the overhead of creating a new temporary vector.

A vector of smart pointers can be used, for any smart pointer type which supports construction from a raw pointer argument, e.g. unique_ptr<PDF>(PDF*).

Note
The supplied vector will be cleared before filling!
As with the mkPDF method and factory function, the PDF pointers returned by this method are heap allocated and their memory management is now the responsibility of the caller, either manually for raw pointers or automatically if smart pointers are used.
Use an appropriate smart pointer, of course! This depends in detail on how you will use the PDF objects (do you want shared or unique pointers?), but they also need to be compatible with storage in STL containers, e.g. std::unique_ptr or std::shared_ptr but not the deprecated std::auto_ptr.
Todo:
Needs to be implemented in the header since the arg type is templated.
Todo:
Need to use an std::move here, or write differently, for unique_ptr to work?
std::vector<PDF*> LHAPDF::PDFSet::mkPDFs ( ) const
inline

Make all the PDFs in this set, returning as a vector of PDF pointers

Note
As with the mkPDF method and factory function, the PDF pointers returned by this method are heap allocated and their memory management is now the responsibility of the caller.
template<typename PTR >
std::vector<PTR> LHAPDF::PDFSet::mkPDFs ( ) const
inline
Todo:
Use the following with default function template args if C++11 is being used
std::string LHAPDF::PDFSet::name ( ) const
inline

PDF set name.

Note
Not taken from the .info metadata file.
Examples:
/examples/testpdfunc.cc.
double LHAPDF::PDFSet::randomValueFromHessian ( const std::vector< double > &  values,
const std::vector< double > &  randoms,
bool  symmetrise = true 
) const

Generate a random value from Hessian values and Gaussian random numbers.

Note
This routine is intended for advanced users!

See Section 6 of G. Watt and R.S. Thorne, JHEP 1208 (2012) 052 [arXiv:1205.4024 [hep-ph]].

Pass a vector values containing a value for each member of the Hessian PDF set. Pass a vector randoms containing neigen random numbers, where neigen is the number of distinct eigenvectors.

Option symmetrise equal to true will symmetrise the random values (in the case of an asymmetric Hessian set) using a corrected Eq. (6.5) of arXiv:1205.4024v2, so that the average tends to the best-fit for a large number of replicas.

Option symmetrise equal to false will use Eq. (6.4) of arXiv:1205.4024v2 (for an asymmetric Hessian set), then the average differs from the best-fit. Option symmetrise has no effect for a symmetric Hessian set.

Random values generated in this way can subsequently be used for applications such as Bayesian reweighting or combining predictions from different groups (as an alternative to taking the envelope). See, for example, supplementary material at http://mstwpdf.hepforge.org/random/.

Use of this routine with a non-Hessian PDF set will throw a UserError.

For a combined set, the parameter variations are not included in the generation of the random value.

See the Calculating PDF uncertainties group for more details

std::vector<PDFUncertainty> LHAPDF::PDFSet::uncertainties ( const std::vector< std::vector< double >> &  observables_values,
double  cl = CL1SIGMA,
bool  alternative = false 
) const
inline

Calculate PDF uncertainties on multiple observables at once.

The observables_values nested vector is a list of variation-value lists, with the first (outer) index corresponding to the M observables, e.g. a set of differential-observable bins, and the inner index the N PDF members.

The return value is an M-element vector of PDFUncertainty summaray structs, one per observable.

Warning
The inner _values vector corresponds to the members of this PDF set and must be ordered accordingly.
void LHAPDF::PDFSet::uncertainties ( std::vector< PDFUncertainty > &  rtn,
const std::vector< std::vector< double >> &  observables_values,
double  cl = CL1SIGMA,
bool  alternative = false 
) const

Calculate multiple PDF uncertainties (as above), with efficient no-copy return to the rtn argument.

Warning
The inner _values vector corresponds to the members of this PDF set and must be ordered accordingly.
PDFUncertainty LHAPDF::PDFSet::uncertainty ( const std::vector< double > &  values,
double  cl = CL1SIGMA,
bool  alternative = false 
) const
inline

Calculate the central value and PDF uncertainty on an observable.

Warning
The values vector corresponds to the members of this PDF set and must be ordered accordingly.

In the Hessian approach, the central value is the best-fit "values[0]" and the uncertainty is given by either the symmetric or asymmetric formula using eigenvector PDF sets.

If the PDF set is given in the form of replicas, by default, the central value is given by the mean and is not necessarily "values[0]" for quantities with a non-linear dependence on PDFs, while the uncertainty is given by the standard deviation.

Optional argument cl is used to rescale uncertainties to a particular confidence level (in percent); a negative number will rescale to the default CL for this set.

Note
If cl is omitted, automatically rescale to normal 1-sigma ~ 68.268949% uncertainties.

If the PDF set is given in the form of replicas, then optional argument alternative equal to true (default: false) will construct a confidence interval from the probability distribution of replicas, with the central value given by the median.

For a combined set, a breakdown of the separate PDF and parameter variation uncertainties is available. The parameter variation uncertainties are computed from the last 2*n members of the set, with n the number of parameters.

See the Calculating PDF uncertainties group for more details

Todo:
Add option to restrict replica mean & stddev calculation to a central CI set?
Examples:
/examples/testpdfunc.cc.
void LHAPDF::PDFSet::uncertainty ( PDFUncertainty rtn,
const std::vector< double > &  values,
double  cl = CL1SIGMA,
bool  alternative = false 
) const

Calculate the PDF uncertainty on an observable (as above), with efficient no-copy return to the rtn argument.

Warning
The values vector corresponds to the members of this PDF set and must be ordered accordingly.
Todo:
For real efficiency, the chaining of these functions should be the other way around

See the Calculating PDF uncertainties group for more details


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