Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // ShowerApproximationGenerator.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_ShowerApproximationGenerator_H
0010 #define Herwig_ShowerApproximationGenerator_H
0011 //
0012 // This is the declaration of the ShowerApproximationGenerator class.
0013 //
0014 
0015 #include "ThePEG/Handlers/StepHandler.h"
0016 #include "Herwig/MatrixElement/Matchbox/Matching/ShowerApproximationKernel.h"
0017 #include "Herwig/MatrixElement/Matchbox/Phasespace/MatchboxPhasespace.h"
0018 #include "Herwig/MatrixElement/Matchbox/MatchboxFactory.h"
0019 
0020 namespace Herwig {
0021 
0022 using namespace ThePEG;
0023 
0024 /**
0025  * \ingroup Matchbox
0026  * \author Simon Platzer
0027  *
0028  * \brief ShowerApproximationGenerator generates emissions according to a
0029  * shower approximation entering a NLO matching.
0030  *
0031  */
0032 class ShowerApproximationGenerator: public StepHandler {
0033 
0034 public:
0035 
0036   /**
0037    * The default constructor.
0038    */
0039   ShowerApproximationGenerator();
0040 
0041 public:
0042 
0043   /** @name Virtual functions required by the StepHandler class. */
0044   //@{
0045   /**
0046     * The main function called by the EventHandler class to
0047     * perform a step. Given the current state of an Event, this function
0048     * performs the event generation step and includes the result in a new
0049     * Step object int the Event record.
0050     * @param eh the EventHandler in charge of the Event generation.
0051     * @param tagged if not empty these are the only particles which should
0052     * be considered by the StepHandler.
0053     * @param hint a Hint object with possible information from previously
0054     * performed steps.
0055     * @throws Veto if the StepHandler requires the current step to be discarded.
0056     * @throws Stop if the generation of the current Event should be stopped
0057     * after this call.
0058     * @throws Exception if something goes wrong.
0059     */
0060   virtual void handle(EventHandler & eh, const tPVector & tagged,
0061               const Hint & hint);
0062   //@}
0063 
0064 public:
0065 
0066   /**
0067    * Fill information on the Born process
0068    */
0069   bool prepare(bool didproject);
0070 
0071   /**
0072    * Generate a Born phase space point while kernels are being
0073    * presampled
0074    */
0075   bool generate(const vector<double>&);
0076 
0077   /**
0078    * Restore information on the Born process
0079    */
0080   void restore();
0081 
0082 protected:
0083 
0084   /**
0085    * Generate a momentum fraction for the given parton species
0086    */
0087   double generateFraction(tcPDPtr, double, double) const;
0088 
0089   /**
0090    * Invert the momentum fraction for the given parton species
0091    */
0092   double invertFraction(tcPDPtr, double, double) const;
0093 
0094   /**
0095    * Return the pt cut to be applied for final-final dipoles.
0096    */
0097   Energy ffPtCut() const { return theShowerApproximation->ffPtCut(); }
0098 
0099   /**
0100    * Return the pt cut to be applied for final-initial dipoles.
0101    */
0102   Energy fiPtCut() const { return theShowerApproximation->fiPtCut(); }
0103 
0104   /**
0105    * Return the pt cut to be applied for initial-initial dipoles.
0106    */
0107   Energy iiPtCut() const { return theShowerApproximation->iiPtCut(); }
0108 
0109 public:
0110 
0111   /** @name Functions used by the persistent I/O system. */
0112   //@{
0113   /**
0114    * Function used to write out object persistently.
0115    * @param os the persistent output stream written to.
0116    */
0117   void persistentOutput(PersistentOStream & os) const;
0118 
0119   /**
0120    * Function used to read in object persistently.
0121    * @param is the persistent input stream read from.
0122    * @param version the version number of the object when written.
0123    */
0124   void persistentInput(PersistentIStream & is, int version);
0125   //@}
0126 
0127   /**
0128    * The standard Init function used to initialize the interfaces.
0129    * Called exactly once for each class by the class description system
0130    * before the main function starts or
0131    * when this class is dynamically loaded.
0132    */
0133   static void Init();
0134 
0135 protected:
0136 
0137   /** @name Clone Methods. */
0138   //@{
0139   /**
0140    * Make a simple clone of this object.
0141    * @return a pointer to the new object.
0142    */
0143   virtual IBPtr clone() const;
0144 
0145   /** Make a clone of this object, possibly modifying the cloned object
0146    * to make it sane.
0147    * @return a pointer to the new object.
0148    */
0149   virtual IBPtr fullclone() const;
0150   //@}
0151 
0152 
0153 // If needed, insert declarations of virtual function defined in the
0154 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
0155 
0156 
0157 private:
0158 
0159   /**
0160    * The shower approximation to consider
0161    */
0162   Ptr<ShowerApproximation>::ptr theShowerApproximation;
0163 
0164   /**
0165    * The (invertible) phase space generator to use
0166    */
0167   Ptr<MatchboxPhasespace>::ptr thePhasespace;
0168 
0169   /**
0170    * Map hard processes to the respective kernels.
0171    */
0172   map<cPDVector,set<Ptr<ShowerApproximationKernel>::ptr> > theKernelMap;
0173 
0174   /**
0175    * The number of points to presample this splitting generator.
0176    */
0177   unsigned long thePresamplingPoints;
0178 
0179   /**
0180    * The maximum number of trials to generate a splitting.
0181    */
0182   unsigned long theMaxTry;
0183 
0184   /**
0185    * Return the number of accepted points after which the grid should
0186    * be frozen
0187    */
0188   unsigned long theFreezeGrid;
0189 
0190   /**
0191    * The last external Born XComb dealt with
0192    */
0193   tStdXCombPtr lastIncomingXComb;
0194 
0195   // the next three are filled from the incoming xcomb in the prepare method
0196 
0197   /**
0198    * The last internal Born matrix element dealt with
0199    */
0200   Ptr<MatchboxMEBase>::ptr theLastBornME;
0201 
0202   /**
0203    * The last Born phase space point
0204    */
0205   vector<Lorentz5Momentum> theLastMomenta;
0206 
0207   /**
0208    * The last Born phase space point used while presampling
0209    */
0210   vector<Lorentz5Momentum> theLastPresamplingMomenta;
0211 
0212   /**
0213    * The random numbers which have produced the last Born phase space
0214    * point.
0215    */
0216   vector<double> theLastRandomNumbers;
0217 
0218   /**
0219    * The last internal Born XComb dealt with
0220    */
0221   tStdXCombPtr theLastBornXComb;
0222 
0223   /**
0224    * The last internal incoming partons dealt with
0225    */
0226   PPair theLastPartons;
0227 
0228   /**
0229    * True, if sampler should apply compensation
0230    */
0231   bool theDoCompensate;
0232 
0233   /**
0234    * The assignment operator is private and must never be called.
0235    * In fact, it should not even be implemented.
0236    */
0237   ShowerApproximationGenerator & operator=(const ShowerApproximationGenerator &) = delete;
0238 
0239 };
0240 
0241 }
0242 
0243 #endif /* Herwig_ShowerApproximationGenerator_H */