Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:28

0001 // -*- C++ -*-
0002 //
0003 // PDFBase.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 //
0006 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef ThePEG_PDFBase_H
0010 #define ThePEG_PDFBase_H
0011 // This is the declaration of the PDFBase class.
0012 
0013 #include "ThePEG/Config/ThePEG.h"
0014 #include "ThePEG/Handlers/HandlerBase.h"
0015 #include "ThePEG/PDF/PDFCuts.h"
0016 #include "PDFBase.xh"
0017 
0018 namespace ThePEG {
0019 
0020 /**
0021  * PDFBase is the base class for implementing parton density functions
0022  * for particles with sub-structure. A number of of virtual methods
0023  * are defined which should be overridden by sub-classes.
0024  *
0025  * It is essential that either xfx or xfl is overidden to avoid
0026  * infinite recursive function calls.
0027  *
0028  * A PDFBase object can be assigned to a BeamParticleData object
0029  * and/or to a PartonExtractor object. A PDFBase has a pointer to a
0030  * RemnantHandler object which should be capable of generating
0031  * remnants for all partons which may be extracted by the PDF.
0032  *
0033  * @see \ref PDFBaseInterfaces "The interfaces"
0034  * defined for PDFBase.
0035  * @see BeamParticleData
0036  * @see PartonExtractor
0037  * @see RemnantHandler
0038  * @see PDFCuts
0039  */
0040 class PDFBase: public HandlerBase {
0041 
0042 public:
0043 
0044   /** @name Standard constructors and destructors. */
0045   //@{
0046   /**
0047    * Default constructor.
0048    */
0049   PDFBase();
0050 
0051   /**
0052    * Copy-constructor.
0053    */
0054   PDFBase(const PDFBase &);
0055 
0056   /**
0057    * Destructor.
0058    */
0059   virtual ~PDFBase();
0060   //@}
0061 
0062 public:
0063 
0064   /** @name Virtual functions to be overridden by sub-classes. */
0065   //@{
0066   /**
0067    * Return true if this PDF can handle the extraction of partons from
0068    * the given \a particle.
0069    */
0070   virtual bool canHandleParticle(tcPDPtr particle) const = 0;
0071 
0072   /**
0073    * Return true if canHandleParticle() and if the corresponding
0074    * method for remnantHandler() returns true for the given \a
0075    * particle.
0076    */
0077   virtual bool canHandle(tcPDPtr particle) const;
0078 
0079   /**
0080    * Return true if this PDF has a pole at $x=1$ for the given \a
0081    * particle and \a parton. This default version of the function
0082    * returns false.
0083    */
0084   virtual bool hasPoleIn1(tcPDPtr particle, tcPDPtr parton) const;
0085 
0086   /**
0087    * Return the partons which this PDF may extract from the given
0088    * \a particle.
0089    */
0090   virtual cPDVector partons(tcPDPtr particle) const = 0;
0091 
0092   /**
0093    * The density. Return the pdf for the given \a parton inside the
0094    * given \a particle for the virtuality \a partonScale and
0095    * logarithmic momentum fraction \a l \f$(l=\log(1/x)\f$. The \a
0096    * particle is assumed to have a virtuality \a particleScale.
0097    */
0098   virtual double xfl(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
0099              double l, Energy2 particleScale = ZERO) const;
0100 
0101   /**
0102    * The density. Return the pdf for the given \a parton inside the
0103    * given \a particle for the virtuality \a partonScale and momentum
0104    * fraction \a x. The \a particle is assumed to have a virtuality \a
0105    * particleScale.
0106    */
0107   virtual double xfx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
0108              double x, double eps = 0.0,
0109              Energy2 particleScale = ZERO) const;
0110 
0111   /**
0112    * The valence density. Return the pdf for the given cvalence \a
0113    * parton inside the given \a particle for the virtuality \a
0114    * partonScale and logarithmic momentum fraction \a l
0115    * \f$(l=\log(1/x)\f$. The \a particle is assumed to have a
0116    * virtuality \a particleScale. If not overidden by a sub class this
0117    * implementation will assume that the difference between a quark
0118    * and anti-quark distribution is due do valense quarks, but return
0119    * zero for anything else.
0120    */
0121   virtual double xfvl(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
0122              double l, Energy2 particleScale = ZERO) const;
0123 
0124   /**
0125    * The valence density. Return the pdf for the given cvalence \a
0126    * parton inside the given \a particle for the virtuality \a
0127    * partonScale and momentum fraction \a x. The \a particle is
0128    * assumed to have a virtuality \a particleScale. If not overidden
0129    * by a sub class this implementation will assume that the
0130    * difference between a quark and anti-quark distribution is due do
0131    * valense quarks, but return zero for anything else.
0132    */
0133   virtual double xfvx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
0134               double x, double eps = 0.0,
0135               Energy2 particleScale = ZERO) const;
0136 
0137   /**
0138    * The sea density. Return the pdf for the given cvalence \a
0139    * parton inside the given \a particle for the virtuality \a
0140    * partonScale and logarithmic momentum fraction \a l
0141    * \f$(l=\log(1/x)\f$. The \a particle is assumed to have a
0142    * virtuality \a particleScale. If not overidden by a sub class this
0143    * implementation will assume that the difference between a quark
0144    * and anti-quark distribution is due do valense quarks.
0145    */
0146   virtual double xfsl(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
0147               double l, Energy2 particleScale = ZERO) const;
0148 
0149   /**
0150    * The sea density. Return the pdf for the given cvalence \a
0151    * parton inside the given \a particle for the virtuality \a
0152    * partonScale and momentum fraction \a x. The \a particle is
0153    * assumed to have a virtuality \a particleScale. If not overidden
0154    * by a sub class this implementation will assume that the
0155    * difference between a quark and anti-quark distribution is due do
0156    * valense quarks.
0157    */
0158   virtual double xfsx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
0159               double x, double eps = 0.0,
0160               Energy2 particleScale = ZERO) const;
0161 
0162   /**
0163    * Generate a momentum fraction. If the PDF contains strange peaks
0164    * which can be difficult to handle, this function may be
0165    * overwritten to return an appropriate \f$l=\log(1/x)\f$ for a \a z
0166    * uniformly distributed in ]0,1[. Also the jacobobian of the
0167    * \f$l\rightarrow z\f$ variable transformation must in the function
0168    * multiply the \a jacobian argument. The default version will
0169    * simply use the function \f$l(z) = l_{\min} +
0170    * z*(l_{\max}-l_{\min})\f$ (where the limits are set by \a cut).
0171    */
0172   virtual double flattenL(tcPDPtr particle, tcPDPtr parton, const PDFCuts &cut,
0173               double z, double & jacobian) const;
0174 
0175   /**
0176    * Generate scale (as a fraction of the maximum scale). If the PDF
0177    * contains strange peaks which can be difficult to handle, this
0178    * function may be overwritten to return an appropriate scale
0179    * \f$Q^2/Q^2_{\max}\f$ for a \a z uniformly distributed in
0180    * ]0,1[. Also the jacobobian of the \f$Q^2/Q^2_{\max}\rightarrow
0181    * z\f$ variable transformation must multiply the \a jacobian
0182    * argument. The default version will simply use the function
0183    * \f$Q^2/Q^2_{\max} = (Q^2_{\max}/Q^2_{\min})^(z-1)\f$ or, if
0184    * \f$Q^2_{\min}\f$ is zero, \f$Q^2/Q^2_{\max} = z\f$ (where the
0185    * limits are set by \a cut).
0186    */
0187   virtual double flattenScale(tcPDPtr particle, tcPDPtr parton,
0188                    const PDFCuts & cut, double l, double z,
0189                    double & jacobian) const;
0190   //@}
0191 
0192   /**
0193    * Pointer to the remnant handler to handle remnant when extracting
0194    * partons according to these densities.
0195    */
0196   tcRemHPtr remnantHandler() const { return theRemnantHandler; }
0197 
0198 
0199 public:
0200 
0201   /** @name Functions used by the persistent I/O system. */
0202   //@{
0203   /**
0204    * Function used to write out object persistently.
0205    * @param os the persistent output stream written to.
0206    */
0207   void persistentOutput(PersistentOStream & os) const;
0208 
0209   /**
0210    * Function used to read in object persistently.
0211    * @param is the persistent input stream read from.
0212    * @param version the version number of the object when written.
0213    */
0214   void persistentInput(PersistentIStream & is, int version);
0215   //@}
0216 
0217   /**
0218    * Standard Init function used to initialize the interface.
0219    */
0220   static void Init();
0221 
0222 protected:
0223 
0224   /** @name Standard Interfaced functions. */
0225   //@{
0226   /**
0227    * Initialize this object after the setup phase before saving an
0228    * EventGenerator to disk.
0229    * @throws InitException if object could not be initialized properly.
0230    */
0231   virtual void doinit();
0232 
0233 protected:
0234 
0235   /**
0236    * A remnant handler which can generate remnants for the parton
0237    * extracted withfor this PDF
0238    */
0239   RemHPtr theRemnantHandler;
0240 
0241 protected:
0242 
0243   /**
0244    * Indicate how to deal with x and Q2 which are out of range.
0245    */
0246   enum RangeException {
0247     rangeFreeze, /**> Freeze the value of the PDF outside the limits. */
0248     rangeZero,   /**> Set the PDF to zero outside the limits. */
0249     rangeThrow   /**> Throw an exception if outside the limits. */
0250   };
0251 
0252   /**
0253    * Indicate to subclasses how to deal with x and Q2 which are out of
0254    * range.
0255    */
0256   RangeException rangeException;
0257 
0258 private:
0259 
0260 
0261   /**
0262    * The static object used to initialize the description of this class.
0263    * Indicates that this is an abstract class with persistent data.
0264    */
0265   static AbstractClassDescription<PDFBase> initPDFBase;
0266 
0267   /**
0268    *  Private and non-existent assignment operator.
0269    */
0270   PDFBase & operator=(const PDFBase &) = delete;
0271 
0272 };
0273 
0274 ThePEG_DECLARE_CLASS_TRAITS(PDFBase,HandlerBase);
0275 
0276 }
0277 
0278 #endif /* ThePEG_PDFBase_H */