Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // IFDipole.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_IFDipole_H
0010 #define HERWIG_IFDipole_H
0011 //
0012 // This is the declaration of the IFDipole class.
0013 //
0014 
0015 #include "ThePEG/Repository/EventGenerator.h"
0016 #include "Herwig/Utilities/Kinematics.h"
0017 #include "Herwig/Utilities/Maths.h"
0018 #include "ThePEG/StandardModel/StandardModelBase.h"
0019 #include "ThePEG/Vectors/Lorentz5Vector.h"
0020 #include "ThePEG/Interface/Interfaced.h"
0021 #include "IFDipole.fh"
0022 
0023 namespace Herwig {
0024 using namespace ThePEG;
0025 using ThePEG::Constants::pi;
0026 /** \ingroup Decay
0027  *
0028  * The IFDipole class generates radiation from a final-final dipole for
0029  * the generation of photons in decay by the SOPTHY algorithm.
0030  * 
0031  * @see SOPTHY 
0032  * @see \ref IFDipoleInterfaces "The interfaces"
0033  * defined for IFDipole.
0034  */
0035 class IFDipole: public Interfaced {
0036 
0037 public:
0038 
0039   /** @name Standard constructors and destructors. */
0040   //@{
0041   /**
0042    * The default constructor.
0043    */
0044   IFDipole() :
0045     _alpha(), _emin(1.0*MeV), _emax(), _multiplicity(),
0046     _map(2,0), _m(3), _chrg1(), _chrg2(), _qprf(2), _qnewprf(2),
0047     _lprf(), _bigLprf(), _qlab(2), _qnewlab(2), _llab(), _bigLlab(),
0048     _dipolewgt(), _yfswgt(), _jacobianwgt(), _mewgt(), _maxwgt(2.0),
0049     _mode(1), _maxtry(500), _energyopt(1), _betaopt(1)
0050   {}
0051   //@}
0052 
0053 public:
0054 
0055   /**
0056    *  Member to generate the photons from the dipole
0057    * @param p The decaying particle
0058    * @param children The decay products
0059    * @return The decay products with additional radiation
0060    */
0061   virtual ParticleVector generatePhotons(const Particle & p,ParticleVector children);
0062 
0063 public:
0064 
0065   /** @name Functions used by the persistent I/O system. */
0066   //@{
0067   /**
0068    * Function used to write out object persistently.
0069    * @param os the persistent output stream written to.
0070    */
0071   void persistentOutput(PersistentOStream & os) const;
0072 
0073   /**
0074    * Function used to read in object persistently.
0075    * @param is the persistent input stream read from.
0076    * @param version the version number of the object when written.
0077    */
0078   void persistentInput(PersistentIStream & is, int version);
0079   //@}
0080 
0081   /**
0082    * The standard Init function used to initialize the interfaces.
0083    * Called exactly once for each class by the class description system
0084    * before the main function starts or
0085    * when this class is dynamically loaded.
0086    */
0087   static void Init();
0088 
0089 protected:
0090 
0091   /** @name Clone Methods. */
0092   //@{
0093   /**
0094    * Make a simple clone of this object.
0095    * @return a pointer to the new object.
0096    */
0097   virtual IBPtr clone() const {return new_ptr(*this);}
0098 
0099   /** Make a clone of this object, possibly modifying the cloned object
0100    * to make it sane.
0101    * @return a pointer to the new object.
0102    */
0103   virtual IBPtr fullclone() const {return new_ptr(*this);}
0104   //@}
0105 
0106 protected:
0107 
0108   /** @name Standard Interfaced functions. */
0109   //@{
0110   /**
0111    * Initialize this object after the setup phase before saving an
0112    * EventGenerator to disk.
0113    * @throws InitException if object could not be initialized properly.
0114    */
0115   virtual void doinit();
0116   //@}
0117 
0118 protected:
0119 
0120   /**
0121    *  Average crude photon multiplicity
0122    * @param beta1 Velocity of the first charged particle, \f$\beta_1\f$.
0123    * @param ombeta1 One minus the velocity of the first particle,  \f$1-\beta_1\f$.
0124    * @return The average photon multiplicity
0125    */
0126   double nbar(double beta1,double ombeta1) {
0127     return  _alpha/pi*_chrg1*_chrg2/beta1*
0128       log((1.+beta1)/ombeta1)*log(_emax/_emin);
0129   }
0130 
0131   /**
0132    * Generate the momentum of a photon 
0133    * @param beta1 The velocity, \f$\beta_1\f$, of the first charged particle
0134    * @param ombeta1 One minus the velocity, \f$1-\beta_1\f$, of the first 
0135    * charged particle which is supplied for numerical stability
0136    * @return The contribution to the dipole weight
0137    */
0138   double photon(double beta1,double ombeta1);
0139 
0140   /**
0141    *  Calculate the exact weight for the dipole.
0142    * @param beta1 Velocity of the first charged particle, \f$\beta_1\f$
0143    * @param ombeta1 One minus the velocity of the first particle,  \f$1-\beta_1\f$
0144    * @param iphot The number of the photon for which the weight is required
0145    * @return The weight
0146    */
0147   double exactDipoleWeight(double beta1,double ombeta1,
0148                unsigned int iphot) {
0149     double ombc;
0150     // if cos is greater than zero use result accurate as cos->1
0151     if(_cosphot[iphot]>0.0)
0152       ombc=ombeta1+beta1*sqr(_sinphot[iphot])/(1.+_cosphot[iphot]);
0153     // if cos is less    than zero use result accurate as cos->-1
0154     else
0155       ombc=1.-beta1*_cosphot[iphot];
0156     return 1.0*sqr(beta1*_sinphot[iphot]/ombc);
0157   }
0158 
0159   /**
0160    *  The crude YFS form factor for calculating the weight
0161    * @param b   Velocity of the first charged particle, \f$\beta_1\f$
0162    * @param omb One minus the velocity of the first particle,  \f$1-\beta_1\f$
0163    * @return The YFS form factor
0164    */
0165   double crudeYFSFormFactor(double b,double omb) {
0166     double Y =-_alpha/pi*_chrg1*_chrg2 / b * log((1.+b)/omb) * log(_m[0]/(2.*_emin));
0167     return exp(Y);
0168   }
0169 
0170   /**
0171    *  The exact YFS form factor for calculating the weight
0172    * @param beta1 Velocity of the first charged particle, \f$\beta_1\f$
0173    * @param beta2 Velocity of the second charged particle, \f$\beta_2\f$.
0174    * @param ombeta1 One minus the velocity of the first particle,  \f$1-\beta_1\f$
0175    * @param ombeta2 One minus the velocity of the second particle,  \f$1-\beta_2\f$
0176    * @return The YFS form factor
0177    */
0178   double exactYFSFormFactor(double beta1,double ombeta1,
0179                         double beta2,double ombeta2);
0180 
0181   /**
0182    * Jacobian factor for the weight
0183    */
0184   double jacobianWeight();
0185 
0186   /**
0187    * Matrix element weight
0188    */
0189   double meWeight(ParticleVector children);
0190 
0191   /**
0192    * Member which generates the photons
0193    * @param boost Boost vector to take the particles produced back from
0194    * the decaying particle's rest frame to the lab
0195    * @param children The decay products
0196    */
0197   double makePhotons(Boost boost,ParticleVector children);
0198 
0199   /**
0200    *  Compute a Lorentz transform from p to q
0201    * @param p Original momentum
0202    * @param q Final momentum
0203    */
0204   LorentzRotation solveBoost(const Lorentz5Momentum & q, 
0205                  const Lorentz5Momentum & p ) const;
0206 
0207 private:
0208 
0209   /**
0210    * The assignment operator is private and must never be called.
0211    * In fact, it should not even be implemented.
0212    */
0213   IFDipole & operator=(const IFDipole &) = delete;
0214 
0215 private:
0216 
0217   /**
0218    *  the fine structure constant at $q^2=0$
0219    */
0220   double _alpha;
0221 
0222   /**
0223    *  The minimum photon energy
0224    */
0225   Energy _emin;
0226 
0227   /**
0228    *  The maximum photon energy
0229    */
0230   Energy _emax;
0231 
0232   /**
0233    *  Photon multiplicity being generated
0234    */
0235   unsigned int _multiplicity;
0236 
0237   /**
0238    *  Map from arguments of lists such that
0239    *  _q???[_map[0]] is the charged child and
0240    *  _q???[_map[1]] is the neutral child.
0241    */
0242   vector<int> _map;
0243 
0244   /**
0245    *  Masses of the particles involved
0246    */
0247   vector<Energy> _m;
0248 
0249   /**
0250    *  charge of the parent particle 
0251    */
0252   double _chrg1;
0253 
0254   /**
0255    *  charge of the (charged) child particle 
0256    */
0257   double _chrg2;
0258 
0259   /**
0260    *  Momentum of the particles in the parent's rest frame
0261    */
0262   //@{
0263   /**
0264    *  Momenta of the charged particles in the parent's rest frame before radiation
0265    */
0266   vector<Lorentz5Momentum> _qprf;
0267 
0268   /**
0269    *  Momenta of the charged particles in the parent's rest frame after radiation
0270    */
0271   vector<Lorentz5Momentum> _qnewprf;
0272 
0273   /**
0274    *  Momenta of the photons in the parent rest frame
0275    */
0276   vector<Lorentz5Momentum> _lprf;
0277 
0278   /**
0279    * Total momentum of the photons in the parent rest frame
0280    */
0281   Lorentz5Momentum _bigLprf;
0282   //@}
0283 
0284   /**
0285    *  Momentum of the particles in the lab frame
0286    */
0287   //@{
0288   /**
0289    *  Momenta of the charged particles in the lab frame before radiation
0290    */
0291   vector<Lorentz5Momentum> _qlab;
0292   
0293   /**
0294    *  Momenta of the charged particles in the lab frame after  radiation
0295    */
0296   vector<Lorentz5Momentum> _qnewlab;
0297 
0298   /**
0299    *  Momenta of the photons in the lab frame
0300    */
0301   vector<Lorentz5Momentum> _llab;
0302 
0303   /**
0304    * Total momentum of the photons in the lab frame
0305    */
0306   Lorentz5Momentum _bigLlab;
0307   //@}
0308 
0309 
0310   /**
0311    *  Reweighting factors due to differences between the true and crude
0312    *  distributions
0313    */
0314   //@{
0315   /**
0316    *  Reweighting factor for the real emission
0317    */
0318   double _dipolewgt;
0319 
0320   /**
0321    *  Reweighting factor for the YFS form-factor
0322    */
0323   double _yfswgt;
0324 
0325   /**
0326    *  Reweighting factor due to phase space
0327    */
0328   double _jacobianwgt;
0329 
0330   /**
0331    *  Reweighting factor due to matrix element corrections
0332    */
0333   double _mewgt;
0334 
0335   /**
0336    *  Maximum weight
0337    */
0338   double _maxwgt;
0339   //@}
0340 
0341   /**
0342    *  Angles of the photons with respect to the first charged particle
0343    * which are stored for numerical accuracy
0344    */
0345   //@{
0346   /**
0347    *  Cosine of the photon angles
0348    */
0349   vector<double> _cosphot;
0350 
0351   /**
0352    *  Sine of the photon angles
0353    */
0354   vector<double> _sinphot;
0355   //@}
0356 
0357   /**
0358    *  Type of unweighting to perform
0359    */
0360   unsigned int _mode;
0361 
0362   /**
0363    *  Maximum number of attempts to generate a result
0364    */
0365   unsigned int _maxtry;
0366 
0367   /**
0368    *  Option for the energy cut-off
0369    */
0370   unsigned int _energyopt;
0371 
0372   /**
0373    *  Option for the inclusion of higher order corrections
0374    */
0375   unsigned int _betaopt;
0376 
0377 };
0378 
0379 }
0380 
0381 #endif /* HERWIG_IFDipole_H */