herwig is hosted by Hepforge, IPPP Durham
Herwig  7.2.1
ThreeBodyAllOnCalculator.h
1 // -*- C++ -*-
2 //
3 // ThreeBodyAllOnCalculator.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4 // Copyright (C) 2002-2019 The Herwig Collaboration
5 //
6 // Herwig is licenced under version 3 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef HERWIG_ThreeBodyAllOnCalculator_H
10 #define HERWIG_ThreeBodyAllOnCalculator_H
11 // This is the declaration of the ThreeBodyAllOnCalculator class.
12 
13 #include "WidthCalculatorBase.h"
14 #include "Herwig/Utilities/GSLIntegrator.h"
15 #include "Herwig/Decay/DecayIntegrator.h"
16 #include "Herwig/Decay/DecayPhaseSpaceMode.h"
17 
18 namespace Herwig {
19 using namespace ThePEG;
20 
21 template <class T>
23 
24 
37 template <class T>
39 
40  struct Outer {
49 
53  Outer(typename Ptr<Herwig::ThreeBodyAllOnCalculator<T> >::const_pointer in,
54  double relerr)
55  : _integrand(in), _integrator(1e-35,relerr,1000)
56  {}
57 
61  Energy4 operator ()(double x) const {
62  Energy2 low, upp;
63  _integrand->outerVariables(x,low,upp);
64  return _integrator.value(*_integrand,low,upp);
65  }
67  typedef double ArgType;
69  typedef Energy4 ValType;
70 
74  typename Ptr<Herwig::ThreeBodyAllOnCalculator<T> >::const_pointer _integrand;
75 
80 };
81 
82 public:
83 
88  friend struct ThreeBodyAllOnOuter;
89 
90 public:
91 
105  ThreeBodyAllOnCalculator(vector<double> inweights,
106  vector<int> intype,
107  vector<Energy> inmass,
108  vector<Energy> inwidth,
109  vector<double> inpow,
110  T inme, int mode,
111  Energy m1,Energy m2,Energy m3,
112  double relerr=1e-3)
113  : _channelweights(inweights),_channeltype(intype),_channelmass(inmass),
114  _channelwidth(inwidth),_channelpower(inpow),_theME(inme),_mode(mode),
115  _thechannel(0),_mapping(inweights.size(),0),_souter(ZERO),
116  _integrator(1e-35,relerr,1000),_relerr(relerr) {
117  _m.resize(4);
118  _m[1]=m1;_m[2]=m2;_m[3]=m3;
119  _m2.resize(4);
120  for(int ix=1;ix<4;++ix) {
121  _m2[ix]=sqr(_m[ix]);
122  }
123  }
124 
130  Energy partialWidth(Energy2 q2) const;
131 
139  void resetMass(int imass,Energy mass) {
140  assert(imass<4);
141  _m[imass]=mass;
142  _m2[imass]=mass*mass;
143  }
144 
151  Energy getMass(const int imass) const {
152  assert(imass>=0&&imass<4);
153  return _m[imass];
154  }
155 
162  Energy otherMass(const int imass) const {
163  assert(imass>0&&imass<4);
164  if(imass==1) return _m[2]+_m[3];
165  else if(imass==2) return _m[1]+_m[3];
166  else return _m[1]+_m[2];
167  }
168 
174  Energy2 operator ()(Energy2 argument) const;
176  typedef Energy2 ArgType;
178  typedef Energy2 ValType;
179 
180 
181 protected:
182 
192  void outerVariables(double x, Energy2 & low, Energy2 & upp) const;
193 
194 private:
195 
199  ThreeBodyAllOnCalculator & operator=(const ThreeBodyAllOnCalculator &) = delete;
200 
201 private:
202 
206  vector<double> _channelweights;
207 
211  vector<int> _channeltype;
212 
216  vector<Energy> _channelmass;
217 
221  vector<Energy> _channelwidth;
222 
226  vector<double> _channelpower;
227 
232 
236  int _mode;
237 
241  mutable int _thechannel;
242 
246  mutable vector<int> _mapping;
247 
251  mutable Energy2 _souter;
252 
256  mutable vector<Energy> _m;
257 
261  mutable vector<Energy2> _m2;
262 
267 
271  double _relerr;
272 };
273 }
274 
275 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
276 #include "ThreeBodyAllOnCalculator.tcc"
277 #endif
278 
279 #endif /* HERWIG_ThreeBodyAllOnCalculator_H */
Energy2 ArgType
Argument type for the GSLIntegrator.
Energy4 ValType
Return type for the GSLIntegrator.
Ptr< Herwig::ThreeBodyAllOnCalculator< T > >::const_pointer _integrand
pointer to the decay integrator
The class for the outer integrand of the integral of a three body decay matrix element.
The WidthCalculatorBase class is a base class to be used by classes which calculate partial widths fo...
double _relerr
Relative error for the integration.
Outer(typename Ptr< Herwig::ThreeBodyAllOnCalculator< T > >::const_pointer in, double relerr)
Constructor with a pointer to the ThreeBodyAllOnCalculator.
vector< Energy2 > _m2
mass squareds of the external particles
GSLIntegrator _integrator
GSL integration class.
constexpr auto sqr(const T &x) -> decltype(x *x)
vector< int > _mapping
The mapping currently in used.
Energy2 ValType
Return type for the GSLIntegrator.
vector< double > _channelweights
weights for the different channels
Energy getMass(const int imass) const
Get the mass of one of the decay products.
vector< Energy > _m
masses of the external particles
vector< Energy > _channelmass
the mass of the resonance for a given channel
vector< Energy > _channelwidth
the width of the resonance for a given channel
ThreeBodyAllOnCalculator(vector< double > inweights, vector< int > intype, vector< Energy > inmass, vector< Energy > inwidth, vector< double > inpow, T inme, int mode, Energy m1, Energy m2, Energy m3, double relerr=1e-3)
Constructor with all the parameters.
vector< int > _channeltype
the types for the different channels
vector< double > _channelpower
the power for power-law smoothing for a given channel
-*- C++ -*-
double ArgType
Argument type for the GSLIntegrator.
This class is designed to integrate a given function between 2 limits using the gsl QAGS integration ...
Definition: GSLIntegrator.h:40
T _theME
Function giving the matrix element as a function of s12,s13,s23.
int _thechannel
the channel currently being integrated
void resetMass(int imass, Energy mass)
Get the mass of one of the decay products.
Energy otherMass(const int imass) const
Get the masses of all bar the one specified.
The ThreeBodyAllOnCalculator class is designed to integrate a three-body matrix element in which all ...
constexpr ZeroUnit ZERO
GSLIntegrator _integrator
member to do the integration
Energy2 _souter
the value of s for the outer integral