10#include "LHAPDF/Info.h"
11#include "LHAPDF/Factories.h"
12#include "LHAPDF/Version.h"
13#include "LHAPDF/Config.h"
14#include "LHAPDF/Utils.h"
40 PDFUncertainty(
double cent=0,
double eplus=0,
double eminus=0,
double esymm=0,
double scalefactor=1,
41 double eplus_pdf=0,
double eminus_pdf=0,
double esymm_pdf=0,
42 double eplus_par=0,
double eminus_par=0,
double esymm_par=0)
43 :
central(cent), errplus(eplus), errminus(eminus), errsymm(esymm), scale(scalefactor),
44 errplus_pdf(eplus_pdf), errminus_pdf(eminus_pdf), errsymm_pdf(esymm_pdf),
45 errplus_par(eplus_par), errminus_par(eminus_par), errsymm_par(esymm_par)
49 double central, errplus, errminus, errsymm, scale;
53 double errplus_par, errminus_par, errsymm_par;
69 PDFErrInfo(QuadParts parts,
double cl,
const std::string& errtypestr=
"")
129 return get_entry(
"SetDesc");
134 return get_entry_as<
int>(
"SetIndex", -1);
139 return get_entry_as<
int>(
"DataVersion", -1);
144 return to_lower(get_entry(
"ErrorType",
"UNKNOWN"));
161 return get_entry_as<
unsigned int>(
"NumMembers");
193 return LHAPDF::mkPDF(name(), member);
219 template <
typename PTR>
220 void mkPDFs(std::vector<PTR>& pdfs)
const {
221 const int v = verbosity();
223 std::cout <<
"LHAPDF " << version() <<
" loading all " << size() <<
" PDFs in set " << name() << std::endl;
224 this->print(std::cout, v);
225 if (
this->has_key(
"Note")) std::cout << get_entry(
"Note") << std::endl;
228 pdfs.reserve(size());
229 if (v < 2) setVerbosity(0);
230 for (size_t i = 0; i < size(); ++i) {
232 pdfs.push_back( PTR(mkPDF(i)) );
243 std::vector<PDF*> rtn;
250 template <
typename PTR>
252 std::vector<PTR> rtn;
268 std::vector<std::string> rtn = getConfig().keys();
269 for (
const std::string& k : keys_local()) {
270 if (!contains(rtn, k)) rtn.push_back(k);
277 return has_key_local(key) || getConfig().has_key(key);
282 if (has_key_local(key))
return get_entry_local(key);
283 return getConfig().get_entry(key);
288 return Info::get_entry(key, fallback);
331 double cl=
CL1SIGMA,
bool alternative=
false)
const {
333 uncertainty(rtn, values, cl, alternative);
357 const std::vector<
double>& values,
358 double cl=
CL1SIGMA,
bool alternative=
false)
const;
386 std::vector<PDFUncertainty> rtn;
387 uncertainties(rtn, observables_values, cl, alternative);
409 double correlation(
const std::vector<
double>& valuesA,
const std::vector<
double>& valuesB)
const;
435 double randomValueFromHessian(
const std::vector<
double>& values,
const std::vector<
double>& randoms,
bool symmetrise=
true)
const;
Class for PDF-set metadata and manipulation.
Definition PDFSet.h:105
size_t size() const
Number of members in this set.
Definition PDFSet.h:160
PDFErrInfo errorInfo() const
Get the structured decomposition of the error-type string.
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 a...
double errorConfLevel() const
Get the confidence level of the Hessian eigenvectors, in percent.
PDFSet(const std::string &setname)
std::vector< PTR > mkPDFs() const
Definition PDFSet.h:251
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)
Definition PDFSet.h:276
std::vector< PDF * > mkPDFs() const
Definition PDFSet.h:242
int dataversion() const
Version of this PDF set's data files.
Definition PDFSet.h:138
void print(std::ostream &os=std::cout, int verbosity=1) const
Summary printout.
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.
size_t errSize() const
Definition PDFSet.h:173
PDF * mkPDF(size_t member) const
Definition PDFSet.h:192
void _checkPdfType(const std::vector< string > &pdftypes) const
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.
int lhapdfID() const
First LHAPDF global index in this PDF set.
Definition PDFSet.h:133
std::vector< std::string > keys() const
Get the keys defined on this object or higher.
Definition PDFSet.h:267
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.
PDFErrInfo _errinfo
Cached PDF error-info breakdown struct.
Definition PDFSet.h:454
PDFUncertainty uncertainty(const std::vector< double > &values, double cl=CL1SIGMA, bool alternative=false) const
Calculate the central value and PDF uncertainty on an observable.
Definition PDFSet.h:330
std::string name() const
PDF set name.
Definition PDFSet.h:123
std::string errorType() const
Get the type of PDF errors in this set (replicas, symmhessian, hessian, custom, etc....
Definition PDFSet.h:143
PDFSet()
Definition PDFSet.h:110
const std::string & get_entry(const std::string &key) const
Retrieve a metadata string by key name.
Definition PDFSet.h:281
const std::string & get_entry(const std::string &key, const std::string &fallback) const
Retrieve a metadata string by key name, with a fallback.
Definition PDFSet.h:287
std::vector< PDFUncertainty > uncertainties(const std::vector< std::vector< double > > &observables_values, double cl=CL1SIGMA, bool alternative=false) const
Calculate PDF uncertainties on multiple observables at once.
Definition PDFSet.h:384
std::string description() const
Description of the set.
Definition PDFSet.h:128
std::string _setname
Name of this set.
Definition PDFSet.h:451
size_t errorSize() const
Definition PDFSet.h:167
void mkPDFs(std::vector< PTR > &pdfs) const
Definition PDFSet.h:220
PDF is the general interface for access to parton density information.
Definition PDF.h:40
Namespace for all LHAPDF functions and classes.
Definition AlphaS.h:14
const double CL1SIGMA
CL percentage for a Gaussian 1-sigma.
Definition PDFSet.h:20
Structure encoding the structure of the PDF error-set.
Definition PDFSet.h:63
QuadParts qparts
Error-set quadrature parts.
Definition PDFSet.h:77
std::string coreType() const
Calculated name of a quadrature part.
Definition PDFSet.h:86
size_t nmemCore() const
Number of core-set members.
double conflevel
Default confidence-level.
Definition PDFSet.h:80
PDFErrInfo(QuadParts parts, double cl, const std::string &errtypestr="")
Constructor.
Definition PDFSet.h:69
size_t nmemPar() const
Number of par-set members.
std::string errtype
Error-type annotation.
Definition PDFSet.h:83
PDFErrInfo()
Default constructor (for STL, Cython, etc.)
Definition PDFSet.h:74
std::string qpartName(size_t iq) const
Calculated name of a quadrature part.
std::vector< std::string > qpartNames() const
Calculated names of all quadrature parts.
Structure for storage of uncertainty info calculated over a PDF error set.
Definition PDFSet.h:36
PDFUncertainty(double cent=0, double eplus=0, double eminus=0, double esymm=0, double scalefactor=1, double eplus_pdf=0, double eminus_pdf=0, double esymm_pdf=0, double eplus_par=0, double eminus_par=0, double esymm_par=0)
Constructor.
Definition PDFSet.h:40
double central
Variables for the central value, +ve, -ve & symmetrised errors, and a CL scalefactor.
Definition PDFSet.h:49
double errplus_pdf
Variables for separate PDF and parameter variation errors with combined sets.
Definition PDFSet.h:52
ErrPairs errparts
Full error-breakdown of all quadrature uncertainty components, as (+,-) pairs.
Definition PDFSet.h:57
double err_par
Definition PDFSet.h:54