BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtBtoXsgammaFermiUtil.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3//
4// Copyright Information: See EvtGen/COPYRIGHT
5//
6// Environment:
7// This software is part of the EvtGen package developed jointly
8// for the BaBar and CLEO collaborations. If you use all or part
9// of it, please give an appropriate acknowledgement.
10//
11// Module: EvtBtoXsgammaFermiUtil.cc
12//
13// Description:
14// Class to hold various fermi functions and their helper functions. The
15// fermi functions are used in EvtBtoXsgammaKagan.
16//
17// Modification history:
18//
19// Jane Tinslay March 21, 2001 Module created
20//------------------------------------------------------------------------
22
23//-----------------------
24// This Class's Header --
25//-----------------------
30#include "EvtItgFunction.hh"
31#include "EvtItgTwoCoeffFcn.hh"
32
33//---------------
34// C++ Headers --
35//---------------
36#include <iostream>
37#include <math.h>
38using std::endl;
39
40double EvtBtoXsgammaFermiUtil::FermiExpFunc( double y, const std::vector<double>& coeffs ) {
41
42 // coeffs: 1 = lambdabar, 2 = a, 3 = lam1, 4 = norm
43 // report(INFO,"EvtGen")<<coeffs[4]<<endl;
44 return ( pow( 1. - ( y / coeffs[1] ), coeffs[2] ) *
45 exp( ( -3. * pow( coeffs[1], 2. ) / coeffs[3] ) * y / coeffs[1] ) ) /
46 coeffs[4];
47}
48
49double EvtBtoXsgammaFermiUtil::FermiGaussFunc( double y, const std::vector<double>& coeffs ) {
50
51 // coeffs: 1 = lambdabar, 2 = a, 3 = c, 4 = norm
52 return ( pow( 1. - ( y / coeffs[1] ), coeffs[2] ) *
53 exp( -pow( coeffs[3], 2. ) * pow( 1. - ( y / coeffs[1] ), 2. ) ) ) /
54 coeffs[4];
55}
56
57double EvtBtoXsgammaFermiUtil::FermiGaussFuncRoot( double lambdabar, double lam1, double mb,
58 std::vector<double>& gammaCoeffs ) {
59
60 std::vector<double> coeffs1( 3 );
61 std::vector<double> coeffs2( 3 );
62
63 coeffs1[0] = 0.2;
64 coeffs1[1] = lambdabar;
65 coeffs1[2] = 0.0;
66
67 coeffs2[0] = 0.2;
68 coeffs2[1] = lambdabar;
69 coeffs2[2] = -lam1 / 3.;
70
71 EvtItgTwoCoeffFcn* lhFunc =
72 new EvtItgTwoCoeffFcn( &FermiGaussRootFcnA, -mb, lambdabar, coeffs1, gammaCoeffs );
73 EvtItgTwoCoeffFcn* rhFunc =
74 new EvtItgTwoCoeffFcn( &FermiGaussRootFcnB, -mb, lambdabar, coeffs2, gammaCoeffs );
75
77
78 double root = rootFinder->GetGaussIntegFcnRoot( lhFunc, rhFunc, 1.0e-4, 1.0e-4, 40, 40, -mb,
79 lambdabar, 0.2, 0.4, 1.0e-6 );
80
81 delete rootFinder;
82 rootFinder = 0;
83 delete lhFunc;
84 lhFunc = 0;
85 delete rhFunc;
86 rhFunc = 0;
87 return root;
88}
89
91 const std::vector<double>& coeffs1,
92 const std::vector<double>& coeffs2 ) {
93
94 // coeffs1: 0=ap, 1=lambdabar, coeffs2=gamma function coeffs
95 double cp = Gamma( ( 2.0 + coeffs1[0] ) / 2., coeffs2 ) /
96 Gamma( ( 1.0 + coeffs1[0] ) / 2., coeffs2 );
97
98 return ( y * y ) * pow( ( 1. - ( y / coeffs1[1] ) ), coeffs1[0] ) *
99 exp( -pow( cp, 2 ) * pow( ( 1. - ( y / coeffs1[1] ) ), 2. ) );
100}
101
103 const std::vector<double>& coeffs1,
104 const std::vector<double>& coeffs2 ) {
105
106 // coeffs1: 0=ap, 1=lambdabar, coeffs2=gamma function coeffs
107 double cp = Gamma( ( 2.0 + coeffs1[0] ) / 2., coeffs2 ) /
108 Gamma( ( 1.0 + coeffs1[0] ) / 2., coeffs2 );
109 return pow( ( 1. - ( y / coeffs1[1] ) ), coeffs1[0] ) *
110 exp( -pow( cp, 2 ) * pow( ( 1. - ( y / coeffs1[1] ) ), 2. ) );
111}
112
113double EvtBtoXsgammaFermiUtil::Gamma( double z, const std::vector<double>& coeffs ) {
114
115 // Lifted from Numerical Recipies in C
116 double x, y, tmp, ser;
117
118 int j;
119 y = z;
120 x = z;
121
122 tmp = x + 5.5;
123 tmp = tmp - ( x + 0.5 ) * log( tmp );
124 ser = 1.000000000190015;
125
126 for ( j = 0; j < 6; j++ )
127 {
128 y = y + 1.0;
129 ser = ser + coeffs[j] / y;
130 }
131
132 return exp( -tmp + log( 2.5066282746310005 * ser / x ) );
133}
134
136
137 // Lifted from Numerical Recipies in C : Returns the modified Bessel
138 // function K_1(x) for positive real x
139 if ( x < 0.0 ) report( INFO, "EvtGen" ) << "x is negative !" << endl;
140
141 double y, ans;
142
143 if ( x <= 2.0 )
144 {
145 y = x * x / 4.0;
146 ans = ( log( x / 2.0 ) * BesselI1( x ) ) +
147 ( 1.0 / x ) *
148 ( 1.0 +
149 y * ( 0.15443144 +
150 y * ( -0.67278579 +
151 y * ( -0.18156897 +
152 y * ( -0.1919402e-1 +
153 y * ( -0.110404e-2 + y * ( -0.4686e-4 ) ) ) ) ) ) );
154 }
155 else
156 {
157 y = 2.0 / x;
158 ans = ( exp( -x ) / sqrt( x ) ) *
159 ( 1.25331414 +
160 y * ( 0.23498619 +
161 y * ( -0.3655620e-1 +
162 y * ( 0.1504268e-1 +
163 y * ( -0.780353e-2 +
164 y * ( 0.325614e-2 + y * ( -0.68245e-3 ) ) ) ) ) ) );
165 }
166 return ans;
167}
168
170 // Lifted from Numerical Recipies in C : Returns the modified Bessel
171 // function I_1(x) for any real x
172
173 double ax, ans;
174 double y;
175
176 if ( ( ax = fabs( x ) ) < 3.75 )
177 {
178 y = x / 3.75;
179 y *= y;
180 ans = ax * ( 0.5 + y * ( 0.87890594 +
181 y * ( 0.51498869 +
182 y * ( 0.15084934 +
183 y * ( 0.2658733e-1 +
184 y * ( 0.301532e-2 + y * 0.32411e-3 ) ) ) ) ) );
185 }
186 else
187 {
188 y = 3.75 / ax;
189 ans = 0.2282967e-1 + y * ( -0.2895312e-1 + y * ( 0.1787654e-1 - y * 0.420059e-2 ) );
190 ans = 0.398914228 +
191 y * ( -0.3988024e-1 +
192 y * ( -0.362018e-2 + y * ( 0.163801e-2 + y * ( -0.1031555e-1 + y * ans ) ) ) );
193 ans *= ( exp( ax ) / sqrt( ax ) );
194 }
195 return x < 0.0 ? -ans : ans;
196}
197
198double EvtBtoXsgammaFermiUtil::FermiRomanFuncRoot( double lambdabar, double lam1 ) {
199
200 EvtItgFunction* lhFunc = new EvtItgFunction( &FermiRomanRootFcnA, -1.e-6, 1.e6 );
201
203 double rhSide = 1.0 - ( lam1 / ( 3.0 * lambdabar * lambdabar ) );
204
205 double rho = rootFinder->GetRootSingleFunc( lhFunc, rhSide, 0.1, 0.4, 1.0e-6 );
206 // rho=0.250353;
207 report( INFO, "EvtGen" ) << "rho/2 " << rho / 2. << " bessel " << BesselK1( rho / 2. )
208 << endl;
209 double pF =
210 lambdabar * sqrt( EvtConst::pi ) / ( rho * exp( rho / 2. ) * BesselK1( rho / 2. ) );
211 report( INFO, "EvtGen" ) << "rho " << rho << " pf " << pF << endl;
212
213 delete lhFunc;
214 lhFunc = 0;
215 delete rootFinder;
216 rootFinder = 0;
217 return rho;
218}
219
221
222 return EvtConst::pi * ( 2. + y ) * pow( y, -2. ) * exp( -y ) *
223 pow( BesselK1( y / 2. ), -2. );
224}
225double EvtBtoXsgammaFermiUtil::FermiRomanFunc( double y, const std::vector<double>& coeffs ) {
226 if ( y == ( coeffs[1] - coeffs[2] ) ) y = 0.99999999 * ( coeffs[1] - coeffs[2] );
227
228 // coeffs: 1 = mB, 2=mb, 3=rho, 4=lambdabar, 5=norm
229 double pF = coeffs[4] * sqrt( EvtConst::pi ) /
230 ( coeffs[3] * exp( coeffs[3] / 2. ) * BesselK1( coeffs[3] / 2. ) );
231 // report(INFO,"EvtGen")<<" pf "<<y<<" "<<pF<<" "<<coeffs[1]<<" "<<coeffs[2]<<"
232 // "<<coeffs[3]<<" "<<coeffs[4]<<" "<<coeffs[5]<<endl;
233 // double pF=0.382533;
234
235 // report(INFO,"EvtGen")<<(coeffs[1]-coeffs[2])*(1./(sqrt(EvtConst::pi)*pF))<<endl;
236 // report(INFO,"EvtGen")<<(1.-y/(coeffs[1]-coeffs[2]))<<endl;
237 // report(INFO,"EvtGen")<<(coeffs[1]-coeffs[2])<<endl;
238 // report(INFO,"EvtGen")<<(coeffs[1]-coeffs[2])*(1.-y/(coeffs[1]-coeffs[2]))<<endl;
239
240 // report(INFO,"EvtGen")<<"
241 // "<<pF*coeffs[3]/((coeffs[1]-coeffs[2])*(1.-y/(coeffs[1]-coeffs[2])))<<endl;
242 // report(INFO,"EvtGen")<<" "<<((coeffs[1]-coeffs[2])/pF)*(1.
243 // -y/(coeffs[1]-coeffs[2]))<<endl;
244
245 // report(INFO,"EvtGen")<<"result
246 // "<<(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]))))
247 // - ((coeffs[1]-coeffs[2])/pF)*(1. -y/(coeffs[1]-coeffs[2])),2.))/coeffs[5];
248
249 // report(INFO,"EvtGen")<<"leaving"<<endl;
250 return ( coeffs[1] - coeffs[2] ) * ( 1. / ( sqrt( EvtConst::pi ) * pF ) ) *
251 exp( -( 1. / 4. ) *
252 pow( pF * ( coeffs[3] / ( ( coeffs[1] - coeffs[2] ) *
253 ( 1. - y / ( coeffs[1] - coeffs[2] ) ) ) ) -
254 ( ( coeffs[1] - coeffs[2] ) / pF ) *
255 ( 1. - y / ( coeffs[1] - coeffs[2] ) ),
256 2. ) ) /
257 coeffs[5];
258}
std::string root
EvtComplex exp(const EvtComplex &c)
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ INFO
Definition EvtReport.hh:52
static double FermiGaussFunc(double, std::vector< double > const &coeffs)
static double FermiGaussRootFcnB(double, const std::vector< double > &coeffs1, const std::vector< double > &coeffs2)
static double BesselK1(double)
static double BesselI1(double)
static double FermiRomanRootFcnA(double)
static double FermiGaussRootFcnA(double, const std::vector< double > &coeffs1, const std::vector< double > &coeffs2)
static double FermiRomanFunc(double, std::vector< double > const &coeffs)
static double FermiRomanFuncRoot(double, double)
static double FermiGaussFuncRoot(double, double, double, std::vector< double > &coeffs)
static double FermiExpFunc(double var, const std::vector< double > &coeffs)
static double Gamma(double, const std::vector< double > &coeffs)
double GetGaussIntegFcnRoot(EvtItgAbsFunction *theFunc1, EvtItgAbsFunction *theFunc2, double integ1Precision, double integ2Precision, int maxLoop1, int maxLoop2, double integLower, double integUpper, double lowerValue, double upperValue, double precision)
double GetRootSingleFunc(const EvtItgAbsFunction *theFunc, double functionValue, double lowerValue, double upperValue, double precision)
static const double pi
Definition EvtConst.hh:27