Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // DipoleSplittingKernel.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_DipoleSplittingKernel_H
0010 #define HERWIG_DipoleSplittingKernel_H
0011 //
0012 // This is the declaration of the DipoleSplittingKernel class.
0013 //
0014 
0015 #include "ThePEG/Handlers/HandlerBase.h"
0016 #include "ThePEG/StandardModel/AlphaSBase.h"
0017 #include "ThePEG/PDF/PDF.h"
0018 
0019 #include "Herwig/Shower/Dipole/Utility/PDFRatio.h"
0020 #include "Herwig/Shower/Dipole/Base/DipoleSplittingInfo.h"
0021 #include "Herwig/Shower/Dipole/Kinematics/DipoleSplittingKinematics.h"
0022 
0023 #include "ThePEG/EventRecord/RhoDMatrix.h"
0024 #include "Herwig/Decay/DecayMatrixElement.h"
0025 #include "Herwig/Decay/TwoBodyDecayMatrixElement.h"
0026 
0027 namespace Herwig {
0028 
0029 using namespace ThePEG;
0030 
0031 /**
0032  * \ingroup DipoleShower
0033  * \author Simon Platzer
0034  *
0035  * \brief DipoleSplittingKernel is the base class for all kernels
0036  * used within the dipole shower.
0037  *
0038  * @see \ref DipoleSplittingKernelInterfaces "The interfaces"
0039  * defined for DipoleSplittingKernel.
0040  */
0041 class DipoleSplittingKernel: public HandlerBase {
0042 
0043 public:
0044 
0045   /**
0046    * The default constructor.
0047    */
0048   DipoleSplittingKernel();
0049 
0050 public:
0051 
0052   /**
0053    * Return the alpha_s to be used
0054    */
0055   Ptr<AlphaSBase>::tptr alphaS() const { return theAlphaS; }
0056 
0057   /**
0058    * Set the alpha_s to be used
0059    */
0060   void alphaS(Ptr<AlphaSBase>::tptr ap) { theAlphaS = ap; }
0061 
0062   /**
0063    * Return the splitting kinematics object
0064    */
0065   Ptr<DipoleSplittingKinematics>::tptr splittingKinematics() const {
0066       return theSplittingKinematics; 
0067   }
0068 
0069   /**
0070    * Return the mc check object
0071    */
0072   Ptr<DipoleMCCheck>::ptr mcCheck() const { return theMCCheck; }
0073 
0074   /**
0075    * Set the splitting kinematics object
0076    */
0077   void splittingKinematics(Ptr<DipoleSplittingKinematics>::tptr sp) { 
0078     theSplittingKinematics = sp; 
0079   }
0080 
0081   /**
0082    * Return the PDFRatio object
0083    */
0084   Ptr<PDFRatio>::tptr pdfRatio() const { return thePDFRatio; }
0085 
0086   /**
0087    * Set the PDFRatio object
0088    */
0089   void pdfRatio(Ptr<PDFRatio>::tptr sp) { thePDFRatio = sp; }
0090 
0091   /**
0092    * Return the number of additional parameter
0093    * random variables needed to evaluate this kernel
0094    * except the momentum fractions of incoming partons.
0095    * These will be accessible through the 
0096    * lastSplittingParameters() container of the splitting
0097    * info object.
0098    */
0099   virtual int nDimAdditional() const { return 0; }
0100 
0101   /**
0102    * Set the freezing value for the renormalization scale
0103    */
0104   void renormalizationScaleFreeze(Energy s) { theRenormalizationScaleFreeze = s; }
0105 
0106   /**
0107    * Set the freezing value for the factorization scale
0108    */
0109   void factorizationScaleFreeze(Energy s) { theFactorizationScaleFreeze = s; }
0110 
0111   /**
0112    * Get the freezing value for the renormalization scale
0113    */
0114   Energy renormalizationScaleFreeze() const { return theRenormalizationScaleFreeze; }
0115 
0116   /**
0117    * Get the freezing value for the factorization scale
0118    */
0119   Energy factorizationScaleFreeze() const { return theFactorizationScaleFreeze; }
0120 
0121 public:
0122 
0123   /**
0124    * Return true, if this splitting kernel
0125    * applies to the given dipole index.
0126    */
0127   virtual bool canHandle(const DipoleIndex&) const = 0;
0128 
0129   /**
0130    * Return true, if this splitting kernel is
0131    * the same for the given index a, as the given
0132    * splitting kernel for index b.
0133    */
0134   virtual bool canHandleEquivalent(const DipoleIndex& a,
0135                    const DipoleSplittingKernel& sk,
0136                    const DipoleIndex& b) const = 0;
0137 
0138   /**
0139    * Return the emitter data after splitting, given
0140    * a dipole index.
0141    */
0142   virtual tcPDPtr emitter(const DipoleIndex&) const = 0;
0143 
0144   /**
0145    * Return the emission data after splitting, given
0146    * a dipole index.
0147    */
0148   virtual tcPDPtr emission(const DipoleIndex&) const = 0;
0149 
0150   /**
0151    * Return the spectator data after splitting, given
0152    * a dipole index.
0153    */
0154   virtual tcPDPtr spectator(const DipoleIndex&) const = 0;
0155 
0156   /**
0157    * Return the flavour produced, if this cannot
0158    * be determined from the dipole.
0159    */
0160   PDPtr flavour() const { return theFlavour; }
0161 
0162   /**
0163    * Return true, if this splitting kernel is supposed to work in a
0164    * strict large-N limit, i.e. replacing C_F by C_A/2
0165    */
0166   bool strictLargeN() const { return theStrictLargeN; }
0167 
0168 public:
0169 
0170   /**
0171    * Inform this splitting kernel, that it is being
0172    * presampled until a call to stopPresampling
0173    */
0174   virtual void startPresampling(const DipoleIndex&) {
0175     presampling = true;
0176   }
0177 
0178   /**
0179    * Inform this splitting kernel, that it is not being
0180    * presampled until a call to startPresampling
0181    */
0182   virtual void stopPresampling(const DipoleIndex&) {
0183     presampling = false;
0184   }
0185 
0186   /**
0187    * Return the number of points to presample this
0188    * splitting generator.
0189    */
0190   unsigned long presamplingPoints() const { return thePresamplingPoints; }
0191 
0192   /**
0193    * Return the maximum number of trials
0194    * to generate a splitting.
0195    */
0196   unsigned long maxtry() const { return theMaxtry; }
0197 
0198   /**
0199    * Return the number of accepted points after which the grid should
0200    * be frozen
0201    */
0202   unsigned long freezeGrid() const { return theFreezeGrid; }
0203 
0204   /**
0205    * Set the number of accepted points after which the grid should
0206    * be frozen
0207    */
0208   void freezeGrid(unsigned long n) { theFreezeGrid = n; }
0209 
0210   /**
0211    * Set a detuning factor to be applied to the sampling overestimate kernel
0212    */
0213   void detuning(double d) { theDetuning = d; }
0214 
0215   /**
0216    * Return the detuning factor applied to the sampling overestimate kernel
0217    */
0218   double detuning() const { return theDetuning; }
0219 
0220   /**
0221    * Evaluate this splitting kernel for the given
0222    * dipole splitting.
0223    */
0224   virtual double evaluate(const DipoleSplittingInfo&) const = 0;
0225   
0226   /**
0227    * Evaluate rho_ii' V_ijk V*_i'jk / equivalent for initial-state splitting,
0228    * required for generating spin-correlated azimuthal angles.
0229    **/
0230   virtual vector< pair<int, Complex> >  generatePhi( const DipoleSplittingInfo& dInfo, const RhoDMatrix& rho) const = 0;
0231    
0232   /**
0233    * Return the completely spin-unaveraged (i.e. spin-indexed) splitting kernel.
0234    **/
0235   virtual DecayMEPtr matrixElement(const DipoleSplittingInfo& dInfo) const = 0;
0236 
0237   /**
0238    * Clear the alphaPDF cache
0239    */
0240   void clearAlphaPDFCache() const {
0241     theAlphaSCache.clear();
0242     thePDFCache.clear();
0243   }
0244 
0245   /**
0246    * Update the variations vector at the given splitting using the indicated
0247    * kernel and overestimate values.
0248    */
0249   virtual void accept(const DipoleSplittingInfo&, double, double, map<string,double>&) const;
0250 
0251   /**
0252    * Update the variations vector at the given splitting using the indicated
0253    * kernel and overestimate values.
0254    */
0255   virtual void veto(const DipoleSplittingInfo&, double, double, map<string,double>&) const;
0256 
0257   /**
0258    * Return true, if this kernel is capable of
0259    * delivering an overestimate to the kernel, and
0260    * of inverting the integral over the overestimate
0261    * w.r.t. the phasepsace provided by the given
0262    * DipoleSplittingInfo object.
0263    */
0264   virtual bool haveOverestimate(const DipoleSplittingInfo&) const { return false; }
0265 
0266   /**
0267    * Return the overestimate to this splitting kernel 
0268    * for the given dipole splitting.
0269    */
0270   virtual double overestimate(const DipoleSplittingInfo&) const { return -1.; }
0271 
0272   /**
0273    * Invert the integral over the overestimate 
0274    * w.r.t. the phasepsace provided by the given
0275    * DipoleSplittingInfo object to equal
0276    * the given value.
0277    */
0278   virtual double invertOverestimateIntegral(const DipoleSplittingInfo&, double) const {
0279     return -1.; 
0280   }
0281   
0282   /**
0283    * .
0284    */
0285   bool useThisKernel() const {
0286     return theUseThisKernel;
0287   }
0288 
0289 public:
0290 
0291   /**
0292    * Get the factorization scale factor
0293    */
0294   double factorizationScaleFactor() const { return theFactorizationScaleFactor; }
0295 
0296   /**
0297    * Set the factorization scale factor
0298    */
0299   void factorizationScaleFactor(double f) { theFactorizationScaleFactor = f; }
0300 
0301   /**
0302    * Get the renormalization scale factor
0303    */
0304   double renormalizationScaleFactor() const { return theRenormalizationScaleFactor; }
0305 
0306   /**
0307    * Set the renormalization scale factor
0308    */
0309   void renormalizationScaleFactor(double f) { theRenormalizationScaleFactor = f; }
0310 
0311   /**
0312    * Return the CMW sheme used by the kernel
0313    */
0314   unsigned int cmwScheme() const {return theCMWScheme;}
0315   
0316 protected:
0317 
0318   /**
0319    * Return the common factor of (alphas/2pi)*(pdf ratio)
0320    */
0321   double alphaPDF(const DipoleSplittingInfo&,
0322           Energy optScale = ZERO,
0323           double rScaleFactor = 1.0,
0324           double fScaleFactor = 1.0) const;
0325 
0326   /**
0327    * Return true, if the virtuality of the splitting should be used as the
0328    * argument of alphas rather than the pt
0329    */
0330   bool virtualitySplittingScale() const { return theVirtualitySplittingScale; }
0331 
0332 public:
0333 
0334   /** @name Functions used by the persistent I/O system. */
0335   //@{
0336   /**
0337    * Function used to write out object persistently.
0338    * @param os the persistent output stream written to.
0339    */
0340   void persistentOutput(PersistentOStream & os) const;
0341 
0342   /**
0343    * Function used to read in object persistently.
0344    * @param is the persistent input stream read from.
0345    * @param version the version number of the object when written.
0346    */
0347   void persistentInput(PersistentIStream & is, int version);
0348   //@}
0349 
0350   /**
0351    * The standard Init function used to initialize the interfaces.
0352    * Called exactly once for each class by the class description system
0353    * before the main function starts or
0354    * when this class is dynamically loaded.
0355    */
0356   static void Init();
0357 
0358 
0359 // If needed, insert declarations of virtual function defined in the
0360 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
0361 
0362 private:
0363 
0364   /**
0365    * The alpha_s to be used.
0366    */
0367   Ptr<AlphaSBase>::ptr theAlphaS;
0368 
0369   /**
0370    * An optional 'colour screening' scale
0371    * for alternative intrinsic pt generation.
0372    */
0373   Energy theScreeningScale;
0374 
0375   /**
0376    * The splitting kinematics to be used.
0377    */
0378   Ptr<DipoleSplittingKinematics>::ptr theSplittingKinematics;
0379 
0380   /**
0381    * An optional PDF ratio object to be used
0382    * when evaluating this kernel.
0383    */
0384   Ptr<PDFRatio>::ptr thePDFRatio;
0385 
0386   /**
0387    * The number of points to presample this
0388    * splitting generator.
0389    */
0390   unsigned long thePresamplingPoints;
0391 
0392   /**
0393    * The maximum number of trials
0394    * to generate a splitting.
0395    */
0396   unsigned long theMaxtry;
0397   
0398   /**
0399    * The maximum value for any pdf ratio.
0400    * TODO: JB:Should this be an interfaced value? Is there a reasobable case where it should be allowed to be bigger than 1000000.?
0401    */
0402   static double theMaxPDFRatio;
0403   
0404   /**
0405    * Return the number of accepted points after which the grid should
0406    * be frozen
0407    */
0408   unsigned long theFreezeGrid;
0409 
0410   /**
0411    * The detuning factor applied to the sampling overestimate kernel
0412    */
0413   double theDetuning;
0414 
0415   /**
0416    * The flavour produced, if this cannot
0417    * be determined from the dipole.
0418    */
0419   PDPtr theFlavour;
0420 
0421   /**
0422    * Pointer to a check histogram object
0423    */
0424   Ptr<DipoleMCCheck>::ptr theMCCheck;
0425 
0426   /**
0427    * True, if this splitting kernel is supposed to work in a
0428    * strict large-N limit, i.e. replacing C_F by C_A/2
0429    */
0430   bool theStrictLargeN;
0431 
0432   /**
0433    * The factorization scale factor.
0434    */
0435   double theFactorizationScaleFactor;
0436 
0437   /**
0438    * The renormalization scale factor.
0439    */
0440   double theRenormalizationScaleFactor;
0441 
0442   /**
0443    * A freezing value for the renormalization scale
0444    */
0445   Energy theRenormalizationScaleFreeze;
0446 
0447   /**
0448    * A freezing value for the factorization scale
0449    */
0450   Energy theFactorizationScaleFreeze;
0451 
0452   /**
0453    * True, if the virtuality of the splitting should be used as the
0454    * argument of alphas rather than the pt
0455    */
0456   bool theVirtualitySplittingScale;
0457 
0458   /**
0459    * Implementing CMW in the kernels.
0460    **/
0461 
0462   unsigned int theCMWScheme=0;
0463 
0464   /**
0465    * Cache for alphas evaluations
0466    */
0467   mutable map<double,double> theAlphaSCache;
0468 
0469   /**
0470    * Cache for PDF evaluations
0471    */
0472   mutable map<double,double> thePDFCache;
0473 
0474   /**
0475    * True, if we are presampling
0476    */
0477   bool presampling;
0478 
0479   /**
0480    * True, if the kernel should be used
0481    */
0482   bool theUseThisKernel = true;
0483 
0484   
0485 private:
0486 
0487   /**
0488    * The static object used to initialize the description of this class.
0489    * Indicates that this is an abstract class with persistent data.
0490    */
0491   static AbstractClassDescription<DipoleSplittingKernel> initDipoleSplittingKernel;
0492 
0493   /**
0494    * The assignment operator is private and must never be called.
0495    * In fact, it should not even be implemented.
0496    */
0497   DipoleSplittingKernel & operator=(const DipoleSplittingKernel &) = delete;
0498 
0499 };
0500 
0501 }
0502 
0503 #include "ThePEG/Utilities/ClassTraits.h"
0504 
0505 namespace ThePEG {
0506 
0507 /** @cond TRAITSPECIALIZATIONS */
0508 
0509 /** This template specialization informs ThePEG about the
0510  *  base classes of DipoleSplittingKernel. */
0511 template <>
0512 struct BaseClassTrait<Herwig::DipoleSplittingKernel,1> {
0513   /** Typedef of the first base class of DipoleSplittingKernel. */
0514   typedef HandlerBase NthBase;
0515 };
0516 
0517 /** This template specialization informs ThePEG about the name of
0518  *  the DipoleSplittingKernel class and the shared object where it is defined. */
0519 template <>
0520 struct ClassTraits<Herwig::DipoleSplittingKernel>
0521   : public ClassTraitsBase<Herwig::DipoleSplittingKernel> {
0522   /** Return a platform-independent class name */
0523   static string className() { return "Herwig::DipoleSplittingKernel"; }
0524   /**
0525    * The name of a file containing the dynamic library where the class
0526    * DipoleSplittingKernel is implemented. It may also include several, space-separated,
0527    * libraries if the class DipoleSplittingKernel depends on other classes (base classes
0528    * excepted). In this case the listed libraries will be dynamically
0529    * linked in the order they are specified.
0530    */
0531   static string library() { return "HwDipoleShower.so"; }
0532 };
0533 
0534 /** @endcond */
0535 
0536 }
0537 
0538 #endif /* HERWIG_DipoleSplittingKernel_H */