Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:24:27

0001 // -*- C++ -*-
0002 //
0003 // SplittingFunction.h is a part of Herwig - A multi-purpose Monte Carlo event generator
0004 // Copyright (C) 2002-2019 The Herwig Collaboration
0005 //
0006 // Herwig 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 HERWIG_SplittingFunction_H
0010 #define HERWIG_SplittingFunction_H
0011 //
0012 // This is the declaration of the SplittingFunction class.
0013 //
0014 
0015 #include "ThePEG/Interface/Interfaced.h"
0016 #include "Herwig/Shower/QTilde/ShowerConfig.h"
0017 #include "ThePEG/EventRecord/RhoDMatrix.h"
0018 #include "Herwig/Decay/DecayMatrixElement.h"
0019 #include "Herwig/Shower/QTilde/Kinematics/ShowerKinematics.fh"
0020 #include "ThePEG/EventRecord/ColourLine.h"
0021 #include "ThePEG/PDT/ParticleData.h"
0022 #include "SplittingFunction.fh"
0023 
0024 namespace Herwig {
0025 
0026 using namespace ThePEG;
0027 
0028   /** \ingroup Shower
0029    * Enum to define the possible types of colour structure which can occur in
0030    * the branching.
0031    */
0032   enum ColourStructure {Undefined=0,
0033             TripletTripletOctet  = 1,OctetOctetOctet    =2,
0034             OctetTripletTriplet  = 3,TripletOctetTriplet=4,
0035             SextetSextetOctet    = 5,
0036             ChargedChargedNeutral=-1,ChargedNeutralCharged=-2,
0037             NeutralChargedCharged=-3,EW=-4};
0038 
0039 /** \ingroup Shower
0040  *
0041  *  This is an abstract class which defines the common interface
0042  *  for all \f$1\to2\f$ splitting functions, for both initial-state
0043  *  and final-state radiation. 
0044  *
0045  *  The SplittingFunction class contains a number of purely virtual members
0046  *  which must be implemented in the inheriting classes. The class also stores
0047  *  the interaction type of the spltting function.
0048  *
0049  *  The inheriting classes need to specific the splitting function 
0050  *  \f$P(z,2p_j\cdot p_k)\f$, in terms of the energy fraction \f$z\f$ and
0051  *  the evolution scale. In order to allow the splitting functions to be used
0052  *  with different choices of evolution functions the scale is given by
0053  * \f[2p_j\cdot p_k=(p_j+p_k)^2-m_{jk}^2=Q^2-(p_j+p_k)^2=z(1-z)\tilde{q}^2=
0054  *   \frac{p_T^2}{z(1-z)}-m_{jk}^2+\frac{m_j^2}{z}+\frac{m_k^2}{1-z},\f]
0055  *  where \f$Q^2\f$ is the virtuality of the branching particle,
0056  *  $p_T$ is the relative transverse momentum of the branching products and
0057  *  \f$\tilde{q}^2\f$ is the angular variable described in hep-ph/0310083.
0058  *
0059  *  In addition an overestimate of the 
0060  *  splitting function, \f$P_{\rm over}(z)\f$ which only depends upon \f$z\f$, 
0061  *  the integral, inverse of the integral for this overestimate and
0062  *  ratio of the true splitting function to the overestimate must be provided
0063  *  as they are necessary for the veto alogrithm used to implement the evolution.
0064  *
0065  * @see \ref SplittingFunctionInterfaces "The interfaces"
0066  * defined for SplittingFunction.
0067  */
0068 class SplittingFunction: public Interfaced {
0069 
0070 public:
0071 
0072   /**
0073    * The default constructor.   
0074    * @param b All splitting functions must have an interaction order
0075    */
0076   SplittingFunction()
0077     : Interfaced(), _interactionType(ShowerInteraction::UNDEFINED),
0078       _colourStructure(Undefined), _colourFactor(-1.),
0079       angularOrdered_(true), scaleChoice_(2), strictAO_(true) {}
0080 
0081 public:
0082 
0083   /**
0084    *  Methods to return the interaction type and order for the splitting function
0085    */
0086   //@{
0087   /**
0088    *  Return the type of the interaction
0089    */
0090   ShowerInteraction interactionType() const {return _interactionType;}
0091 
0092   /**
0093    *  Return the colour structure
0094    */
0095   ColourStructure colourStructure() const {return _colourStructure;}
0096 
0097   /**
0098    *  Return the colour factor
0099    */
0100   double colourFactor(const IdList &ids) const {
0101     if(_colourStructure>0)
0102       return _colourFactor;
0103     else if(_colourStructure<0) {
0104       if(_colourStructure==ChargedChargedNeutral ||
0105      _colourStructure==ChargedNeutralCharged) {
0106     return sqr(double(ids[0]->iCharge())/3.);
0107       }
0108       else if(_colourStructure==NeutralChargedCharged) {
0109     double fact = sqr(double(ids[1]->iCharge())/3.);
0110     if(ids[1]->coloured())
0111       fact *= abs(double(ids[1]->iColour()));
0112     return fact;
0113       }
0114       else if(_colourStructure==EW) {
0115     return 1.;
0116       }
0117       else {
0118     assert(false);
0119     return 0.;
0120       }
0121     }
0122     else {
0123       assert(false);
0124       return 0.;
0125     }
0126   }
0127   //@}
0128 
0129   /**
0130    *  Purely virtual method which should determine whether this splitting
0131    *  function can be used for a given set of particles.
0132    *  @param ids The PDG codes for the particles in the splitting.
0133    */
0134   virtual bool accept(const IdList & ids) const = 0;
0135 
0136   /**
0137    *  Method to check the colours are correct
0138    */
0139   virtual bool checkColours(const IdList & ids) const;
0140 
0141   /**
0142    *   Methods to return the splitting function.
0143    */
0144   //@{
0145   /**
0146    * Purely virtual method which should return the exact value of the splitting function,
0147    * \f$P\f$ evaluated in terms of the energy fraction, \f$z\f$, and the evolution scale 
0148    \f$\tilde{q}^2\f$.
0149    * @param z   The energy fraction.
0150    * @param t   The scale \f$t=2p_j\cdot p_k\f$.
0151    * @param ids The PDG codes for the particles in the splitting.
0152    * @param mass Whether or not to include the mass dependent terms
0153    * @param rho The spin density matrix
0154    */
0155   virtual double P(const double z, const Energy2 t, const IdList & ids,
0156            const bool mass, const RhoDMatrix & rho) const = 0;
0157 
0158   /**
0159    * Purely virtual method which should return
0160    * an overestimate of the splitting function,
0161    * \f$P_{\rm over}\f$ such that the result \f$P_{\rm over}\geq P\f$. This function
0162    * should be simple enough that it does not depend on the evolution scale.
0163    * @param z   The energy fraction.
0164    * @param ids The PDG codes for the particles in the splitting.
0165    */
0166   virtual double overestimateP(const double z, const IdList & ids) const = 0; 
0167 
0168   /**
0169    * Purely virtual method which should return
0170    * the ratio of the splitting function to the overestimate, i.e.
0171    * \f$P(z,\tilde{q}^2)/P_{\rm over}(z)\f$.
0172    * @param z   The energy fraction.
0173    * @param t   The scale \f$t=2p_j\cdot p_k\f$.
0174    * @param ids The PDG codes for the particles in the splitting.
0175    * @param mass Whether or not to include the mass dependent terms
0176    * @param rho The spin density matrix
0177    */
0178   virtual double ratioP(const double z, const Energy2 t, const IdList & ids,
0179             const bool mass, const RhoDMatrix & rho) const = 0;
0180 
0181   /**
0182    * Purely virtual method which should return the indefinite integral of the 
0183    * overestimated splitting function, \f$P_{\rm over}\f$.
0184    * @param z         The energy fraction.
0185    * @param ids The PDG codes for the particles in the splitting.
0186    * @param PDFfactor Which additional factor to include for the PDF
0187    *                  0 is no additional factor,
0188    *                  1 is \f$1/z\f$, 2 is \f$1/(1-z)\f$ and 3 is \f$1/z/(1-z)\f$
0189    *                  
0190    */
0191   virtual double integOverP(const double z, const IdList & ids, 
0192                 unsigned int PDFfactor=0) const = 0; 
0193 
0194   /**
0195    * Purely virtual method which should return the inverse of the 
0196    * indefinite integral of the 
0197    * overestimated splitting function, \f$P_{\rm over}\f$ which is used to
0198    * generate the value of \f$z\f$.
0199    * @param r Value of the splitting function to be inverted
0200    * @param ids The PDG codes for the particles in the splitting.
0201    * @param PDFfactor Which additional factor to include for the PDF
0202    *                  0 is no additional factor,
0203    *                  1 is \f$1/z\f$, 2 is \f$1/(1-z)\f$ and 3 is \f$1/z/(1-z)\f$
0204    */
0205   virtual double invIntegOverP(const double r, const IdList & ids, 
0206                    unsigned int PDFfactor=0) const = 0;
0207   //@}
0208 
0209   /**
0210    * Purely virtual method which should make the proper colour connection 
0211    * between the emitting parent and the branching products.
0212    * @param parent The parent for the branching
0213    * @param first  The first  branching product
0214    * @param second The second branching product
0215    * @param partnerType The type of evolution partner
0216    * @param back Whether this is foward or backward evolution.
0217    */
0218   virtual void colourConnection(tShowerParticlePtr parent,
0219                 tShowerParticlePtr first,
0220                 tShowerParticlePtr second,
0221                 ShowerPartnerType partnerType, 
0222                 const bool back) const;
0223 
0224   /**
0225    * Method to calculate the azimuthal angle for forward evolution
0226    * @param z The energy fraction
0227    * @param t The scale \f$t=2p_j\cdot p_k\f$.
0228    * @param ids The PDG codes for the particles in the splitting.
0229    * @param The azimuthal angle, \f$\phi\f$.
0230    * @return The weight
0231    */
0232   virtual vector<pair<int,Complex> > 
0233   generatePhiForward(const double z, const Energy2 t, const IdList & ids,
0234              const RhoDMatrix &) = 0;
0235 
0236   /**
0237    * Method to calculate the azimuthal angle for backward evolution
0238    * @param z The energy fraction
0239    * @param t The scale \f$t=2p_j\cdot p_k\f$.
0240    * @param ids The PDG codes for the particles in the splitting.
0241    * @return The weight
0242    */
0243   virtual vector<pair<int,Complex> > 
0244   generatePhiBackward(const double z, const Energy2 t, const IdList & ids,
0245               const RhoDMatrix &) = 0;
0246 
0247   /**
0248    * Calculate the matrix element for the splitting
0249    * @param z The energy fraction
0250    * @param t The scale \f$t=2p_j\cdot p_k\f$.
0251    * @param ids The PDG codes for the particles in the splitting.
0252    * @param phi The azimuthal angle, \f$\phi\f$.
0253    * @param timeLike Whether timelike or spacelike, affects inclusive of mass terms
0254    */
0255   virtual DecayMEPtr matrixElement(const double z, const Energy2 t, 
0256                    const IdList & ids, const double phi,
0257                                    bool timeLike) = 0;
0258 
0259   /**
0260    *  Whether or not the interaction is angular ordered
0261    */
0262   bool angularOrdered() const {return angularOrdered_;}
0263 
0264   /**
0265    *  Scale choice
0266    */
0267   bool pTScale() const {
0268     return scaleChoice_ == 2 ? angularOrdered_ : scaleChoice_ == 0;
0269   }
0270 
0271   /**
0272    *  Functions to state scales after branching happens
0273    */
0274   //@{
0275   /**
0276    *  Sort out scales for final-state emission
0277    */
0278   void evaluateFinalStateScales(ShowerPartnerType type,
0279                 Energy scale, double z,
0280                 tShowerParticlePtr parent,
0281                 tShowerParticlePtr first,
0282                 tShowerParticlePtr second);
0283   /**
0284    *  Sort out scales for initial-state emission
0285    */
0286   void evaluateInitialStateScales(ShowerPartnerType type,
0287                   Energy scale, double z,
0288                   tShowerParticlePtr parent,
0289                   tShowerParticlePtr first,
0290                   tShowerParticlePtr second);
0291 
0292   /**
0293    *  Sort out scales for decay emission
0294    */
0295   void evaluateDecayScales(ShowerPartnerType type,
0296                Energy scale, double z,
0297                tShowerParticlePtr parent,
0298                tShowerParticlePtr first,
0299                tShowerParticlePtr second);
0300   //@}
0301 
0302 public:
0303 
0304   /** @name Functions used by the persistent I/O system. */
0305   //@{
0306   /**
0307    * Function used to write out object persistently.
0308    * @param os the persistent output stream written to.
0309    */
0310   void persistentOutput(PersistentOStream & os) const;
0311 
0312   /**
0313    * Function used to read in object persistently.
0314    * @param is the persistent input stream read from.
0315    * @param version the version number of the object when written.
0316    */
0317   void persistentInput(PersistentIStream & is, int version);
0318   //@}
0319 
0320   /**
0321    * The standard Init function used to initialize the interfaces.
0322    * Called exactly once for each class by the class description system
0323    * before the main function starts or
0324    * when this class is dynamically loaded.
0325    */
0326   static void Init();
0327 
0328 protected:
0329 
0330   /** @name Standard Interfaced functions. */
0331   //@{
0332   /**
0333    * Initialize this object after the setup phase before saving an
0334    * EventGenerator to disk.
0335    * @throws InitException if object could not be initialized properly.
0336    */
0337   virtual void doinit();
0338   //@}
0339 
0340 protected:
0341 
0342   /**
0343    *  Set the colour factor
0344    */
0345   void colourFactor(double in) {_colourFactor=in;}
0346 
0347 private:
0348 
0349   /**
0350    * The assignment operator is private and must never be called.
0351    * In fact, it should not even be implemented.
0352    */
0353   SplittingFunction & operator=(const SplittingFunction &) = delete;
0354 
0355 private:
0356 
0357   /**
0358    *  The interaction type for the splitting function.
0359    */
0360   ShowerInteraction _interactionType;
0361 
0362   /**
0363    *  The colour structure
0364    */
0365   ColourStructure _colourStructure;
0366 
0367   /**
0368    *  The colour factor
0369    */
0370   double _colourFactor;
0371 
0372   /**
0373    *  Whether or not this interaction is angular-ordered
0374    */
0375   bool angularOrdered_;
0376 
0377   /**
0378    *  The choice of scale
0379    */
0380   unsigned int scaleChoice_;
0381 
0382   /**
0383    *   Enforce strict AO 
0384    */
0385   bool strictAO_;
0386 
0387 };
0388 
0389 }
0390 
0391 #endif /* HERWIG_SplittingFunction_H */