Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:10:08

0001 /***
0002  *
0003  * NNPDF C++ Driver
0004  *
0005  * Stefano Carrazza for the NNPDF Collaboration
0006  * email: stefano.carrazza@mi.infn.it
0007  *
0008  * October 2014
0009  *
0010  * Usage:
0011  *
0012  *  NNPDFDriver *pdf = new NNPDFDriver("gridname.LHgrid");
0013  *
0014  *  pdf->initPDF(0); // select replica [0,fMem]
0015  *
0016  *  or 
0017  * 
0018  *  NNPDFDriver *pdf = new NNPDFDriver("gridname.LHgrid", 0);
0019  *
0020  *  then
0021  *
0022  *  pdf->xfx(x,Q,fl); // -> returns double
0023  *
0024  *  // with fl = [-6,7], LHAPDF format
0025  *
0026  */
0027 
0028 #pragma once
0029 
0030 #include <iostream>
0031 #include <vector>
0032 #include <string>
0033 using std::string;
0034 using std::vector;
0035 
0036 class NNPDFDriver {
0037 
0038  private:
0039 
0040   // Interpolation order
0041   static const int fM = 4;
0042   static const int fN = 4;
0043 
0044   int fNFL;           //! Total flavour number
0045   int fNFlavors;     // Number of flavours read from info
0046   int fNX;            //! Total number of x points in the grid
0047   vector<int> fNQ2;   //! Total number of Q2 points in the grid (subgrids)
0048   int fMem;           //! Total number of Members
0049   int fRep;           //! Select the current replica
0050   double fAlphas;     //! AlphaS value
0051   double *fXGrid;     //! x grid
0052   double *fLogXGrid;  //! x grid
0053   vector<double*>     fQ2Grid;    //! q2 grid
0054   vector<double*>     fLogQ2Grid; //! q2 grid
0055   vector<double****>  fPDFGrid;   //! PDF grid
0056   bool fHasPhoton;    //! bool with photon information
0057   bool fSingleMem;    //! bool which determines the constructor
0058   //bool fLHAPDF6;      //! bool which determines the grid version
0059   double *fXpdf;      //! array with doubles
0060   // Metainfo read from .info
0061   double fxmin; // xmin accessor
0062   double fxmax; // xmax accessor
0063   double fQmin; // Qmin accessor
0064   double fQmax; // Qmax accessor
0065   double fMz; // well Z mass
0066   int forder; // order alphas  QCD
0067   // Masses
0068   double fMDown;
0069   double fMUp;  
0070   double fMStrange;
0071   double fMCharm;
0072   double fMBottom; 
0073   double fMTop;
0074 
0075 
0076  public:
0077   /// The constructor
0078   NNPDFDriver(string const& gridfilename = "", int const& rep = -1);
0079   /// The destructor
0080   ~NNPDFDriver();
0081 
0082   //! Init PDF member irep = [0, fMem]
0083   void initPDF(int irep);
0084 
0085   //! returns the x*pdf of flavour id = [-6,7], LHA order.
0086   // Change w.r.t. vanilla code: use Q^2 instead of calculating it for each call 
0087   double xfx(double const& X, double const& Q2_glob, int const& ID);
0088 
0089   //! Get NFL method, returns total number of flavours
0090   int GetNFL() { return fNFL; } // Number of flavours in the grid (includes top)
0091   int GetNFlavors() { return fNFlavors; } // Number of flavours in the pdf file (no top)
0092 
0093   //! Get AlphaS method, returns the alphas at Mz
0094   double GetAlphaSMz() { return fAlphas; }
0095 
0096   // Get xmin
0097   double GetXMin() {return fxmin; }
0098 
0099   // Get xmax
0100   double GetXMax() {return fxmax; }
0101   
0102   // Get Qmin
0103   double GetQMin() {return fQmin; }
0104 
0105   // Get Qmax
0106   double GetQMax() {return fQmax; }
0107   
0108   // Get MZ
0109   double GetMz() { return fMz; }
0110 
0111   // Accessors to quark masses
0112   double GetMDown()    { return fMDown;}
0113   double GetMUp()      { return fMUp;}
0114   double GetMStrange() { return fMStrange;}
0115   double GetMCharm()   { return fMCharm;}
0116   double GetMBottom()  { return fMBottom;}
0117   double GetMTop()     { return fMTop;}
0118 
0119   // Get order alphas
0120   int GetOrderAlphaS() { return forder; }
0121 
0122   //! Returns true if the set contains the photon PDF
0123   bool hasPhoton() { return fHasPhoton; }
0124 
0125   //! Return the total number of replicas
0126   int GetMembers() { return fMem+1; }
0127 
0128  private:
0129   /// Reads the PDF from file
0130   void readPDFSet(string const&, int const&);
0131   /// Apply the interpolation algorithm
0132   /// Performs the 2D polynomial interpolation
0133   void lh_polin2(double[],double[],double[][fN],
0134          double,double,double&,double&);
0135   /// Performs the 1D polynomial interpolation
0136   void lh_polint(double[],double[],int,double,double&,double&);
0137 };