lhapdf
is hosted by
Hepforge
,
IPPP Durham
LHAPDF
6.5.4
Loading...
Searching...
No Matches
include
LHAPDF
GridPDF.h
1
// -*- C++ -*-
2
//
3
// This file is part of LHAPDF
4
// Copyright (C) 2012-2023 The LHAPDF collaboration (see AUTHORS for details)
5
//
6
#pragma once
7
#ifndef LHAPDF_GridPDF_H
8
#define LHAPDF_GridPDF_H
9
10
#include "LHAPDF/PDF.h"
11
#include "LHAPDF/Interpolator.h"
12
#include "LHAPDF/Extrapolator.h"
13
#include "LHAPDF/KnotArray.h"
14
15
namespace
LHAPDF
{
16
17
19
class
GridPDF
:
public
PDF
{
20
public
:
21
23
GridPDF
() {
24
_mempath
=
""
;
25
_info
=
PDFInfo
();
26
_forcePos
= -1;
27
}
28
36
GridPDF
(
const
std::string& path) {
37
_loadInfo(path);
// Sets _mempath
38
_loadPlugins
();
39
_loadData
(
_mempath
);
40
_forcePos
= -1;
41
}
42
44
GridPDF
(
const
std::string& setname,
int
member) {
45
_loadInfo(setname, member);
// Sets _mempath
46
_loadData
(
_mempath
);
47
_loadPlugins
();
48
_forcePos
= -1;
49
}
50
52
GridPDF
(
int
lhaid) {
53
_loadInfo(lhaid);
// Sets _mempath
54
_loadData
(
_mempath
);
55
_loadPlugins
();
56
_forcePos
= -1;
57
}
58
60
virtual
~GridPDF
() { }
61
62
63
protected
:
64
66
void
_loadInterpolator
();
67
69
void
_loadExtrapolator
();
70
72
void
_loadPlugins
() {
73
_loadAlphaS();
74
_loadInterpolator
();
75
_loadExtrapolator
();
76
}
77
79
void
_loadData
(
const
std::string& mempath);
80
82
void
_computePolynomialCoefficients
(
bool
logspace);
83
84
85
public
:
86
89
95
void
setInterpolator
(
Interpolator
* ipol);
96
103
template
<
typename
INTERPOLATOR>
104
void
setInterpolator
(INTERPOLATOR ipol) {
105
setInterpolator
(
new
INTERPOLATOR(ipol));
106
}
107
112
void
setInterpolator
(
const
std::string& ipolname);
113
115
bool
hasInterpolator
()
const
{
return
bool(
_interpolator
); }
116
118
const
Interpolator
&
interpolator
()
const
;
119
120
126
void
setExtrapolator
(
Extrapolator
* xpol);
127
134
template
<
typename
EXTRAPOLATOR>
135
void
setExtrapolator
(EXTRAPOLATOR xpol) {
136
setExtrapolator
(
new
EXTRAPOLATOR(xpol));
137
}
138
143
void
setExtrapolator
(
const
std::string& xpolname);
144
146
bool
hasExtrapolator
()
const
{
return
bool(
_extrapolator
); }
147
149
const
Extrapolator
&
extrapolator
()
const
;
150
152
153
154
protected
:
155
157
double
_xfxQ2
(
int
id
,
double
x,
double
q2)
const
;
158
159
void
_xfxQ2
(
double
x,
double
q2, std::vector<double>& ret)
const
;
160
161
162
public
:
163
166
167
// accerror to new data structure
168
const
KnotArray
& knotarray()
const
{
169
return
data;
170
}
171
172
KnotArray
& Data() {
173
return
data;
174
}
175
179
const
vector<double>&
xKnots
()
const
;
180
184
const
vector<double>&
q2Knots
()
const
;
185
186
public
:
187
189
bool
inRangeX
(
double
x)
const
{
190
return
data.
inRangeX
(x);
191
}
192
194
bool
inRangeQ2
(
double
q2)
const
{
195
return
data.
inRangeQ2
(q2);
196
}
198
199
private
:
200
// *new* memory object, to handle basically everything
201
// name?
202
KnotArray
data;
203
205
typedef
unique_ptr<Interpolator>
InterpolatorPtr
;
206
208
typedef
unique_ptr<Extrapolator>
ExtrapolatorPtr
;
209
211
mutable
InterpolatorPtr
_interpolator
;
212
214
mutable
ExtrapolatorPtr
_extrapolator
;
215
216
};
217
218
219
}
220
#endif
LHAPDF::Extrapolator
The general interface for extrapolating beyond grid boundaries.
Definition
Extrapolator.h:20
LHAPDF::GridPDF
A PDF defined via an interpolation grid.
Definition
GridPDF.h:19
LHAPDF::GridPDF::inRangeX
bool inRangeX(double x) const
Check if x is in the grid range.
Definition
GridPDF.h:189
LHAPDF::GridPDF::_extrapolator
ExtrapolatorPtr _extrapolator
Associated extrapolator (mutable to allow laziness)
Definition
GridPDF.h:214
LHAPDF::GridPDF::_loadInterpolator
void _loadInterpolator()
Load the interpolator, based on current metadata.
LHAPDF::GridPDF::interpolator
const Interpolator & interpolator() const
Get the current interpolator.
LHAPDF::GridPDF::_loadPlugins
void _loadPlugins()
Load the alphaS, interpolator, and extrapolator based on current metadata.
Definition
GridPDF.h:72
LHAPDF::GridPDF::hasInterpolator
bool hasInterpolator() const
Find whether an extrapolator has been set on this PDF.
Definition
GridPDF.h:115
LHAPDF::GridPDF::setInterpolator
void setInterpolator(const std::string &ipolname)
Set the interpolator by name.
LHAPDF::GridPDF::_computePolynomialCoefficients
void _computePolynomialCoefficients(bool logspace)
Precompute polynomial coefficients and approximate derivatives at knot positions.
LHAPDF::GridPDF::ExtrapolatorPtr
unique_ptr< Extrapolator > ExtrapolatorPtr
Typedef of smart pointer for xpol memory handling.
Definition
GridPDF.h:208
LHAPDF::GridPDF::InterpolatorPtr
unique_ptr< Interpolator > InterpolatorPtr
Typedef of smart pointer for ipol memory handling.
Definition
GridPDF.h:205
LHAPDF::GridPDF::_loadData
void _loadData(const std::string &mempath)
Load the PDF grid data block (not the metadata) from the given PDF member file.
LHAPDF::GridPDF::setInterpolator
void setInterpolator(Interpolator *ipol)
Set the interpolator by pointer.
LHAPDF::GridPDF::GridPDF
GridPDF(const std::string &path)
Constructor from a file path.
Definition
GridPDF.h:36
LHAPDF::GridPDF::GridPDF
GridPDF(int lhaid)
Constructor from an LHAPDF ID.
Definition
GridPDF.h:52
LHAPDF::GridPDF::setExtrapolator
void setExtrapolator(Extrapolator *xpol)
Set the extrapolator by pointer.
LHAPDF::GridPDF::~GridPDF
virtual ~GridPDF()
Virtual destructor to allow inheritance.
Definition
GridPDF.h:60
LHAPDF::GridPDF::setExtrapolator
void setExtrapolator(EXTRAPOLATOR xpol)
Set the extrapolator by value.
Definition
GridPDF.h:135
LHAPDF::GridPDF::q2Knots
const vector< double > & q2Knots() const
Return a representative list of interpolation knots in Q2.
LHAPDF::GridPDF::_interpolator
InterpolatorPtr _interpolator
Associated interpolator (mutable to allow laziness)
Definition
GridPDF.h:211
LHAPDF::GridPDF::hasExtrapolator
bool hasExtrapolator() const
Find whether an extrapolator has been set on this PDF.
Definition
GridPDF.h:146
LHAPDF::GridPDF::inRangeQ2
bool inRangeQ2(double q2) const
Check if q2 is in the grid range.
Definition
GridPDF.h:194
LHAPDF::GridPDF::GridPDF
GridPDF()
Default constructor, making an empty PDF to be populated by hand.
Definition
GridPDF.h:23
LHAPDF::GridPDF::GridPDF
GridPDF(const std::string &setname, int member)
Constructor from a set name and member ID.
Definition
GridPDF.h:44
LHAPDF::GridPDF::setInterpolator
void setInterpolator(INTERPOLATOR ipol)
Set the interpolator by value.
Definition
GridPDF.h:104
LHAPDF::GridPDF::_xfxQ2
double _xfxQ2(int id, double x, double q2) const
Get PDF xf(x,Q2) value (via grid inter/extrapolators)
LHAPDF::GridPDF::extrapolator
const Extrapolator & extrapolator() const
Get the current extrapolator.
LHAPDF::GridPDF::_loadExtrapolator
void _loadExtrapolator()
Load the PDF grid data block, based on current metadata.
LHAPDF::GridPDF::setExtrapolator
void setExtrapolator(const std::string &xpolname)
Set the extrapolator by name.
LHAPDF::GridPDF::xKnots
const vector< double > & xKnots() const
Return a representative list of interpolation knots in x.
LHAPDF::Interpolator
The general interface for interpolating between grid points.
Definition
Interpolator.h:21
LHAPDF::KnotArray
Internal storage class for PDF data point grids.
Definition
KnotArray.h:46
LHAPDF::KnotArray::inRangeX
bool inRangeX(double x) const
check if value within the boundaries of xknots
Definition
KnotArray.h:91
LHAPDF::KnotArray::inRangeQ2
bool inRangeQ2(double q2) const
check if value within the boundaries of q2knots
Definition
KnotArray.h:98
LHAPDF::PDFInfo
Metadata class for PDF members.
Definition
PDFInfo.h:18
LHAPDF::PDF
PDF is the general interface for access to parton density information.
Definition
PDF.h:40
LHAPDF::PDF::_mempath
std::string _mempath
Member data file path.
Definition
PDF.h:532
LHAPDF::PDF::_forcePos
int _forcePos
Cached flag for whether to return only positive (or positive definite) PDF values.
Definition
PDF.h:548
LHAPDF::PDF::_info
PDFInfo _info
Metadata container.
Definition
PDF.h:535
LHAPDF
Namespace for all LHAPDF functions and classes.
Definition
AlphaS.h:14
Generated on Thu Sep 26 2024 15:19:26 for LHAPDF by
1.12.0