Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 #ifndef HERWIG_HwMEBase_H
0003 #define HERWIG_HwMEBase_H
0004 //
0005 // This is the declaration of the HwMEBase class.
0006 //
0007 
0008 #include "ThePEG/MatrixElement/MEBase.h"
0009 #include "Herwig/Shower/RealEmissionProcess.fh"
0010 #include "Herwig/Shower/ShowerInteraction.h"
0011 #include "ThePEG/PDF/BeamParticleData.h"
0012 #include "HwMEBase.fh"
0013 
0014 namespace Herwig {
0015 
0016 struct Branching;
0017 
0018 using namespace ThePEG;
0019 
0020 typedef Ptr<BeamParticleData>::transient_const_pointer tcBeamPtr;
0021 
0022 /**
0023  * The HwMEBase class serves a number of purposes
0024  * - it implements the phase space for \f$2\to2\f$ scattering processes
0025  * - it provides virtual members for the implementation of hard radiation
0026  * - it gives us greater control over the masses of the outgoing
0027  *   particles so that they can be
0028  *   - set massless where required by gauge invariance
0029  *   - have their off-shell masses generated using the sophisticated approaches
0030  *     available in Herwig.
0031  *
0032  * @see \ref HwMEBaseInterfaces "The interfaces"
0033  * defined for HwMEBase.
0034  */
0035 class HwMEBase: public MEBase {
0036 
0037 public:
0038 
0039   /**
0040    * Default constructor.
0041    */
0042   HwMEBase() : lastTHat_(ZERO), lastUHat_(ZERO),
0043            lastPhi_(0.0), rescaleOption_(1)
0044   {}
0045 
0046   /** @name Virtual functions required by the MEBase class. */
0047   //@{
0048   /**
0049    * The number of internal degreed of freedom used in the matrix
0050    * element.
0051    */
0052   virtual int nDim() const;
0053 
0054   /**
0055    * Generate internal degrees of freedom given 'nDim()' uniform
0056    * random numbers in the interval ]0,1[. To help the phase space
0057    * generator, the 'dSigHatDR()' should be a smooth function of these
0058    * numbers, although this is not strictly necessary. Return
0059    * false if the chosen points failed the kinematical cuts.
0060    */
0061   virtual bool generateKinematics(const double * r);
0062 
0063   /**
0064    * Return the matrix element for the kinematical configuation
0065    * previously provided by the last call to setKinematics(). Uses
0066    * me().
0067    */
0068   virtual CrossSection dSigHatDR() const;
0069 
0070   /**
0071    * Set the typed and momenta of the incoming and outgoing partons to
0072    * be used in subsequent calls to me() and colourGeometries()
0073    * according to the associated XComb object.
0074    */
0075   virtual void setKinematics();
0076   //@}
0077 
0078   /**
0079    *  Virtual members to be overridden by inheriting classes
0080    *  which implement hard corrections 
0081    */
0082   //@{
0083 
0084   /**
0085    * Type of POWHEG correction
0086    */
0087   enum POWHEGType {No, ISR, FSR, Both};
0088 
0089   /**
0090    *  Has a POWHEG style correction
0091    */
0092   virtual POWHEGType  hasPOWHEGCorrection() {return No;}
0093 
0094   /**
0095    *  Has an old fashioned ME correction
0096    */
0097   virtual bool hasMECorrection() {return false;}
0098 
0099   /**
0100    *  Initialize the ME correction
0101    */
0102   virtual void initializeMECorrection(RealEmissionProcessPtr , double & ,
0103                       double & );
0104 
0105   /**
0106    *  Apply the hard matrix element correction to a given hard process or decay
0107    */
0108   virtual RealEmissionProcessPtr applyHardMatrixElementCorrection(RealEmissionProcessPtr);
0109 
0110   /**
0111    * Apply the soft matrix element correction
0112    * @param parent The initial particle in the current branching
0113    * @param progenitor The progenitor particle of the jet
0114    * @param fs Whether the emission is initial or final-state
0115    * @param highestpT The highest pT so far in the shower
0116    * @param ids ids of the particles produced in the branching
0117    * @param z The momentum fraction of the branching
0118    * @param scale the evolution scale of the branching
0119    * @param pT The transverse momentum of the branching
0120    * @return If true the emission should be vetoed
0121    */
0122   virtual bool softMatrixElementVeto(PPtr parent,
0123                      PPtr progenitor,
0124                      const bool & fs,
0125                      const Energy & highestpT,
0126                      const vector<tcPDPtr> & ids,
0127                      const double & z,
0128                      const Energy & scale,
0129                      const Energy & pT);
0130 
0131   /**
0132    *  Apply the POWHEG style correction
0133    */
0134   virtual RealEmissionProcessPtr generateHardest(RealEmissionProcessPtr,
0135                          ShowerInteraction);
0136   //@}
0137 
0138 public:
0139 
0140   /** @name Functions used by the persistent I/O system. */
0141   //@{
0142   /**
0143    * Function used to write out object persistently.
0144    * @param os the persistent output stream written to.
0145    */
0146   void persistentOutput(PersistentOStream & os) const;
0147 
0148   /**
0149    * Function used to read in object persistently.
0150    * @param is the persistent input stream read from.
0151    * @param version the version number of the object when written.
0152    */
0153   void persistentInput(PersistentIStream & is, int version);
0154   //@}
0155 
0156   /**
0157    * The standard Init function used to initialize the interfaces.
0158    * Called exactly once for each class by the class description system
0159    * before the main function starts or
0160    * when this class is dynamically loaded.
0161    */
0162   static void Init();
0163 
0164 protected:
0165 
0166   /** @name Access cached values in of the last set phase space point. */
0167   //@{
0168   /**
0169    * Return the \f$\hat{t}\f$ of the last set phase space point.
0170    */
0171   Energy2 tHat() const { return lastTHat_; }
0172 
0173   /**
0174    * Return the \f$\hat{u}\f$ of the last set phase space point.
0175    */
0176   Energy2 uHat() const { return lastUHat_; }
0177 
0178   /**
0179    * Return the azimuth angle of the last set phase space point.
0180    */
0181   double phi() const { return lastPhi_; }
0182   //@}
0183 
0184   /** @name Set the cached values in of the last set phase space point. */
0185   //@{
0186   /**
0187    * Set the \f$\hat{t}\f$ of the last set phase space point.
0188    */
0189   void tHat(Energy2 e2) { lastTHat_ = e2; }
0190 
0191   /**
0192    * Set the \f$\hat{u}\f$ of the last set phase space point.
0193    */
0194   void uHat(Energy2 e2) { lastUHat_ = e2; }
0195 
0196   /**
0197    * Set the azimuth angle of the last set phase space point.
0198    */
0199   void phi(double phi) { lastPhi_ = phi; }
0200   //@}
0201 
0202   /**
0203    *  Set the treatment of the outgoing masses
0204    * @param iopt The option for the treatment of the mass
0205    */
0206   void massOption(vector<unsigned int> iopt) {
0207     massOption_ = iopt;
0208   }
0209 
0210   /**
0211    *  Rescaled momenta for the helicity ME
0212    */
0213   //@{
0214   /**
0215    * Set the treatment of the rescaling of the momenta for 
0216    * the matrix element calculation
0217    * @param iopt The rescaling option
0218    */
0219   void rescalingOption(unsigned int iopt) {
0220     rescaleOption_=iopt;
0221   }
0222 
0223   /**
0224    *  rescale the momenta for the computation of the helicity matrix element
0225    */
0226   bool rescaleMomenta(const vector<Lorentz5Momentum> &,
0227               const cPDVector &);
0228 
0229   /**
0230    *  Access to the rescaled momenta
0231    */
0232   const vector<Lorentz5Momentum> & rescaledMomenta() const {
0233     return rescaledMomenta_;
0234   }
0235   //@}
0236 
0237   /**
0238    *  Generate the masses of the particles
0239    */ 
0240   bool generateMasses(vector<Energy> & masses, double & mjac,
0241               const double *r);
0242 
0243   /**
0244    * Used internally by generateKinematics, after calculating the
0245    * limits on cos(theta).
0246    */
0247   virtual double getCosTheta(double cthmin, double cthmax, const double r);
0248 
0249 private:
0250 
0251   /**
0252    * The assignment operator is private and must never be called.
0253    * In fact, it should not even be implemented.
0254    */
0255   HwMEBase & operator=(const HwMEBase &) = delete;
0256 
0257 private:
0258 
0259   /**
0260    *  Option for the treatment of the particle masses
0261    */
0262   vector<unsigned int> massOption_;
0263   
0264   /**
0265    * The \f$\hat{t}\f$ of the last set phase space point.
0266    */
0267   Energy2 lastTHat_;
0268   
0269   /**
0270    * The \f$\hat{u}\f$ of the last set phase space point.
0271    */
0272   Energy2 lastUHat_;
0273 
0274   /**
0275    * The azimuth angle of the last set phase space point.
0276    */
0277   double lastPhi_;
0278 
0279   /**
0280    *  Produced to produce rescaled momenta
0281    */
0282   unsigned int rescaleOption_;
0283 
0284   /**
0285    *  Rescaled momenta for use in ME calculations
0286    */
0287   vector<Lorentz5Momentum> rescaledMomenta_;
0288 
0289 };
0290 
0291 }
0292 
0293 #endif /* HERWIG_HwMEBase_H */