LHAPDF  6.5.5
Extrapolator.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_Extrapolator_H
8 #define LHAPDF_Extrapolator_H
9 
10 #include "LHAPDF/Utils.h"
11 
12 namespace LHAPDF {
13 
14 
15  // Forward declaration
16  class GridPDF;
17 
18 
19  /// The general interface for extrapolating beyond grid boundaries
20  class Extrapolator {
21  public:
22 
23  /// Destructor to allow inheritance
24  virtual ~Extrapolator() { }
25 
26 
27  /// @name Binding to a PDF object
28  ///@{
29 
30  /// Bind to a GridPDF
31  void bind(const GridPDF* pdf) { _pdf = pdf; }
32 
33  /// Unbind from GridPDF
34  void unbind() { _pdf = 0; }
35 
36  /// Identify whether this Extrapolator has an associated PDF
37  bool hasPDF() { return _pdf != 0; }
38 
39  /// Get the associated GridPDF
40  const GridPDF& pdf() const { return *_pdf; }
41 
42  ///@}
43 
44 
45  /// @name Extrapolation methods
46  ///@{
47 
48  /// Extrapolate a single-point in (x,Q)
49  ///
50  /// @param id PDG parton ID
51  /// @param x Momentum fraction
52  /// @param q Energy scale
53  /// @return The xf value at (x,q2)
54  double extrapolateXQ(int id, double x, double q) const {
55  return extrapolateXQ2(id, x, q*q );
56  }
57 
58  /// Extrapolate a single-point in (x,Q2)
59  ///
60  /// @param id PDG parton ID
61  /// @param x Momentum fraction
62  /// @param q2 Squared energy scale
63  /// @return The xf value at (x,q2)
64  virtual double extrapolateXQ2(int id, double x, double q2) const = 0;
65 
66 
67  /// @todo Make an all-PID version of extrapolateQ and Q2?
68 
69  ///@}
70 
71 
72  private:
73 
74  const GridPDF* _pdf;
75 
76  };
77 
78 
79 }
80 #endif