7 #ifndef LHAPDF_GridPDF_H
8 #define LHAPDF_GridPDF_H
10 #include "LHAPDF/PDF.h"
11 #include "LHAPDF/Interpolator.h"
12 #include "LHAPDF/Extrapolator.h"
13 #include "LHAPDF/KnotArray.h"
47 GridPDF(
const std::string& setname,
int member) {
48 _loadInfo(setname, member);
84 void _loadData(
const std::string& mempath);
105 template <
typename INTERPOLATOR>
136 template <
typename EXTRAPOLATOR>
159 double _xfxQ2(
int id,
double x,
double q2)
const;
192 const vector<double>&
q2Knots()
const;
198 assert(!
xKnots().empty());
199 if (x <
xKnots().front())
return false;
200 if (x >
xKnots().back())
return false;
207 if (q2 <
q2Knots().front())
return false;
208 if (q2 >
q2Knots().back())
return false;
const KnotArray1F & subgrid(int id, double q2) const
Get the 1-flavour subgrid for PID=id containing Q2 = q2.
Definition: GridPDF.h:176
PDF is the general interface for access to parton density information.
Definition: PDF.h:26
const vector< double > & xKnots() const
Return a representative list of interpolation knots in x.
Definition: GridPDF.h:183
const KnotArrayNF & subgrid(double q2) const
Get the N-flavour subgrid containing Q2 = q2.
void _loadExtrapolator()
Load the PDF grid data block, based on current metadata.
unique_ptr< Extrapolator > ExtrapolatorPtr
Typedef of smart pointer for xpol memory handling.
Definition: GridPDF.h:230
InterpolatorPtr _interpolator
Associated interpolator (mutable to allow laziness)
Definition: GridPDF.h:233
const std::vector< double > & xs() const
x knot accessor
Definition: KnotArray.h:63
A collection of {KnotArray1F}s accessed by PID code.
Definition: KnotArray.h:168
const vector< double > & q2Knots() const
Return a representative list of interpolation knots in Q2.
void _loadData(const std::string &mempath)
Load the PDF grid data block (not the metadata) from the given PDF member file.
const Interpolator & interpolator() const
Get the current interpolator.
bool hasInterpolator() const
Find whether an extrapolator has been set on this PDF.
Definition: GridPDF.h:117
void _loadPlugins()
Load the alphaS, interpolator, and extrapolator based on current metadata.
Definition: GridPDF.h:77
A PDF defined via an interpolation grid.
Definition: GridPDF.h:19
void setInterpolator(Interpolator *ipol)
Set the interpolator by pointer.
GridPDF(int lhaid)
Constructor from an LHAPDF ID.
Definition: GridPDF.h:55
const KnotArray1F & get_first() const
Convenience accessor for any valid subgrid, to get access to the x/Q2/etc. arrays.
Definition: KnotArray.h:189
std::vector< double > _q2knots
Caching vector of Q2 knot values.
Definition: GridPDF.h:224
const KnotArray1F & get_pid(int id) const
Get the KnotArray1F for PID code id.
Definition: KnotArray.h:183
GridPDF(const std::string &setname, int member)
Constructor from a set name and member ID.
Definition: GridPDF.h:47
void _loadInterpolator()
Load the interpolator, based on current metadata.
const Extrapolator & extrapolator() const
Get the current extrapolator.
void setExtrapolator(Extrapolator *xpol)
Set the extrapolator by pointer.
void setExtrapolator(EXTRAPOLATOR xpol)
Set the extrapolator by value.
Definition: GridPDF.h:137
virtual ~GridPDF()
Virtual destructor to allow inheritance.
Definition: GridPDF.h:63
std::map< double, KnotArrayNF > _knotarrays
Map of multi-flavour KnotArrays "binned" for lookup by low edge in Q2.
Definition: GridPDF.h:218
Metadata class for PDF members.
Definition: PDFInfo.h:18
PDFInfo _info
Metadata container.
Definition: PDF.h:503
GridPDF(const std::string &path)
Constructor from a file path.
Definition: GridPDF.h:39
bool inRangeQ2(double q2) const
Check if q2 is in the grid range.
Definition: GridPDF.h:205
The general interface for interpolating between grid points.
Definition: Interpolator.h:21
bool hasExtrapolator() const
Find whether an extrapolator has been set on this PDF.
Definition: GridPDF.h:148
std::map< double, KnotArrayNF > & knotarrays()
Directly access the knot arrays in non-const mode, for programmatic filling.
Definition: GridPDF.h:168
void setInterpolator(INTERPOLATOR ipol)
Set the interpolator by value.
Definition: GridPDF.h:106
double _xfxQ2(int id, double x, double q2) const
Get PDF xf(x,Q2) value (via grid inter/extrapolators)
int _forcePos
Cached flag for whether to return only positive (or postive definite) PDF values. ...
Definition: PDF.h:516
std::string _mempath
Member data file path.
Definition: PDF.h:500
ExtrapolatorPtr _extrapolator
Associated extrapolator (mutable to allow laziness)
Definition: GridPDF.h:236
Internal storage class for PDF data point grids.
Definition: KnotArray.h:19
bool inRangeX(double x) const
Check if x is in the grid range.
Definition: GridPDF.h:197
unique_ptr< Interpolator > InterpolatorPtr
Typedef of smart pointer for ipol memory handling.
Definition: GridPDF.h:227
GridPDF()
Default constructor, making an empty PDF to be populated by hand.
Definition: GridPDF.h:26