herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
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
16namespace Herwig {
17using namespace ThePEG;
18
19template <class T>
20class ThreeBodyAllOnCalculator;
21
22
35template <class T>
37
38 struct Outer {
47
51 Outer(typename Ptr<Herwig::ThreeBodyAllOnCalculator<T> >::const_pointer in,
52 double relerr)
53 : _integrand(in), _integrator(1e-35,relerr,1000)
54 {}
55
59 Energy4 operator ()(double x) const {
60 Energy2 low, upp;
61 _integrand->outerVariables(x,low,upp);
62 return _integrator.value(*_integrand,low,upp);
63 }
65 typedef double ArgType;
67 typedef Energy4 ValType;
68
72 typename Ptr<Herwig::ThreeBodyAllOnCalculator<T> >::const_pointer _integrand;
73
78};
79
80public:
81
86 friend struct ThreeBodyAllOnOuter;
87
88public:
89
103 ThreeBodyAllOnCalculator(vector<double> inweights,
104 vector<int> intype,
105 vector<Energy> inmass,
106 vector<Energy> inwidth,
107 vector<double> inpow,
108 T inme, int mode,
109 Energy m1,Energy m2,Energy m3,
110 double relerr=1e-3)
111 : _channelweights(inweights),_channeltype(intype),_channelmass(inmass),
112 _channelwidth(inwidth),_channelpower(inpow),_theME(inme),_mode(mode),
113 _thechannel(0),_mapping(inweights.size(),0),_souter(ZERO),
114 _integrator(1e-35,relerr,1000),_relerr(relerr) {
115 _m.resize(4);
116 _m[1]=m1;_m[2]=m2;_m[3]=m3;
117 _m2.resize(4);
118 for(int ix=1;ix<4;++ix) {
119 _m2[ix]=sqr(_m[ix]);
120 }
121 }
122
128 Energy partialWidth(Energy2 q2) const;
129
137 void resetMass(int imass,Energy mass) {
138 assert(imass<4);
139 _m[imass]=mass;
140 _m2[imass]=mass*mass;
141 }
142
149 Energy getMass(const int imass) const {
150 assert(imass>=0&&imass<4);
151 return _m[imass];
152 }
153
160 Energy otherMass(const int imass) const {
161 assert(imass>0&&imass<4);
162 if(imass==1) return _m[2]+_m[3];
163 else if(imass==2) return _m[1]+_m[3];
164 else return _m[1]+_m[2];
165 }
166
172 Energy2 operator ()(Energy2 argument) const;
174 typedef Energy2 ArgType;
176 typedef Energy2 ValType;
177
178
179protected:
180
190 void outerVariables(double x, Energy2 & low, Energy2 & upp) const;
191
192private:
193
198
199private:
200
204 vector<double> _channelweights;
205
209 vector<int> _channeltype;
210
214 vector<Energy> _channelmass;
215
219 vector<Energy> _channelwidth;
220
224 vector<double> _channelpower;
225
230
234 int _mode;
235
239 mutable int _thechannel;
240
244 mutable vector<int> _mapping;
245
249 mutable Energy2 _souter;
250
254 mutable vector<Energy> _m;
255
259 mutable vector<Energy2> _m2;
260
265
269 double _relerr;
270};
271}
272
273#ifndef ThePEG_TEMPLATES_IN_CC_FILE
274#include "ThreeBodyAllOnCalculator.tcc"
275#endif
276
277#endif /* HERWIG_ThreeBodyAllOnCalculator_H */
This class is designed to integrate a given function between 2 limits using the gsl QAGS integration ...
Definition: GSLIntegrator.h:40
ValT< T > value(const T &function, const typename T::ArgType lower, const typename T::ArgType upper) const
The value of the integral.
The ThreeBodyAllOnCalculator class is designed to integrate a three-body matrix element in which all ...
ThreeBodyAllOnCalculator & operator=(const ThreeBodyAllOnCalculator &)=delete
Private and non-existent assignment operator.
vector< int > _mapping
The mapping currently in used.
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.
Energy partialWidth(Energy2 q2) const
calculate the width for a given mass
void resetMass(int imass, Energy mass)
Get the mass of one of the decay products.
vector< Energy > _m
masses of the external particles
vector< double > _channelweights
weights for the different channels
vector< Energy > _channelwidth
the width of the resonance for a given channel
vector< double > _channelpower
the power for power-law smoothing for a given channel
vector< Energy2 > _m2
mass squareds of the external particles
double _relerr
Relative error for the integration.
Energy getMass(const int imass) const
Get the mass of one of the decay products.
void outerVariables(double x, Energy2 &low, Energy2 &upp) const
shift the variables for the outer integrand and give limits for the inner one.
vector< int > _channeltype
the types for the different channels
Energy2 ValType
Return type for the GSLIntegrator.
Energy2 operator()(Energy2 argument) const
The integrand for the inner integrand.
int _thechannel
the channel currently being integrated
Energy2 _souter
the value of s for the outer integral
Energy2 ArgType
Argument type for the GSLIntegrator.
Energy otherMass(const int imass) const
Get the masses of all bar the one specified.
T _theME
Function giving the matrix element as a function of s12,s13,s23.
friend struct ThreeBodyAllOnOuter
The ThreeBodyAllOnOuter class is a friend so it can access the private members and perform the integr...
GSLIntegrator _integrator
member to do the integration
vector< Energy > _channelmass
the mass of the resonance for a given channel
The WidthCalculatorBase class is a base class to be used by classes which calculate partial widths fo...
-*- C++ -*-
constexpr ZeroUnit ZERO
constexpr auto sqr(const T &x) -> decltype(x *x)
The class for the outer integrand of the integral of a three body decay matrix element.
Energy4 ValType
Return type for the GSLIntegrator.
Outer(typename Ptr< Herwig::ThreeBodyAllOnCalculator< T > >::const_pointer in, double relerr)
Constructor with a pointer to the ThreeBodyAllOnCalculator.
Ptr< Herwig::ThreeBodyAllOnCalculator< T > >::const_pointer _integrand
pointer to the decay integrator
double ArgType
Argument type for the GSLIntegrator.
Energy4 operator()(double x) const
Retreive function value.
GSLIntegrator _integrator
GSL integration class.