Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // GluonMassGenerator.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_GluonMassGenerator_H
0010 #define Herwig_GluonMassGenerator_H
0011 //
0012 // This is the declaration of the GluonMassGenerator class.
0013 //
0014 
0015 #include "ThePEG/Handlers/HandlerBase.h"
0016 #include "ThePEG/EventRecord/Particle.h"
0017 
0018 namespace Herwig {
0019 
0020 using namespace ThePEG;
0021 
0022 /**
0023  * \ingroup Hadronization
0024  * \brief Dynamic gluon mass generator; the default returns a constant mass.
0025  *
0026  * @see \ref GluonMassGeneratorInterfaces "The interfaces"
0027  * defined for GluonMassGenerator.
0028  */
0029 class GluonMassGenerator: public HandlerBase {
0030 
0031 public:
0032 
0033   /**
0034    * Generate a single gluon mass with possible reference to a hard
0035    * scale Q and up to a maximum value
0036    */
0037   virtual Energy generate(Energy, Energy) const {
0038     return generate();
0039   }
0040 
0041   /**
0042    * Generate a single gluon mass with possible reference to a hard
0043    * scale Q
0044    */
0045   virtual Energy generate(Energy) const {
0046     return generate();
0047   }             
0048 
0049   /**
0050    * Generate a single gluon mass without further constraints
0051    */
0052   virtual Energy generate() const {
0053     return getParticleData(ThePEG::ParticleID::g)->constituentMass();
0054   }
0055 
0056   /**
0057    * Generate a list of n gluon masses, with a maximum available energy
0058    */
0059   list<Energy> generateMany(size_t n, Energy QMax) const {
0060     list<Energy> res;
0061     Energy m0, mu, md, ms, mg, summg;
0062 
0063     mu=getParticleData(ThePEG::ParticleID::u)->constituentMass();
0064     md=getParticleData(ThePEG::ParticleID::d)->constituentMass();
0065     ms=getParticleData(ThePEG::ParticleID::s)->constituentMass();
0066 
0067     m0=md;
0068     if(mu<m0){m0=mu;}
0069     if(ms<m0){m0=ms;}
0070 
0071     if( QMax<2.0*m0*n ){
0072       throw Exception() << "cannot reshuffle to constituent mass shells" << Exception::eventerror;
0073     }
0074 
0075     bool repeat=true;
0076 
0077     while( repeat ){
0078       repeat=false;
0079       summg = 0.0*GeV;
0080       res.clear();
0081       for( size_t k = 0; k < n; ++k ){ 
0082         mg = generate();
0083         res.push_back(mg);
0084         summg += mg;
0085         if( summg > QMax - 2.0*m0*(n-k-1) ){
0086           repeat=true;
0087           break;
0088         }
0089       }
0090     }
0091 
0092     return res;
0093     
0094   }
0095 
0096 public:
0097 
0098   /** @name Functions used by the persistent I/O system. */
0099   //@{
0100   /**
0101    * Function used to write out object persistently.
0102    * @param os the persistent output stream written to.
0103    */
0104   void persistentOutput(PersistentOStream & os) const;
0105 
0106   /**
0107    * Function used to read in object persistently.
0108    * @param is the persistent input stream read from.
0109    * @param version the version number of the object when written.
0110    */
0111   void persistentInput(PersistentIStream & is, int version);
0112   //@}
0113 
0114   /**
0115    * The standard Init function used to initialize the interfaces.
0116    * Called exactly once for each class by the class description system
0117    * before the main function starts or
0118    * when this class is dynamically loaded.
0119    */
0120   static void Init();
0121 
0122 protected:
0123 
0124   /** @name Clone Methods. */
0125   //@{
0126   /**
0127    * Make a simple clone of this object.
0128    * @return a pointer to the new object.
0129    */
0130   virtual IBPtr clone() const;
0131 
0132   /** Make a clone of this object, possibly modifying the cloned object
0133    * to make it sane.
0134    * @return a pointer to the new object.
0135    */
0136   virtual IBPtr fullclone() const;
0137   //@}
0138 
0139 private:
0140 
0141   /**
0142    * The assignment operator is private and must never be called.
0143    * In fact, it should not even be implemented.
0144    */
0145   GluonMassGenerator & operator=(const GluonMassGenerator &) = delete;
0146 
0147 };
0148 
0149 }
0150 
0151 #endif /* Herwig_GluonMassGenerator_H */