EvtGen
2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Toggle main menu visibility
Loading...
Searching...
No Matches
src
EvtGenModels
EvtBtoXsgammaFermiUtil.cpp
Go to the documentation of this file.
1
2
/***********************************************************************
3
* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4
* *
5
* This file is part of EvtGen. *
6
* *
7
* EvtGen is free software: you can redistribute it and/or modify *
8
* it under the terms of the GNU General Public License as published by *
9
* the Free Software Foundation, either version 3 of the License, or *
10
* (at your option) any later version. *
11
* *
12
* EvtGen is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
16
* *
17
* You should have received a copy of the GNU General Public License *
18
* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19
***********************************************************************/
20
21
#include "
EvtGenModels/EvtBtoXsgammaFermiUtil.hh
"
22
23
#include "
EvtGenBase/EvtConst.hh
"
24
#include "
EvtGenBase/EvtReport.hh
"
25
26
#include "
EvtGenModels/EvtBtoXsgammaRootFinder.hh
"
27
#include "
EvtGenModels/EvtItgFunction.hh
"
28
#include "
EvtGenModels/EvtItgTwoCoeffFcn.hh
"
29
30
#include <iostream>
31
#include <math.h>
32
using
std::endl;
33
34
double
EvtBtoXsgammaFermiUtil::FermiExpFunc
(
double
y,
35
const
std::vector<double>& coeffs )
36
{
37
//coeffs: 1 = lambdabar, 2 = a, 3 = lam1, 4 = norm
38
// EvtGenReport(EVTGEN_INFO,"EvtGen")<<coeffs[4]<<endl;
39
return
( pow( 1. - ( y / coeffs[1] ), coeffs[2] ) *
40
exp
( ( -3. * pow( coeffs[1], 2. ) / coeffs[3] ) * y / coeffs[1] ) ) /
41
coeffs[4];
42
}
43
44
double
EvtBtoXsgammaFermiUtil::FermiGaussFunc
(
double
y,
45
const
std::vector<double>& coeffs )
46
{
47
//coeffs: 1 = lambdabar, 2 = a, 3 = c, 4 = norm
48
return
( pow( 1. - ( y / coeffs[1] ), coeffs[2] ) *
49
exp
( -pow( coeffs[3], 2. ) * pow( 1. - ( y / coeffs[1] ), 2. ) ) ) /
50
coeffs[4];
51
}
52
53
double
EvtBtoXsgammaFermiUtil::FermiGaussFuncRoot
(
54
double
lambdabar,
double
lam1,
double
mb, std::vector<double>& gammaCoeffs )
55
{
56
std::vector<double> coeffs1 = { 0.2, lambdabar, 0.0 };
57
std::vector<double> coeffs2 = { 0.2, lambdabar, -lam1 / 3. };
58
59
auto
lhFunc =
EvtItgTwoCoeffFcn
{ &
FermiGaussRootFcnA
, -mb, lambdabar,
60
coeffs1, gammaCoeffs };
61
auto
rhFunc =
EvtItgTwoCoeffFcn
{ &
FermiGaussRootFcnB
, -mb, lambdabar,
62
coeffs2, gammaCoeffs };
63
auto
rootFinder =
EvtBtoXsgammaRootFinder
{};
64
65
return
rootFinder.
GetGaussIntegFcnRoot
( &lhFunc, &rhFunc, 1.0e-4, 1.0e-4,
66
40, 40, -mb, lambdabar, 0.2, 0.4,
67
1.0e-6 );
68
}
69
70
double
EvtBtoXsgammaFermiUtil::FermiGaussRootFcnA
(
71
double
y,
const
std::vector<double>& coeffs1,
72
const
std::vector<double>& coeffs2 )
73
{
74
//coeffs1: 0=ap, 1=lambdabar, coeffs2=gamma function coeffs
75
double
cp =
Gamma
( ( 2.0 + coeffs1[0] ) / 2., coeffs2 ) /
76
Gamma
( ( 1.0 + coeffs1[0] ) / 2., coeffs2 );
77
78
return
( y * y ) * pow( ( 1. - ( y / coeffs1[1] ) ), coeffs1[0] ) *
79
exp
( -pow( cp, 2 ) * pow( ( 1. - ( y / coeffs1[1] ) ), 2. ) );
80
}
81
82
double
EvtBtoXsgammaFermiUtil::FermiGaussRootFcnB
(
83
double
y,
const
std::vector<double>& coeffs1,
84
const
std::vector<double>& coeffs2 )
85
{
86
//coeffs1: 0=ap, 1=lambdabar, coeffs2=gamma function coeffs
87
double
cp =
Gamma
( ( 2.0 + coeffs1[0] ) / 2., coeffs2 ) /
88
Gamma
( ( 1.0 + coeffs1[0] ) / 2., coeffs2 );
89
return
pow( ( 1. - ( y / coeffs1[1] ) ), coeffs1[0] ) *
90
exp
( -pow( cp, 2 ) * pow( ( 1. - ( y / coeffs1[1] ) ), 2. ) );
91
}
92
93
double
EvtBtoXsgammaFermiUtil::Gamma
(
double
z,
const
std::vector<double>& coeffs )
94
{
95
//Lifted from Numerical Recipies in C
96
double
x, y, tmp, ser;
97
98
int
j;
99
y = z;
100
x = z;
101
102
tmp = x + 5.5;
103
tmp = tmp - ( x + 0.5 ) * log( tmp );
104
ser = 1.000000000190015;
105
106
for
( j = 0; j < 6; j++ ) {
107
y = y + 1.0;
108
ser = ser + coeffs[j] / y;
109
}
110
111
return
exp
( -tmp + log( 2.5066282746310005 * ser / x ) );
112
}
113
114
double
EvtBtoXsgammaFermiUtil::BesselK1
(
double
x )
115
{
116
//Lifted from Numerical Recipies in C : Returns the modified Bessel
117
//function K_1(x) for positive real x
118
if
( x < 0.0 )
119
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
) <<
"x is negative !"
<< endl;
120
121
double
y, ans;
122
123
if
( x <= 2.0 ) {
124
y = x * x / 4.0;
125
ans = ( log( x / 2.0 ) *
BesselI1
( x ) ) +
126
( 1.0 / x ) *
127
( 1.0 +
128
y * ( 0.15443144 +
129
y * ( -0.67278579 +
130
y * ( -0.18156897 +
131
y * ( -0.1919402e-1 +
132
y * ( -0.110404e-2 +
133
y * ( -0.4686e-4 ) ) ) ) ) ) );
134
}
else
{
135
y = 2.0 / x;
136
ans = (
exp
( -x ) / sqrt( x ) ) *
137
( 1.25331414 +
138
y * ( 0.23498619 +
139
y * ( -0.3655620e-1 +
140
y * ( 0.1504268e-1 +
141
y * ( -0.780353e-2 +
142
y * ( 0.325614e-2 +
143
y * ( -0.68245e-3 ) ) ) ) ) ) );
144
}
145
return
ans;
146
}
147
148
double
EvtBtoXsgammaFermiUtil::BesselI1
(
double
x )
149
{
150
//Lifted from Numerical Recipies in C : Returns the modified Bessel
151
//function I_1(x) for any real x
152
153
double
ax, ans;
154
double
y;
155
156
ax = fabs( x );
157
if
( ax < 3.75 ) {
158
y = x / 3.75;
159
y *= y;
160
ans = ax *
161
( 0.5 + y * ( 0.87890594 +
162
y * ( 0.51498869 +
163
y * ( 0.15084934 +
164
y * ( 0.2658733e-1 +
165
y * ( 0.301532e-2 +
166
y * 0.32411e-3 ) ) ) ) ) );
167
}
else
{
168
y = 3.75 / ax;
169
ans = 0.2282967e-1 +
170
y * ( -0.2895312e-1 + y * ( 0.1787654e-1 - y * 0.420059e-2 ) );
171
ans = 0.398914228 +
172
y * ( -0.3988024e-1 +
173
y * ( -0.362018e-2 +
174
y * ( 0.163801e-2 + y * ( -0.1031555e-1 + y * ans ) ) ) );
175
ans *= (
exp
( ax ) / sqrt( ax ) );
176
}
177
return
x < 0.0 ? -ans : ans;
178
}
179
180
double
EvtBtoXsgammaFermiUtil::FermiRomanFuncRoot
(
double
lambdabar,
double
lam1 )
181
{
182
auto
lhFunc =
EvtItgFunction
{ &
FermiRomanRootFcnA
, -1.e-6, 1.e6 };
183
184
auto
rootFinder =
EvtBtoXsgammaRootFinder
{};
185
double
rhSide = 1.0 - ( lam1 / ( 3.0 * lambdabar * lambdabar ) );
186
187
double
rho = rootFinder.
GetRootSingleFunc
( &lhFunc, rhSide, 0.1, 0.4, 1.0e-6 );
188
//rho=0.250353;
189
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
190
<<
"rho/2 "
<< rho / 2. <<
" bessel "
<<
BesselK1
( rho / 2. ) << endl;
191
double
pF = lambdabar * sqrt(
EvtConst::pi
) /
192
( rho *
exp
( rho / 2. ) *
BesselK1
( rho / 2. ) );
193
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
194
<<
"rho "
<< rho <<
" pf "
<< pF << endl;
195
196
return
rho;
197
}
198
199
double
EvtBtoXsgammaFermiUtil::FermiRomanRootFcnA
(
double
y )
200
{
201
return
EvtConst::pi
* ( 2. + y ) * pow( y, -2. ) *
exp
( -y ) *
202
pow(
BesselK1
( y / 2. ), -2. );
203
}
204
double
EvtBtoXsgammaFermiUtil::FermiRomanFunc
(
double
y,
205
const
std::vector<double>& coeffs )
206
{
207
if
( y == ( coeffs[1] - coeffs[2] ) )
208
y = 0.99999999 * ( coeffs[1] - coeffs[2] );
209
210
//coeffs: 1 = mB, 2=mb, 3=rho, 4=lambdabar, 5=norm
211
double
pF = coeffs[4] * sqrt(
EvtConst::pi
) /
212
( coeffs[3] *
exp
( coeffs[3] / 2. ) *
BesselK1
( coeffs[3] / 2. ) );
213
// EvtGenReport(EVTGEN_INFO,"EvtGen")<<" pf "<<y<<" "<<pF<<" "<<coeffs[1]<<" "<<coeffs[2]<<" "<<coeffs[3]<<" "<<coeffs[4]<<" "<<coeffs[5]<<endl;
214
//double pF=0.382533;
215
216
//EvtGenReport(EVTGEN_INFO,"EvtGen")<<(coeffs[1]-coeffs[2])*(1./(sqrt(EvtConst::pi)*pF))<<endl;
217
//EvtGenReport(EVTGEN_INFO,"EvtGen")<<(1.-y/(coeffs[1]-coeffs[2]))<<endl;
218
//EvtGenReport(EVTGEN_INFO,"EvtGen")<<(coeffs[1]-coeffs[2])<<endl;
219
//EvtGenReport(EVTGEN_INFO,"EvtGen")<<(coeffs[1]-coeffs[2])*(1.-y/(coeffs[1]-coeffs[2]))<<endl;
220
221
//EvtGenReport(EVTGEN_INFO,"EvtGen")<<" "<<pF*coeffs[3]/((coeffs[1]-coeffs[2])*(1.-y/(coeffs[1]-coeffs[2])))<<endl;
222
// EvtGenReport(EVTGEN_INFO,"EvtGen")<<" "<<((coeffs[1]-coeffs[2])/pF)*(1. -y/(coeffs[1]-coeffs[2]))<<endl;
223
224
//EvtGenReport(EVTGEN_INFO,"EvtGen")<<"result "<<(coeffs[1]-coeffs[2])*(1./(sqrt(EvtConst::pi)*pF))*exp(-(1./4.)*pow(pF*(coeffs[3]/((coeffs[1]-coeffs[2])*(1.-y/(coeffs[1]-coeffs[2])))) - ((coeffs[1]-coeffs[2])/pF)*(1. -y/(coeffs[1]-coeffs[2])),2.))/coeffs[5];
225
226
//EvtGenReport(EVTGEN_INFO,"EvtGen")<<"leaving"<<endl;
227
return
( coeffs[1] - coeffs[2] ) * ( 1. / ( sqrt(
EvtConst::pi
) * pF ) ) *
228
exp
( -( 1. / 4. ) *
229
pow( pF * ( coeffs[3] /
230
( ( coeffs[1] - coeffs[2] ) *
231
( 1. - y / ( coeffs[1] - coeffs[2] ) ) ) ) -
232
( ( coeffs[1] - coeffs[2] ) / pF ) *
233
( 1. - y / ( coeffs[1] - coeffs[2] ) ),
234
2. ) ) /
235
coeffs[5];
236
}
EvtBtoXsgammaFermiUtil.hh
EvtBtoXsgammaRootFinder.hh
exp
EvtComplex exp(const EvtComplex &c)
Definition
EvtComplex.hh:242
EvtConst.hh
EvtItgFunction.hh
EvtItgTwoCoeffFcn.hh
EvtReport.hh
EvtGenReport
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition
EvtReport.cpp:32
EVTGEN_INFO
@ EVTGEN_INFO
Definition
EvtReport.hh:52
EvtBtoXsgammaFermiUtil::FermiGaussFunc
static double FermiGaussFunc(double, std::vector< double > const &coeffs)
Definition
EvtBtoXsgammaFermiUtil.cpp:44
EvtBtoXsgammaFermiUtil::FermiGaussRootFcnB
static double FermiGaussRootFcnB(double, const std::vector< double > &coeffs1, const std::vector< double > &coeffs2)
Definition
EvtBtoXsgammaFermiUtil.cpp:82
EvtBtoXsgammaFermiUtil::BesselK1
static double BesselK1(double)
Definition
EvtBtoXsgammaFermiUtil.cpp:114
EvtBtoXsgammaFermiUtil::BesselI1
static double BesselI1(double)
Definition
EvtBtoXsgammaFermiUtil.cpp:148
EvtBtoXsgammaFermiUtil::FermiRomanRootFcnA
static double FermiRomanRootFcnA(double)
Definition
EvtBtoXsgammaFermiUtil.cpp:199
EvtBtoXsgammaFermiUtil::FermiGaussRootFcnA
static double FermiGaussRootFcnA(double, const std::vector< double > &coeffs1, const std::vector< double > &coeffs2)
Definition
EvtBtoXsgammaFermiUtil.cpp:70
EvtBtoXsgammaFermiUtil::FermiRomanFunc
static double FermiRomanFunc(double, std::vector< double > const &coeffs)
Definition
EvtBtoXsgammaFermiUtil.cpp:204
EvtBtoXsgammaFermiUtil::FermiRomanFuncRoot
static double FermiRomanFuncRoot(double, double)
Definition
EvtBtoXsgammaFermiUtil.cpp:180
EvtBtoXsgammaFermiUtil::FermiGaussFuncRoot
static double FermiGaussFuncRoot(double, double, double, std::vector< double > &coeffs)
Definition
EvtBtoXsgammaFermiUtil.cpp:53
EvtBtoXsgammaFermiUtil::FermiExpFunc
static double FermiExpFunc(double var, const std::vector< double > &coeffs)
Definition
EvtBtoXsgammaFermiUtil.cpp:34
EvtBtoXsgammaFermiUtil::Gamma
static double Gamma(double, const std::vector< double > &coeffs)
Definition
EvtBtoXsgammaFermiUtil.cpp:93
EvtBtoXsgammaRootFinder
Definition
EvtBtoXsgammaRootFinder.hh:38
EvtBtoXsgammaRootFinder::GetGaussIntegFcnRoot
double GetGaussIntegFcnRoot(EvtItgAbsFunction *theFunc1, EvtItgAbsFunction *theFunc2, double integ1Precision, double integ2Precision, int maxLoop1, int maxLoop2, double integLower, double integUpper, double lowerValue, double upperValue, double precision)
Definition
EvtBtoXsgammaRootFinder.cpp:115
EvtBtoXsgammaRootFinder::GetRootSingleFunc
double GetRootSingleFunc(const EvtItgAbsFunction *theFunc, double functionValue, double lowerValue, double upperValue, double precision)
Definition
EvtBtoXsgammaRootFinder.cpp:44
EvtConst::pi
static const double pi
Definition
EvtConst.hh:26
EvtItgFunction
Definition
EvtItgFunction.hh:34
EvtItgTwoCoeffFcn
Definition
EvtItgTwoCoeffFcn.hh:37
Generated by
1.17.0