|
|
|||
File indexing completed on 2026-06-02 08:17:14
0001 // 0002 // APFEL++ 2017 0003 // 0004 // Author: Valerio Bertone: valerio.bertone@cern.ch 0005 // 0006 0007 #pragma once 0008 0009 #include <vector> 0010 #include <functional> 0011 0012 namespace apfel 0013 { 0014 /** 0015 * @brief The OgataQuadrature class implements the Hankel-transform 0016 * of the input function using the Ogata quadrature method described 0017 * here: 0018 * http://www.kurims.kyoto-u.ac.jp/~okamoto/paper/Publ_RIMS_DE/41-4-40.pdf. 0019 */ 0020 class OgataQuadrature 0021 { 0022 public: 0023 /** 0024 * @brief The Integrator constructor. 0025 * @param nu: the order of the Bessel function (default: 0) 0026 * @param CutOff: the accuracy computed as a cutoff on the size of the last computed term relative to the total (default: 10<SUP>-5</SUP>) 0027 * @param h: internal variable of the algorithm (default: 0.001) 0028 * @param nZeroMax: maximum number of terms in the Ogata quadrature (default: 1000) 0029 * @note Note that the default value of the parameter 'h' (0.001) 0030 * is based of studies of Drell-Yan transverse-momentum 0031 * distributions. However, this values could possibly be badly 0032 * non-optimal in other contexts. A good value of 'h' should take 0033 * into account the decay rate of the integrand. In particular, 0034 * the faster the decay the smaller the value of 'h' has to be. 0035 */ 0036 OgataQuadrature(int const& nu = 0, 0037 double const& CutOff = 1e-5, 0038 double const& h = 0.001, 0039 int const& nZeroMax = 1000); 0040 0041 /** 0042 * @brief Function that initialises the coordinates and the 0043 * weights for the Ogata quadrature. 0044 * @param nZeroMax: maximum number of terms in the Ogata quadrature 0045 */ 0046 void InitialiseWeights(int const& nZeroMax); 0047 0048 /** 0049 * @brief Function that transform the input function. 0050 * @param func: function to be transformed 0051 * @param qT: value of qT in which to compute the transform 0052 * @param Dynh: switch to compute the step parameter _h dynamically (default: true) 0053 * @param nmax: maximum number of terms in the Ogata quadrature (default: 1000) 0054 * @param period: interval across which the integral is checked to determine where the sum is truncated (default: 10) 0055 * @return the value of the transform 0056 */ 0057 template<typename T> 0058 T transform(std::function<T(double const&)> const& func, double const& qT, bool const& Dynh = true, int const& nmax = 1000, int const& period = 10) const; 0059 0060 /** 0061 * @brief Function that returns the Bessel order. 0062 * @return the Bessel order 0063 */ 0064 double GetBesselOrder() const { return _nu; } 0065 0066 /** 0067 * @brief Function that returns the Ogata cut-off parameter. 0068 * @return the cut-off parameter 0069 */ 0070 double GetCutOff() const { return _CutOff; } 0071 0072 /** 0073 * @brief Function that returns the Ogata step parameter. 0074 * @return the step parameter 0075 */ 0076 double GetStepParameter() const { return _h; } 0077 0078 /** 0079 * @brief Function that returns the unscaled coordinates used in 0080 * the Ogata quadrature. 0081 * @param n: maximum number of coordinates returned (default: all of them (-1)) 0082 * @return the unscales coordinates 0083 */ 0084 std::vector<double> GetCoordinates(int const& n = -1) const { return (n < 0 ? _xf : std::vector<double>(_xf.begin(), _xf.begin() + std::min((size_t) n, _xf.size()))); } 0085 0086 /** 0087 * @brief Function that returns the weights used in the Ogata 0088 * quadrature. 0089 * @param n: maximum number of weights returned (default: all of them (-1)) 0090 * @return the weights 0091 */ 0092 std::vector<double> GetWeights(int const& n = -1) const { return (n < 0 ? _weights : std::vector<double>(_weights.begin(), _weights.begin() + std::min((size_t) n, _weights.size()))); } 0093 0094 /** 0095 * @brief Function that sets the Ogata step parameter. 0096 * @param h: step parameter 0097 */ 0098 void SetStepParameter(double const& h) { _h = h; } 0099 0100 /** 0101 * @brief Function that writes on screan the first 1000 zeros of the 0102 * Bessel function J0. This function essentially generates the 0103 * std::vector<double> j0Zeros above. This function requires BOOST 0104 * and thus it is not available by defaults. 0105 * @param nu: the order of the Bessel function 0106 */ 0107 void JnuZerosGenerator(int const& nu) const; 0108 0109 private: 0110 int const _nu; //!< The Bessel order 0111 double const _CutOff; //!< The target accuracy parameter 0112 double _h; //!< The step parameter 0113 int const _nZeroMax; //!< The maximum number of zero's initialised 0114 std::vector<double> _xf; //!< Unscaled coordinates 0115 std::vector<double> _weights; //!< Weights of the quadrature 0116 }; 0117 }
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|