lhapdf is hosted by Hepforge, IPPP Durham
LHAPDF  6.4.0
AlphaS.h
1 // -*- C++ -*-
2 //
3 // This file is part of LHAPDF
4 // Copyright (C) 2012-2021 The LHAPDF collaboration (see AUTHORS for details)
5 //
6 #pragma once
7 #ifndef LHAPDF_AlphaS_H
8 #define LHAPDF_AlphaS_H
9 
10 #include "LHAPDF/Utils.h"
11 #include "LHAPDF/Exceptions.h"
12 #include "LHAPDF/KnotArray.h"
13 
14 namespace LHAPDF {
15 
16 
24  class AlphaS {
25  public:
26 
28  AlphaS();
29 
31  virtual ~AlphaS() {};
32 
35 
37  double alphasQ(double q) const { return alphasQ2(q*q); }
38 
41  virtual double alphasQ2(double q2) const = 0;
42 
44 
45 
48 
50  int numFlavorsQ(double q) const { return numFlavorsQ2(q*q); }
51 
53  virtual int numFlavorsQ2(double q2) const;
54 
56  double quarkMass(int id) const;
57 
61  void setQuarkMass(int id, double value);
62 
66  double quarkThreshold(int id) const;
67 
71  void setQuarkThreshold(int id, double value);
72 
76  int orderQCD() { return _qcdorder; }
77 
81  void setOrderQCD(int order) { _qcdorder = order; }
82 
86  void setMZ(double mz) { _mz = mz; }
87 
91  void setAlphaSMZ(double alphas) { _alphas_mz = alphas; }
92 
96  void setMassReference(double mref) { _mreference = mref; _customref = true; }
97 
101  void setAlphaSReference(double alphas) { _alphas_reference = alphas; _customref = true; }
102 
106  virtual void setLambda(unsigned int, double) {};
107 
109  enum FlavorScheme { FIXED, VARIABLE };
110 
112  virtual std::string type() const = 0;
113 
115  void setFlavorScheme(FlavorScheme scheme, int nf = -1);
116 
119 
121 
122 
123  protected:
124 
127 
131  double _beta(int i, int nf) const;
132 
135  std::vector<double> _betas(int nf) const;
136 
138 
139 
140  protected:
141 
144 
146  double _mz;
147 
149  double _alphas_mz;
150 
152  double _mreference;
153 
156 
159 
163  std::map<int, double> _quarkmasses, _flavorthresholds;
164 
167 
169  int _fixflav;
170 
171  };
172 
173 
174 
176  class AlphaS_Analytic : public AlphaS {
177  public:
178 
180  std::string type() const { return "analytic"; }
181 
183  double alphasQ2(double q2) const;
184 
186  int numFlavorsQ2(double q2) const;
187 
189  void setLambda(unsigned int i, double lambda);
190 
191 
192  private:
193 
195  double _lambdaQCD(int nf) const;
196 
198  void _setFlavors();
199 
200 
202  std::map<int, double> _lambdas;
203 
205  int _nfmax;
207  int _nfmin;
208 
209  };
210 
211 
212 
216  class AlphaS_Ipol : public AlphaS {
217  public:
218 
220  std::string type() const { return "ipol"; }
221 
223  double alphasQ2(double q2) const;
224 
228  void setQValues(const std::vector<double>& qs);
229 
235  void setQ2Values(const std::vector<double>& q2s) { _q2s = q2s; }
236 
242  void setAlphaSValues(const std::vector<double>& as) { _as = as; }
243 
244 
245  private:
246 
248  double _interpolateCubic(double T, double VL, double VDL, double VH, double VDH) const;
250  double _ddq_central( size_t i ) const;
252  double _ddq_forward( size_t i ) const;
254  double _ddq_backward( size_t i ) const;
255 
258  void _setup_grids() const;
259 
260 
263  mutable std::map<double, AlphaSArray> _knotarrays;
264 
266  std::vector<double> _q2s;
268  std::vector<double> _as;
269 
270  };
271 
272 
273 
275  class AlphaS_ODE : public AlphaS {
276  public:
277 
279  std::string type() const { return "ode"; }
280 
282  double alphasQ2( double q2 ) const;
283 
285  void setMZ( double mz ) { _mz = mz; _calculated = false; }
286 
288  void setAlphaSMZ( double alphas ) { _alphas_mz = alphas; _calculated = false; }
289 
291  void setMassReference( double mref ) { _mreference = mref; _calculated = false; _customref = true; }
292 
294  void setAlphaSReference( double alphas ) { _alphas_reference = alphas; _calculated = false; _customref = true; }
295 
297  void setQValues(const std::vector<double>& qs);
298 
302  void setQ2Values( std::vector<double> q2s ) { _q2s = q2s; _calculated = false; }
303 
304 
305  private:
306 
308  double _derivative(double t, double y, const std::vector<double>& beta) const;
309 
312  double _decouple(double y, double t, unsigned int ni, unsigned int nf) const;
313 
315  void _rk4(double& t, double& y, double h, const double allowed_change, const vector<double>& bs) const;
316 
318  void _solve(double q2, double& t, double& y, const double& allowed_relative, double h, double accuracy) const;
319 
321  void _interpolate() const;
322 
323 
325  mutable std::vector<double> _q2s;
326 
328  mutable bool _calculated;
329 
332 
333  };
334 
335 
336 }
337 #endif
virtual void setLambda(unsigned int, double)
Set the {i}th Lambda constant for i active flavors.
Definition: AlphaS.h:106
void setMassReference(double mref)
Set the Z mass used in this alpha_s.
Definition: AlphaS.h:96
std::string type() const
Implementation type of this solver.
Definition: AlphaS.h:220
double quarkMass(int id) const
Get a quark mass by PDG code.
Definition: AlphaS.h:216
void setMZ(double mz)
Set MZ, and also the caching flag.
Definition: AlphaS.h:285
AlphaS_Ipol _ipol
The interpolation used to get Alpha_s after the ODE has been solved.
Definition: AlphaS.h:331
void setAlphaSMZ(double alphas)
Set alpha_s(MZ), and also the caching flag.
Definition: AlphaS.h:288
FlavorScheme flavorScheme() const
Get flavor scheme.
Definition: AlphaS.h:118
void setAlphaSMZ(double alphas)
Set the alpha_s(MZ) used in this alpha_s.
Definition: AlphaS.h:91
std::map< double, AlphaSArray > _knotarrays
Definition: AlphaS.h:263
FlavorScheme _flavorscheme
The flavor scheme in use.
Definition: AlphaS.h:166
bool _customref
Decides whether to use custom reference values or fall back on MZ/AlphaS_MZ.
Definition: AlphaS.h:158
virtual int numFlavorsQ2(double q2) const
Calculate the number of active flavours at energy scale Q2.
FlavorScheme
Enum of flavor schemes.
Definition: AlphaS.h:109
std::string type() const
Implementation type of this solver.
Definition: AlphaS.h:279
void setAlphaSReference(double alphas)
Set the alpha_s(MZ) used in this alpha_s.
Definition: AlphaS.h:101
int _nfmax
Max number of flavors.
Definition: AlphaS.h:205
virtual std::string type() const =0
Get the implementation type of this AlphaS.
int orderQCD()
Definition: AlphaS.h:76
std::map< int, double > _lambdas
LambdaQCD values.
Definition: AlphaS.h:202
void setAlphaSReference(double alphas)
Set alpha_s(MZ), and also the caching flag.
Definition: AlphaS.h:294
double _alphas_mz
Value of alpha_s(MZ)
Definition: AlphaS.h:149
std::vector< double > _q2s
Vector of Q2s in case specific anchor points are used.
Definition: AlphaS.h:325
int numFlavorsQ(double q) const
Calculate the number of active flavours at energy scale Q.
Definition: AlphaS.h:50
double alphasQ(double q) const
Calculate alphaS(Q)
Definition: AlphaS.h:37
double quarkThreshold(int id) const
Get a flavor scale threshold by PDG code.
int _fixflav
The allowed numbers of flavours in a fixed scheme.
Definition: AlphaS.h:169
int _qcdorder
Order of QCD evolution (expressed as number of loops)
Definition: AlphaS.h:143
void setAlphaSValues(const std::vector< double > &as)
Definition: AlphaS.h:242
std::vector< double > _q2s
Array of ipol knots in Q2.
Definition: AlphaS.h:266
std::vector< double > _betas(int nf) const
double _mreference
Reference mass in GeV.
Definition: AlphaS.h:152
virtual double alphasQ2(double q2) const =0
std::vector< double > _as
Array of alpha_s values for the Q2 knots.
Definition: AlphaS.h:268
double _alphas_reference
Value of alpha_s(reference mass)
Definition: AlphaS.h:155
void setQ2Values(const std::vector< double > &q2s)
Definition: AlphaS.h:235
bool _calculated
Whether or not the ODE has been solved yet.
Definition: AlphaS.h:328
virtual ~AlphaS()
Destructor.
Definition: AlphaS.h:31
std::string type() const
Implementation type of this solver.
Definition: AlphaS.h:180
Solve the differential equation in alphaS using an implementation of RK4.
Definition: AlphaS.h:275
void setMZ(double mz)
Set the Z mass used in this alpha_s.
Definition: AlphaS.h:86
Namespace for all LHAPDF functions and classes.
Definition: AlphaS.h:14
std::map< int, double > _quarkmasses
Definition: AlphaS.h:163
AlphaS()
Base class constructor for default param setup.
void setQ2Values(std::vector< double > q2s)
Set the array of Q2 values for interpolation, and also the caching flag.
Definition: AlphaS.h:302
void setFlavorScheme(FlavorScheme scheme, int nf=-1)
Set flavor scheme of alpha_s solver.
Calculator interface for computing alpha_s(Q2) in various ways.
Definition: AlphaS.h:24
double _mz
Mass of the Z boson in GeV.
Definition: AlphaS.h:146
void setMassReference(double mref)
Set reference mass, and also the caching flag.
Definition: AlphaS.h:291
void setQuarkThreshold(int id, double value)
Set a flavor threshold by PDG code (= quark masses by default)
double _beta(int i, int nf) const
Calculate alpha_s(Q2) by an analytic approximation.
Definition: AlphaS.h:176
void setOrderQCD(int order)
Set the order of QCD (expressed as number of loops)
Definition: AlphaS.h:81
int _nfmin
Min number of flavors.
Definition: AlphaS.h:207
void setQuarkMass(int id, double value)
Set quark masses by PDG code.