Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:17:15

0001 //
0002 // APFEL++ 2017
0003 //
0004 // Author: Valerio Bertone: valerio.bertone@cern.ch
0005 //
0006 
0007 #pragma once
0008 
0009 #include <vector>
0010 #include <string>
0011 
0012 namespace apfel
0013 {
0014   /**
0015    * @name Tools
0016    * Collection of useful tools.
0017    */
0018   ///@{
0019   /// Quark enumerator
0020   enum QuarkFlavour: int {TOTAL, DOWN, UP, STRANGE, CHARM, BOTTOM, TOP};
0021 
0022   /**
0023    * @brief Return the number of active flavours at the scale Q given
0024    * the (ordered) vector of thresholds.
0025    * @param Q: the scale
0026    * @param Thresholds: the vector of thresholds
0027    * @return number of active flavours at Q
0028    */
0029   int NF(double const& Q, std::vector<double> const& Thresholds);
0030 
0031   /**
0032    * @brief Utility function used by the heavy-quark initiated massive
0033    * coefficient functions.
0034    * @param a: first parameter
0035    * @param b: second parameter
0036    * @param c: third parameter
0037    * @return Triangular function
0038    */
0039   double DeltaFun(double const& a, double const& b, double const& c);
0040 
0041   /**
0042    * @brief Utility function for the computation of the electroweak
0043    * charges, for both time-like and space-like virtualities
0044    * (Reference: https://arxiv.org/pdf/hep-ph/9711387.pdf).
0045    * @param Q: absolute value the virtuality of the vector boson
0046    * @param virt: virtuality (true: time-like, false: space-like)
0047    * @param Comp: the flavour selector (default: TOTAL, i.e. all flavours are computed)
0048    * @return the std::vector of the electroweak charges
0049    */
0050   std::vector<double> ElectroWeakCharges(double const& Q, bool const& virt, int const& Comp = TOTAL);
0051 
0052   /**
0053    * @brief Utility function for the computation of the
0054    * parity-violating electroweak charges, for both time-like and
0055    * space-like virtualities.
0056    * @param Q: absolute value the virtuality of the vector boson
0057    * @param virt: virtuality (true: time-like, false: space-like)
0058    * @param Comp: the flavour selector (default: TOTAL, i.e. all flavours are computed)
0059    * @return the std::vector of the electroweak charges
0060    */
0061   std::vector<double> ParityViolatingElectroWeakCharges(double const& Q, bool const& virt, int const& Comp = TOTAL);
0062 
0063   /**
0064    * @brief Utility function for the computation of the electroweak
0065    * charges for Drell-Yan in narrow-width appriximation
0066    * @return the std::vector of the electroweak charges
0067    */
0068   std::vector<double> ElectroWeakChargesNWA();
0069 
0070   /**
0071    * @brief Utility function that concatenates and sort the input
0072    * vectors.
0073    * @param v1: first vector
0074    * @param v2: second vector
0075    * @return a a std::vector<double> corresponding to the sorted
0076    * entries of 'v1' and 'v2'.
0077    */
0078   std::vector<double> ConcatenateAndSortVectors(std::vector<double> const& v1, std::vector<double> const& v2);
0079 
0080   /**
0081    * @brief Template utility function that returns the even entries of
0082    * the input vector.
0083    * @param v: input vector
0084    * @return a std::vector containing the even entries of the input vector.
0085    */
0086   template<typename T>
0087   std::vector<T> EvenVector(std::vector<T> const& v);
0088 
0089   /**
0090    * @brief Template utility function that returns the odd entries of
0091    * the input vector.
0092    * @param v: input vector
0093    * @return a std::vector containing the odd entries of the input vector.
0094    */
0095   template<typename T>
0096   std::vector<T> OddVector(std::vector<T> const& v);
0097 
0098   /**
0099    * @brief Absolute value of the object T. In the case of a
0100    * Distribution, this is computed like the squared mean average of
0101    * the entries of the joint grid. In the case of a set of
0102    * distributions, the minimum dabs over the distributions is
0103    * returned.
0104    * @param d: input object
0105    * @return the absolute value
0106    */
0107   template<typename T>
0108   double dabs(T const& d);
0109 
0110   /**
0111    * @brief Function that computes the coefficients of the expansion
0112    * of a product of n binomials with zero's in r.
0113    * @param r: input vector of zero's
0114    */
0115   std::vector<double> ProductExpansion(std::vector<double> const& r);
0116 
0117   /**
0118    * @brief Factorial of an integer
0119    * @param n: input integer
0120    */
0121   int factorial(int const& n);
0122 
0123   /**
0124    * @brief Function that computes the total cross section in a
0125    * electron-positron annihilation process.
0126    * @param PerturbativeOrder: perturbative order of the computation
0127    * @param Q: vector-boson invariant mass
0128    * @param AlphaQCD: value of the strong coupling at Q
0129    * @param AlphaQED: value of the electromagnetic coupling at Q
0130    * @param Thresholds: heavy-quark thresholds
0131    * @param Comp: component of the cross section, e.g. charm, bottom, etc. (default = TOTAL)
0132    * @param NoCharges: whether to exclude the sum over the charge of the active flavours (default = false)
0133    * @return the total cross section (in nbarn)
0134    * @note The QCD corrections to the total cross section in a
0135    * electron-positron annihilation process are taken from
0136    * Phys.Lett. B259 (1991) 144–150.
0137    */
0138   double GetSIATotalCrossSection(int                 const& PerturbativeOrder,
0139                                  double              const& Q,
0140                                  double              const& AlphaQCD,
0141                                  double              const& AlphaQED,
0142                                  std::vector<double> const& Thresholds,
0143                                  QuarkFlavour        const& Comp = TOTAL,
0144                                  bool                const& NoCharges = false);
0145 
0146   /**
0147    * @brief Function that computes ln^n(1-y)/(1-y) often needed in the
0148    * computation of partonic cross section. This function also returns
0149    * the indefinite integral of this function that is also needed.
0150    * @param n: the power of the logarithm upstairs
0151    * @param y: the integration variable
0152    * @param integral: whether the function should return ln^n(1-y)/(1-y) (flase) or its integral (true) (default: false)
0153    */
0154   double Dn(int const& n, double const& y, bool const& integral = false);
0155 
0156   /**
0157    * @brief Function that computes numericall the integral between 0
0158    * and y of atan(t) / t.
0159    * @param y: the upper integration bound
0160    * @note Used in the computation of the SIDIS partonic cross
0161    * sections at NNLO accuracy.
0162    */
0163   double InvTanInt(double const& y);
0164   ///@}
0165 }