LHAPDF is hosted by Hepforge, IPPP Durham
LHAPDF  6.1.6
Reweighting.h
1 // -*- C++ -*-
2 //
3 // This file is part of LHAPDF
4 // Copyright (C) 2012-2016 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 
13 namespace LHAPDF {
14 
15 
16  namespace {
17  inline bool _checkAlphasQ2(double Q2, const PDF& pdfa, const PDF& pdfb, double aschk) {
18  if (aschk < 0) return true;
19  const double as_a = pdfa.alphasQ2(Q2);
20  const double as_b = pdfb.alphasQ2(Q2);
21  if (2 * std::abs(as_a - as_b) / (std::abs(as_a) + std::abs(as_b)) < aschk) return true;
22  std::cerr << "WARNING: alpha_s(Q2) mismatch in PDF reweighting "
23  << "at Q2 = " << Q2 << " GeV2:\n "
24  << as_a << " for " << pdfa.set().name() << "/" << pdfa.memberID() << " vs. "
25  << as_b << " for " << pdfb.set().name() << "/" << pdfb.memberID()
26  << std::endl;
27  return false;
28  }
29  }
30 
31 
33 
34 
37  inline double weightxQ2(int id, double x, double Q2, const PDF& basepdf, const PDF& newpdf, double aschk=5e-2) {
38  if (aschk >= 0) _checkAlphasQ2(Q2, basepdf, newpdf, aschk);
39  const double xf_base = basepdf.xfxQ2(id, x, Q2);
40  const double xf_new = newpdf.xfxQ2(id, x, Q2);
41  return xf_new / xf_base;
42  }
43 
46  template <typename PDFPTR>
47  inline double weightxQ2(int id, double x, double Q2, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2) {
48  return weightxQ2(id, x, Q2, *basepdf, *newpdf, aschk);
49  }
50 
53  inline double weightxQ(int id, double x, double Q, const PDF& basepdf, const PDF& newpdf, double aschk=5e-2) {
54  return weightxQ2(id, x, sqr(Q), basepdf, newpdf, aschk);
55  }
56 
59  template <typename PDFPTR>
60  inline double weightxQ(int id, double x, double Q, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2) {
61  return weightxQ(id, x, Q, *basepdf, *newpdf, aschk);
62  }
63 
65 
66 
68 
69 
72  inline double weightxxQ2(int id1, int id2, double x1, double x2, double Q2, const PDF& basepdf, const PDF& newpdf, double aschk=5e-2) {
73  if (aschk >= 0) _checkAlphasQ2(Q2, basepdf, newpdf, aschk);
74  const double w1 = weightxQ2(id1, x1, Q2, basepdf, newpdf, -1);
75  const double w2 = weightxQ2(id2, x2, Q2, basepdf, newpdf, -1);
76  return w1 * w2;
77  }
78 
81  template <typename PDFPTR>
82  inline double weightxxQ2(int id1, int id2, double x1, double x2, double Q2, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2) {
83  return weightxxQ2(id1, id2, x1, x2, Q2, *basepdf, *newpdf, aschk);
84  }
85 
88  inline double weightxxQ(int id1, int id2, double x1, double x2, double Q, const PDF& basepdf, const PDF& newpdf, double aschk=5e-2) {
89  return weightxxQ2(id1, id2, x1, x2, sqr(Q), basepdf, newpdf, aschk);
90  }
91 
94  template <typename PDFPTR>
95  inline double weightxxQ(int id1, int id2, double x1, double x2, double Q, const PDFPTR basepdf, const PDFPTR newpdf, double aschk=5e-2) {
96  return weightxxQ(id1, id2, x1, x2, Q, *basepdf, *newpdf, aschk);
97  }
98 
100 
101 
102 }
103 #endif
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.
Definition: PDF.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:88
N sqr(const N &x)
Convenience function for squaring (of any type)
Definition: Utils.h:217
double weightxQ(int id, double x, double Q, const PDF &basepdf, const PDF &newpdf, double aschk=5e-2)
Definition: Reweighting.h:53
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:72
Namespace for all LHAPDF functions and classes.
Definition: AlphaS.h:14
double weightxQ2(int id, double x, double Q2, const PDF &basepdf, const PDF &newpdf, double aschk=5e-2)
Definition: Reweighting.h:37