Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Integrator.hh
Go to the documentation of this file.
1 ///
2 /// @file Integrator.hh
3 /// @brief Hammer numerical integration classes
4 ///
5 
6 //**** This file is a part of the HAMMER library
7 //**** Copyright (C) 2016 - 2020 The HAMMER Collaboration
8 //**** HAMMER is licensed under version 3 of the GPL; see COPYING for details
9 //**** Please note the MCnet academic guidelines; see GUIDELINES for details
10 
11 // -*- C++ -*-
12 #ifndef HAMMER_MATH_Integrator_HH
13 #define HAMMER_MATH_Integrator_HH
14 
15 #include <functional>
16 #include <vector>
17 
19 
20 namespace Hammer {
21 
22  /// @brief integration function based on gaussian method
23  /// @param[in] func the function to be integrated
24  /// @param[in] low the lower limit of integration
25  /// @param[in] high the higher limit of integration
26  /// @return the integral
27  double integrate(std::function<double(double)>& func, double low, double high);
28 
29 
30  /// @brief Tensor integration class
31  ///
32  /// ...
33  ///
34  /// @ingroup Math
35  class Integrator {
36 
37  public:
38  Integrator();
39 
40  Integrator(const Integrator& other) = default;
41  Integrator& operator=(const Integrator& other) = default;
42 
43  virtual ~Integrator();
44 
45  public:
46  /// @brief returns the position of the evaluation points given an integration range
47  /// @return the points where the function (tensor) should be evaluated
48  const EvaluationGrid& getEvaluationPoints() const;
49 
51 
52  /// @brief apply rescaling factor for the size of the interval from the canonical [-1,1] interval
53  /// to the actual one, \f$ (x_{max}-x_{min})/2 \f$
54  /// @param[in] boundaries the lower limit of integration
55  void applyRange(const IntegrationBoundaries& boundaries);
56 
57  void applyRange(IntegrationBoundaries&& boundaries);
58 
59  /// @brief the number of evaluation points
60  uint16_t getPointsNumber() const;
61 
62  private:
63  std::vector<double> _basePoints; ///< the evaluation points in the range [-1,1]
64  std::vector<double> _baseWeights; ///< the evaluation weights for the range [-1,1]
67 
68  };
69 
70 } // namespace Hammer
71 
72 #endif
double integrate(std::function< double(double)> &func, double low, double high)
integration function based on gaussian method
Definition: Integrator.cc:22
const EvaluationWeights & getEvaluationWeights() const
Definition: Integrator.cc:111
Hammer numerical integration forward declarations.
std::vector< double > _baseWeights
the evaluation weights for the range [-1,1]
Definition: Integrator.hh:64
virtual ~Integrator()
Definition: Integrator.cc:100
const EvaluationGrid & getEvaluationPoints() const
returns the position of the evaluation points given an integration range
Definition: Integrator.cc:107
Integrator & operator=(const Integrator &other)=default
std::vector< BoundaryFunction > IntegrationBoundaries
Definition: Integrator.fhh:25
EvaluationGrid _evaluationPoints
Definition: Integrator.hh:65
std::vector< double > _basePoints
the evaluation points in the range [-1,1]
Definition: Integrator.hh:63
uint16_t getPointsNumber() const
the number of evaluation points
Definition: Integrator.cc:151
void applyRange(const IntegrationBoundaries &boundaries)
apply rescaling factor for the size of the interval from the canonical [-1,1] interval to the actual ...
Definition: Integrator.cc:120
std::vector< double > EvaluationWeights
Definition: Integrator.fhh:27
std::vector< std::vector< double >> EvaluationGrid
Definition: Integrator.fhh:26
EvaluationWeights _evaluationWeights
Definition: Integrator.hh:66
Tensor integration class.
Definition: Integrator.hh:35