Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //
0002 // APFEL++ 2017
0003 //
0004 // Author: Valerio Bertone: valerio.bertone@cern.ch
0005 //
0006 
0007 #pragma once
0008 
0009 #include "apfel/evolutionsetup.h"
0010 #include "apfel/tabulateobject.h"
0011 #include "apfel/dglapbuilder.h"
0012 #include "apfel/dglapbuilderqcdqed.h"
0013 #include "apfel/config.h"
0014 
0015 namespace apfel
0016 {
0017   /**
0018    * @brief The LHKnotArray structure emulates the KnotArray1F class
0019    * of LHAPDF and contains the grids in x, Q2 (only a given subgrid),
0020    * and one single distribution tabulated on the (x,Q) bidimensional
0021    * grid.
0022    */
0023   struct LHKnotArray
0024   {
0025     std::vector<double> xs;     //!< List of x knots
0026     std::vector<double> q2s;    //!< List of Q2 knots
0027     std::vector<double> xfs;    //!< List of xf values across the 2D knot array, stored as a strided [ix][iQ2] 1D array
0028   };
0029 
0030   /**
0031    * @brief The InitialiseEvolution performs all the operations to
0032    * initialise a DGLAP evolution using an EvolutionSetup object to
0033    * retrieve the relevant information. This class also provides the
0034    * necessary functions to access the evolved distributions,
0035    * coupling(s), and masses.
0036    */
0037   class InitialiseEvolution
0038   {
0039   public:
0040     /**
0041      * @brief The InitialiseEvolution constructor.
0042      * @param setup: the EvolutionSetup data structure encapsulate the evolution parameters
0043      * @param WriteGrid: switch to enable the writing of grids in the LHAPDF format (default: false)
0044      * @param GridHeader: part of the LHAPDF grid header that can be set externally (default: empty = use default)
0045      */
0046     InitialiseEvolution(EvolutionSetup const& setup, bool const& WriteGrid = false, std::string const& GridHeader = "");
0047 
0048     /**
0049      * @brief The CheckSetup function checks that the input setup is
0050      * meaningful and compatible with the current capabilities of the
0051      * code.
0052      * @return true or false according to whether the check is succesful or not
0053      * @note Of course, not all possible checks are implemented. The
0054      * user has to be careful when modifying the evolution setup and
0055      * make sure that the settings are reasonable.
0056      */
0057     bool CheckSetup() const;
0058 
0059     /**
0060      * @brief The ReportSetup function reports the parameters in a
0061      * human readable format.
0062      */
0063     void ReportSetup() const;
0064 
0065     /**
0066      * @brief The InitialiseCouplings function intialises and
0067      * tabulates the running coupling(s).
0068      */
0069     void InitialiseCouplings();
0070 
0071     /**
0072      * @brief The InitialiseDglapObject function intialises the
0073      * relevant objects for the DGLAP evolution and constructs a Dglap
0074      * object to be used for the evolution.
0075      */
0076     void InitialiseDglapObject();
0077 
0078     /**
0079      * @brief The TabulateEvolution function computes the DGLAP
0080      * evolution and tabulates the distributions over and (x,Q2)
0081      * grid. The tabulated distributions can be accessed via the
0082      * KnotArray() array function.
0083      * @param InSet: the input set of distributions
0084      */
0085     void TabulateEvolution(std::function<std::map<int, double>(double const&, double const&)> const& InSet);
0086 
0087     /**
0088      * @brief The WriteGridInfo function creates the folder and writes
0089      * the info file of the LHAPDF grid.
0090      */
0091     void WriteGridInfo();
0092 
0093     /**
0094      * @brief The WriteGrid function dumps to file in the LHAPDF
0095      * format the actual PDF grid.
0096      * @note If the writing of the grid is enabled, this function is
0097      * called every time that the TabulateEvolution function is
0098      * called. Therefore this cab be used to compute more members of a
0099      * given set without reinitialising the evolution.
0100      */
0101     void WriteGrid();
0102 
0103     /**
0104      * @brief Function that returns the evolved strong coupling.
0105      * @param mu: the value of the renormalisation scale &mu;<SUB>R</SUB>
0106      * @return the evolved strong coupling
0107      */
0108     double Alphas(double const& mu) const { return _as(mu); }
0109 
0110     /**
0111      * @brief Function that returns the full set of distributions
0112      * tabulated on the (x,Q2) grid.
0113      * @return the _KnotArray attribute
0114      */
0115     std::map<double, std::map<int, LHKnotArray>> KnotArray() const { return _KnotArray; }
0116 
0117     /**
0118      * @brief Function that returns the full set of distributions as a
0119      * TabulateObject object.
0120      * @return the _KnotArray attribute
0121      */
0122     TabulateObject<Set<Distribution>> TabulatedDistributions() const { return *_TabulatedDists; }
0123 
0124     /**
0125      * @brief Function that returns the EvolutionSetup object.
0126      * @return the the _setup object
0127      */
0128     EvolutionSetup GetEvolutionSetup() const { return _setup; }
0129 
0130   private:
0131     EvolutionSetup                                           _setup;          //!< Evolution setup object
0132     bool                                                     _WriteGrid;      //!< Switch to write LHAPDF grids
0133     std::string                                              _GridHeader;     //!< Part of the LHAPDF grid header that can be set externally (the format is resposibility of the user)
0134     std::unique_ptr<const Grid>                              _g;              //!< x-space grid
0135     std::function<double(double const&)>                     _as;             //!< Strong coupling function
0136     std::function<double(double const&)>                     _aem;            //!< Electromagnetic coupling function
0137     std::map<int, DglapObjects>                              _DglapObj;       //!< Dglap evolution objects for QCD
0138     std::map<int, DglapObjectsQCDQED>                        _DglapObjQED;    //!< Dglap evolution objects for QCDxQED
0139     std::map<double, std::map<int, LHKnotArray>>             _KnotArray;      //!< Object that emulates the KnotArray of LHAPDF to be fed to LHAPDF itself
0140     std::unique_ptr<const TabulateObject<Set<Distribution>>> _TabulatedDists; //!< Tabulated distributions
0141   };
0142 }