lhapdf is hosted by Hepforge, IPPP Durham
LHAPDF 6.5.5
Loading...
Searching...
No Matches
Reweighting.h
1// -*- C++ -*-
2//
3// This file is part of LHAPDF
4// Copyright (C) 2012-2024 The LHAPDF collaboration (see AUTHORS for details)
5//
6#pragma once
7#ifndef LHAPDF_Reweighting_H
8#define LHAPDF_Reweighting_H
9
10#include "LHAPDF/PDF.h"
11#include "LHAPDF/PDFSet.h"
12
13namespace LHAPDF {
14
15
16 /// @defgroup reweight PDF reweighting
17 /// @{
18
19 namespace {
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()
29 << std::endl;
30 return false;
31 }
32 }
33
34
35 /// @defgroup reweight_single Single-beam reweighting
36 /// @{
37
38 /// Get the PDF reweighting factor for a single beam with id,x,Q parameters, from basepdf to newpdf
39 ///
40 /// @note For NLO calculations, in general different PDF values enter for each counterterm: be careful.
41 inline double weightxQ2(int id, double x, double Q2, const PDF& basepdf, const PDF& newpdf, double aschk=5e-2) {
42 if (aschk >= 0) _checkAlphasQ2(Q2, basepdf, newpdf, aschk);
43 const double xf_base = basepdf.xfxQ2(id, x, Q2);
44 const double xf_new = newpdf.xfxQ2(id, x, Q2);
45 return xf_new / xf_base;
46 }
47
48 /// Get the PDF reweighting factor for a single beam with id,x,Q parameters, from basepdf to newpdf
49 ///
50 /// @note For NLO calculations, in general different PDF values enter for each counterterm: be careful.
51 template <typename PDFPTR>
52 inline double weightxQ2(int id, double x, double Q2, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2) {
53 return weightxQ2(id, x, Q2, *basepdf, *newpdf, aschk);
54 }
55
56 /// Get the PDF reweighting factor for a single beam with id,x,Q parameters, from basepdf to newpdf
57 ///
58 /// @note For NLO calculations, in general different PDF values enter for each counterterm: be careful.
59 inline double weightxQ(int id, double x, double Q, const PDF& basepdf, const PDF& newpdf, double aschk=5e-2) {
60 return weightxQ2(id, x, sqr(Q), basepdf, newpdf, aschk);
61 }
62
63 /// Get the PDF reweighting factor for a single beam with id,x,Q parameters, from basepdf to newpdf
64 ///
65 /// @note For NLO calculations, in general different PDF values enter for each counterterm: be careful.
66 template <typename PDFPTR>
67 inline double weightxQ(int id, double x, double Q, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2) {
68 return weightxQ(id, x, Q, *basepdf, *newpdf, aschk);
69 }
70
71 /// @}
72
73
74 /// @defgroup reweight_double Two-beam reweighting
75 /// @{
76
77 /// Get the PDF reweighting factor for two beams, one with id1,x1 and the other with id2,x2, from basepdf to newpdf
78 ///
79 /// @note For NLO calculations, in general different PDF values enter for each counterterm: be careful.
80 inline double weightxxQ2(int id1, int id2, double x1, double x2, double Q2, const PDF& basepdf, const PDF& newpdf, double aschk=5e-2) {
81 if (aschk >= 0) _checkAlphasQ2(Q2, basepdf, newpdf, aschk);
82 const double w1 = weightxQ2(id1, x1, Q2, basepdf, newpdf, -1);
83 const double w2 = weightxQ2(id2, x2, Q2, basepdf, newpdf, -1);
84 return w1 * w2;
85 }
86
87 /// Get the PDF reweighting factor for two beams, one with id1,x1 and the other with id2,x2, from basepdf to newpdf
88 ///
89 /// @note For NLO calculations, in general different PDF values enter for each counterterm: be careful.
90 template <typename PDFPTR>
91 inline double weightxxQ2(int id1, int id2, double x1, double x2, double Q2, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2) {
92 return weightxxQ2(id1, id2, x1, x2, Q2, *basepdf, *newpdf, aschk);
93 }
94
95 /// Get the PDF reweighting factor for two beams, one with id1,x1 and the other with id2,x2, from basepdf to newpdf
96 ///
97 /// @note For NLO calculations, in general different PDF values enter for each counterterm: be careful.
98 inline double weightxxQ(int id1, int id2, double x1, double x2, double Q, const PDF& basepdf, const PDF& newpdf, double aschk=5e-2) {
99 return weightxxQ2(id1, id2, x1, x2, sqr(Q), basepdf, newpdf, aschk);
100 }
101
102 /// Get the PDF reweighting factor for two beams, one with id1,x1 and the other with id2,x2, from basepdf to newpdf
103 ///
104 /// @note For NLO calculations, in general different PDF values enter for each counterterm: be careful.
105 template <typename PDFPTR>
106 inline double weightxxQ(int id1, int id2, double x1, double x2, double Q, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2) {
107 return weightxxQ(id1, id2, x1, x2, Q, *basepdf, *newpdf, aschk);
108 }
109
110 /// @}
111
112 /// @}
113
114}
115#endif
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:80
double weightxxQ(int id1, int id2, double x1, double x2, double Q, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2)
Definition Reweighting.h:106
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:98
double weightxxQ2(int id1, int id2, double x1, double x2, double Q2, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2)
Definition Reweighting.h:91
double weightxQ(int id, double x, double Q, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2)
Definition Reweighting.h:67
double weightxQ2(int id, double x, double Q2, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2)
Definition Reweighting.h:52
double weightxQ2(int id, double x, double Q2, const PDF &basepdf, const PDF &newpdf, double aschk=5e-2)
Definition Reweighting.h:41
double weightxQ(int id, double x, double Q, const PDF &basepdf, const PDF &newpdf, double aschk=5e-2)
Definition Reweighting.h:59
Namespace for all LHAPDF functions and classes.
Definition AlphaS.h:14