Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // ThreeBodyAllOnCalculator.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_ThreeBodyAllOnCalculator_H
0010 #define HERWIG_ThreeBodyAllOnCalculator_H
0011 // This is the declaration of the ThreeBodyAllOnCalculator class.
0012 
0013 #include "WidthCalculatorBase.h"
0014 #include "Herwig/Utilities/GSLIntegrator.h"
0015 
0016 namespace Herwig {
0017 using namespace ThePEG;
0018 
0019 template <class T>
0020 class ThreeBodyAllOnCalculator;
0021 
0022 
0023 /** \ingroup PDT
0024  *
0025  *  The ThreeBodyAllOnCalculator class is designed to integrate 
0026  *  a three-body matrix element in which all the outgoing particles are
0027  *  on-shell to give the partial width. A multi-channel type approach is
0028  *  used together with a GSL integration subroutine.
0029  *
0030  * @see GSLIntegrator
0031  * @see ThreeBodyAllOnOuter
0032  * @see ThreeBodyAllOnIner
0033  *
0034  */
0035 template <class T>
0036 class ThreeBodyAllOnCalculator: public WidthCalculatorBase {
0037 
0038 
0039 /** \ingroup PDT
0040  * The class for the outer integrand of the integral of a three body decay matrix
0041  * element. This class is used by the ThreeBodyAllOnCalculator
0042  * to perform the outer integral.
0043  *
0044  * @see ThreeBodyAllOnCalculator
0045  * @see ThreeBodyAllOnInner
0046  */ struct Outer {
0047  
0048   /**
0049    * Constructor with a pointer to the ThreeBodyAllOnCalculator
0050    */
0051    Outer(typename Ptr<Herwig::ThreeBodyAllOnCalculator<T> >::const_pointer in,
0052      double relerr)
0053     : _integrand(in), _integrator(1e-35,relerr,1000)
0054   {}
0055   
0056   /**
0057    * Retreive function value
0058    */
0059   Energy4 operator ()(double x) const {
0060     Energy2 low, upp;
0061     _integrand->outerVariables(x,low,upp);
0062     return _integrator.value(*_integrand,low,upp);
0063   }
0064   /** Argument type for the GSLIntegrator */
0065   typedef double ArgType;
0066   /** Return type for the GSLIntegrator */
0067   typedef Energy4 ValType;
0068 
0069   /**
0070    * pointer to the decay integrator
0071    */
0072   typename Ptr<Herwig::ThreeBodyAllOnCalculator<T> >::const_pointer _integrand;
0073   
0074   /**
0075    * GSL integration class
0076    */
0077   GSLIntegrator _integrator;
0078 };
0079 
0080 public:
0081 
0082   /**
0083    * The ThreeBodyAllOnOuter class is a friend so it can access the private
0084    * members and perform the integral.
0085    */
0086   friend struct ThreeBodyAllOnOuter;
0087 
0088 public:
0089 
0090   /**
0091    * Constructor with all the parameters
0092    * @param inweights The weights for the different integration channels
0093    * @param intype The types of the different integration channels.
0094    * @param inmass The mass for the Jacobian for the different channels.
0095    * @param inwidth The width for the Jacobian for the different channels.
0096    * @param inpow the power for power-law smoothing for a given channel
0097    * @param inme The pointer to the function which gives the matrix element.
0098    * @param mode The mode to be integrated
0099    * @param m1 The mass of the first particle.
0100    * @param m2 The mass of the second particle.
0101    * @param m3 The mass of the third  particle.
0102    */
0103   ThreeBodyAllOnCalculator(vector<double> inweights,
0104                vector<int> intype,
0105                vector<Energy> inmass,
0106                vector<Energy> inwidth,
0107                vector<double> inpow,
0108                T inme, int mode,
0109                Energy m1,Energy m2,Energy m3,
0110                double relerr=1e-3)
0111     : _channelweights(inweights),_channeltype(intype),_channelmass(inmass),
0112       _channelwidth(inwidth),_channelpower(inpow),_theME(inme),_mode(mode),
0113       _thechannel(0),_mapping(inweights.size(),0),_souter(ZERO),
0114       _integrator(1e-35,relerr,1000),_relerr(relerr) {
0115     _m.resize(4);
0116     _m[1]=m1;_m[2]=m2;_m[3]=m3;
0117     _m2.resize(4);
0118     for(int ix=1;ix<4;++ix) {
0119       _m2[ix]=sqr(_m[ix]);
0120     }
0121   }
0122 
0123   /**
0124    * calculate the width for a given mass
0125    * @param q2 The mass squared of the decaying particle.
0126    * @return The partial width.
0127    */
0128   Energy partialWidth(Energy2 q2) const;
0129 
0130   /**
0131    * Get the mass of one of the decay products.  This must be 
0132    * implemented in classes inheriting from this one.
0133    * @param imass The mass required.
0134    * @param mass The new value.
0135    * @return The mass required.
0136    */
0137   void resetMass(int imass,Energy mass) {
0138     assert(imass<4);
0139     _m[imass]=mass;
0140     _m2[imass]=mass*mass;
0141   }
0142 
0143   /**
0144    * Get the mass of one of the decay products.  This must be 
0145    * implemented in classes inheriting from this one.
0146    * @param imass The mass required.
0147    * @return The mass required.
0148    */
0149   Energy getMass(const int imass) const {
0150     assert(imass>=0&&imass<4);
0151     return _m[imass];
0152   }
0153 
0154   /**
0155    * Get the masses of all bar the one specified. Used to get the limits
0156    * for integration.
0157    * @param imass The particle not needed
0158    * @return The sum of the other masses.
0159    */
0160   Energy otherMass(const int imass) const {
0161     assert(imass>0&&imass<4);
0162     if(imass==1)      return _m[2]+_m[3];
0163     else if(imass==2) return _m[1]+_m[3];
0164     else              return _m[1]+_m[2];
0165   }
0166 
0167   /**
0168    * The integrand for the inner integrand.
0169    * @param argument The mass squared for the inner integral
0170    * @return The value of the inner integrand.
0171    */
0172   Energy2 operator ()(Energy2 argument) const;
0173   /** Argument type for the GSLIntegrator */
0174   typedef Energy2 ArgType;
0175   /** Return type for the GSLIntegrator */
0176   typedef Energy2 ValType;
0177 
0178 
0179 protected:
0180 
0181   /**
0182    * shift the variables for the outer integrand and give limits for the inner one.
0183    * This member sets the value of the _souter member for the mass squared of the 
0184    * outer integral and calculates the limits on the mass squared of the inner 
0185    * integral.
0186    * @param x The integration variable
0187    * @param low The lower limit for the inner integral.
0188    * @param upp The upper limit for the inner integral.
0189    */
0190   void outerVariables(double x, Energy2 & low, Energy2 & upp) const;
0191 
0192 private:
0193 
0194   /**
0195    * Private and non-existent assignment operator.
0196    */
0197   ThreeBodyAllOnCalculator & operator=(const ThreeBodyAllOnCalculator &) = delete;
0198 
0199 private:
0200   
0201   /**
0202    * weights for the different channels
0203    */
0204   vector<double> _channelweights;
0205 
0206   /**
0207    * the types for the different channels
0208    */
0209   vector<int> _channeltype;
0210 
0211   /**
0212    * the mass of the resonance for a given channel
0213    */
0214   vector<Energy> _channelmass;
0215 
0216   /**
0217    * the width of the resonance for a given channel
0218    */
0219   vector<Energy> _channelwidth;
0220 
0221   /**
0222    * the power for power-law smoothing for a given channel
0223    */
0224   vector<double> _channelpower;
0225 
0226   /**
0227    * Function giving the matrix element as a function of s12,s13,s23
0228    */
0229   T _theME;
0230 
0231   /**
0232    *  The mode
0233    */
0234   int _mode;
0235  
0236   /**
0237    * the channel currently being integrated
0238    */
0239   mutable int _thechannel;
0240 
0241   /**
0242    *  The mapping currently in used
0243    */
0244   mutable vector<int> _mapping;
0245 
0246   /**
0247    * the value of s for the outer integral
0248    */
0249   mutable Energy2 _souter;
0250 
0251   /**
0252    * masses of the external particles
0253    */
0254   mutable vector<Energy>  _m;
0255 
0256   /**
0257    * mass squareds of the external particles
0258    */
0259   mutable vector<Energy2> _m2;
0260 
0261   /**
0262    * member to do the integration
0263    */
0264   GSLIntegrator _integrator;
0265 
0266   /**
0267    *  Relative error for the integration
0268    */
0269   double _relerr;
0270 };
0271 }
0272 
0273 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
0274 #include "ThreeBodyAllOnCalculator.tcc"
0275 #endif
0276 
0277 #endif /* HERWIG_ThreeBodyAllOnCalculator_H */