herwig is hosted by Hepforge, IPPP Durham
Herwig++  2.7.0
MRST.h
00001 // -*- C++ -*-
00002 //
00003 // MRST.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
00004 // Copyright (C) 2002-2011 The Herwig Collaboration
00005 //
00006 // Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
00007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
00008 //
00009 #ifndef HERWIG_MRST_H
00010 #define HERWIG_MRST_H
00011 
00012 #include <ThePEG/PDF/PDFBase.h>
00013 #include <iostream>
00014 #include <fstream>
00015 #include <string>
00016 #include <cmath>
00017 
00018 namespace Herwig {
00019 
00020 using namespace ThePEG;
00021 
00029 class MRST : public PDFBase {
00033   enum PDFFlavour { upValence = 1, dnValence, glu, upSea, chm, str, bot, dnSea };
00034 
00038   enum PDFType {Sea,Valence,Total};
00039 
00040 public:
00041 
00047   MRST();
00049  
00050 public:
00051 
00059   virtual bool canHandleParticle(tcPDPtr particle) const;
00060 
00066   virtual cPDVector partons(tcPDPtr p) const;
00067 
00077   virtual double xfx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
00078                      double x, double eps = 0.0,
00079                      Energy2 particleScale = ZERO) const;
00080 
00090   virtual double xfvx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
00091                       double x, double eps = 0.0,
00092                       Energy2 particleScale = ZERO) const;
00093 
00103   virtual double xfsx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
00104                       double x, double eps = 0.0,
00105                       Energy2 particleScale = ZERO) const;
00107 
00108 public:
00109 
00116   void persistentOutput(PersistentOStream & os) const;
00117 
00123   void persistentInput(PersistentIStream & is, int version);
00125 
00132   static void Init();
00133 
00134 protected:
00135 
00142   inline virtual IBPtr clone() const;
00143 
00148   inline virtual IBPtr fullclone() const;
00150 
00151 protected:
00152 
00159   virtual void doinitrun();
00161 
00162 private:
00163 
00168   static ClassDescription<MRST> initMRST;
00169 
00174   MRST & operator=(const MRST &);
00175 
00176 private:
00177 
00188   inline double lookup(PDFFlavour i, int n, int m, double u, double t) const;
00189 
00190 
00199   double pdfValue(double x, Energy2 q2, 
00200                   tcPDPtr particle, tcPDPtr parton,PDFType type) const;
00201 
00208   inline int locate(double xx[],int n,double x) const;
00209 
00220   inline double polderivative(double x1, double x2, double x3,
00221                               double y1, double y2, double y3) const;
00222 
00226   virtual void readSetup(istream &);
00227 
00232   void initialize(bool reread = true);
00233 
00234 private:
00235 
00243   static const int np=8;
00247   static const int nx=49;
00248   
00252   static const int nq=37;
00253 
00257   static const int nqc0=2; 
00258   
00262   static const int nqb0=11;
00263 
00267   static const int ntenth=23;
00268   
00272   static const double xmin;
00273 
00277   static const double xmax;
00278   
00282   static const Energy2 qsqmin;
00283   
00287   static const Energy2 qsqmax;
00288   
00292   static const Energy2 mc2;
00293   
00297   static const Energy2 mb2;
00299 
00303   unsigned _inter;
00304 
00308   double _xswitch;
00309 
00313   string _file;
00314 
00318   //  double data[np+1][nx+1][nq+1];
00319   vector<vector<vector<double> > > data;
00320 
00324   //  double data[np+1][nx+1][nq+1];
00325   vector<vector<vector<double> > > fdata;
00326 
00330   static double xx[nx+1];
00331 
00335   static double lxx[nx+1];
00336 
00340   static double lxxb[nx+1];
00341 
00345   static double qq[nq+1];
00346 
00350   static double lqq[nq+1];
00351 
00355   double c[np+1][nx][nq][5][5];
00356 
00360   static double n0[np+1];
00361 
00365   static bool initialized;
00366 };
00367 
00368 }
00369 
00370 namespace ThePEG {
00371 
00376 template <>
00377 struct BaseClassTrait<Herwig::MRST,1> {
00379   typedef PDFBase NthBase;
00380 };
00381 
00384 template <>
00385 struct ClassTraits<Herwig::MRST>: public ClassTraitsBase<Herwig::MRST> {
00387   static string className() { return "Herwig::MRST"; }
00395   static string library() { return "HwMRST.so"; }
00396 };
00397 
00400 }
00401 
00402 #include "MRST.icc"
00403 
00404 #endif