7 #ifndef LHAPDF_Reweighting_H
8 #define LHAPDF_Reweighting_H
10 #include "LHAPDF/PDF.h"
11 #include "LHAPDF/PDFSet.h"
20 inline bool _checkAlphasQ2(
double Q2,
const PDF& pdfa,
const PDF& pdfb,
double aschk) {
21 if (aschk < 0)
return true;
22 const double as_a = pdfa.alphasQ2(Q2);
23 const double as_b = pdfb.alphasQ2(Q2);
24 if (2 * std::abs(as_a - as_b) / (std::abs(as_a) + std::abs(as_b)) < aschk)
return true;
25 std::cerr <<
"WARNING: alpha_s(Q2) mismatch in PDF reweighting "
26 <<
"at Q2 = " << Q2 <<
" GeV2:\n "
27 << as_a <<
" for " << pdfa.set().name() <<
"/" << pdfa.memberID() <<
" vs. "
28 << as_b <<
" for " << pdfb.set().name() <<
"/" << pdfb.memberID()
40 inline double weightxQ2(
int id,
double x,
double Q2,
const PDF& basepdf,
const PDF& newpdf,
double aschk=5e-2) {
41 if (aschk >= 0) _checkAlphasQ2(Q2, basepdf, newpdf, aschk);
42 const double xf_base = basepdf.
xfxQ2(
id, x, Q2);
43 const double xf_new = newpdf.
xfxQ2(
id, x, Q2);
44 return xf_new / xf_base;
49 template <
typename PDFPTR>
50 inline double weightxQ2(
int id,
double x,
double Q2,
const PDFPTR basepdf,
const PDFPTR newpdf,
double aschk=5e-2) {
51 return weightxQ2(
id, x, Q2, *basepdf, *newpdf, aschk);
56 inline double weightxQ(
int id,
double x,
double Q,
const PDF& basepdf,
const PDF& newpdf,
double aschk=5e-2) {
62 template <
typename PDFPTR>
63 inline double weightxQ(
int id,
double x,
double Q,
const PDFPTR basepdf,
const PDFPTR newpdf,
double aschk=5e-2) {
64 return weightxQ(
id, x, Q, *basepdf, *newpdf, aschk);
75 inline double weightxxQ2(
int id1,
int id2,
double x1,
double x2,
double Q2,
const PDF& basepdf,
const PDF& newpdf,
double aschk=5e-2) {
76 if (aschk >= 0) _checkAlphasQ2(Q2, basepdf, newpdf, aschk);
77 const double w1 =
weightxQ2(id1, x1, Q2, basepdf, newpdf, -1);
78 const double w2 =
weightxQ2(id2, x2, Q2, basepdf, newpdf, -1);
84 template <
typename PDFPTR>
85 inline double weightxxQ2(
int id1,
int id2,
double x1,
double x2,
double Q2,
const PDFPTR basepdf,
const PDFPTR newpdf,
double aschk=5e-2) {
86 return weightxxQ2(id1, id2, x1, x2, Q2, *basepdf, *newpdf, aschk);
91 inline double weightxxQ(
int id1,
int id2,
double x1,
double x2,
double Q,
const PDF& basepdf,
const PDF& newpdf,
double aschk=5e-2) {
92 return weightxxQ2(id1, id2, x1, x2,
sqr(Q), basepdf, newpdf, aschk);
97 template <
typename PDFPTR>
98 inline double weightxxQ(
int id1,
int id2,
double x1,
double x2,
double Q,
const PDFPTR basepdf,
const PDFPTR newpdf,
double aschk=5e-2) {
99 return weightxxQ(id1, id2, x1, x2, Q, *basepdf, *newpdf, aschk);
PDF is the general interface for access to parton density information.
Definition: PDF.h:26
double xfxQ2(int id, double x, double q2) const
Get the PDF xf(x) value at (x,q2) for the given PID.
N sqr(const N &x)
Convenience function for squaring (of any type)
Definition: Utils.h:208
Namespace for all LHAPDF functions and classes.
Definition: AlphaS.h:14
double weightxxQ2(int id1, int id2, double x1, double x2, double Q2, const PDF &basepdf, const PDF &newpdf, double aschk=5e-2)
Definition: Reweighting.h:75
double weightxQ2(int id, double x, double Q2, const PDF &basepdf, const PDF &newpdf, double aschk=5e-2)
Definition: Reweighting.h:40
double weightxQ(int id, double x, double Q, const PDF &basepdf, const PDF &newpdf, double aschk=5e-2)
Definition: Reweighting.h:56
double weightxxQ(int id1, int id2, double x1, double x2, double Q, const PDF &basepdf, const PDF &newpdf, double aschk=5e-2)
Definition: Reweighting.h:91