lhapdf is hosted by Hepforge, IPPP Durham
LHAPDF 6.5.4
Loading...
Searching...
No Matches
/examples/analyticpdf.cc
#include "LHAPDF/PDF.h"
#include <iostream>
using namespace std;
struct AnalyticPDF : public LHAPDF::PDF {
AnalyticPDF() {
info().set_entry("Flavors", "-5,-4,-3,-2,-1,21,1,2,3,4,5");
}
double _xfxQ2(int id, double x, double q2) const {
if (abs(id) > 5 && id != 21) return 0;
return 0.15 * sin(20.0*x) * sin(20.0*q2);
}
void _xfxQ2(double x, double q2, std::vector<double>& ret) const {
for (int id(-5); id<5; ++id)
_xfxQ2(id,x,q2);
}
bool inRangeX(double x) const { return true; }
bool inRangeQ2(double q2) const { return true; }
};
int main(int argc, const char* argv[]) {
AnalyticPDF apdf;
LHAPDF::PDF& pdf = apdf;
for (double x = 0; x < 1.0; x += 0.1) {
for (double logq2 = 1; logq2 < 6; logq2 += 0.5) {
const double q2 = pow(10, logq2);
cout << x << " " << q2 << " " << pdf.xfxQ2(21, x, q2) << endl;
}
}
return 0;
}
void set_entry(const std::string &key, const T &val)
Set a keyed value entry.
Definition Info.h:158
PDF is the general interface for access to parton density information.
Definition PDF.h:40
double xfxQ2(int id, double x, double q2) const
Get the PDF xf(x) value at (x,q2) for the given PID.
virtual double _xfxQ2(int id, double x, double q2) const =0
Calculate the PDF xf(x) value at (x,q2) for the given PID.
virtual bool inRangeQ2(double q2) const =0
Grid range check for Q2.
PDFInfo & info()
Get the info class that actually stores and handles the metadata.
Definition PDF.h:352
virtual bool inRangeX(double x) const =0
Grid range check for x.