BOSS 7.0.7
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//-----------------------
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])*exp((-3.*pow(coeffs[1],2.)/coeffs[3])*y/coeffs[1]))/coeffs[4];
45
46}
47
48double EvtBtoXsgammaFermiUtil::FermiGaussFunc(double y, const std::vector<double> &coeffs) {
49
50 //coeffs: 1 = lambdabar, 2 = a, 3 = c, 4 = norm
51 return (pow(1. - (y/coeffs[1]),coeffs[2])*exp(-pow(coeffs[3],2.)*pow(1. - (y/coeffs[1]),2.)))/coeffs[4];
52
53}
54
55double EvtBtoXsgammaFermiUtil::FermiGaussFuncRoot(double lambdabar, double lam1, double mb, std::vector<double> &gammaCoeffs) {
56
57 std::vector<double> coeffs1(3);
58 std::vector<double> coeffs2(3);
59
60 coeffs1[0]=0.2;
61 coeffs1[1]=lambdabar;
62 coeffs1[2]=0.0;
63
64 coeffs2[0]=0.2;
65 coeffs2[1]=lambdabar;
66 coeffs2[2]=-lam1/3.;
67
68 EvtItgTwoCoeffFcn *lhFunc = new EvtItgTwoCoeffFcn(&FermiGaussRootFcnA, -mb, lambdabar, coeffs1, gammaCoeffs);
69 EvtItgTwoCoeffFcn *rhFunc = new EvtItgTwoCoeffFcn(&FermiGaussRootFcnB, -mb, lambdabar, coeffs2, gammaCoeffs);
70
72
73 double root = rootFinder->GetGaussIntegFcnRoot(lhFunc, rhFunc, 1.0e-4, 1.0e-4, 40, 40, -mb, lambdabar, 0.2, 0.4, 1.0e-6);
74
75 delete rootFinder; rootFinder=0;
76 delete lhFunc; lhFunc=0;
77 delete rhFunc; rhFunc=0;
78 return root;
79
80}
81
82double EvtBtoXsgammaFermiUtil::FermiGaussRootFcnA(double y, const std::vector<double> &coeffs1, const std::vector<double> &coeffs2) {
83
84
85 //coeffs1: 0=ap, 1=lambdabar, coeffs2=gamma function coeffs
86 double cp = Gamma((2.0 + coeffs1[0])/2., coeffs2)/Gamma((1.0 + coeffs1[0])/2., coeffs2);
87
88 return (y*y)*pow((1. - (y/coeffs1[1])),coeffs1[0])*exp(-pow(cp,2)*pow((1.-(y/coeffs1[1])),2.));
89
90}
91
92double EvtBtoXsgammaFermiUtil::FermiGaussRootFcnB(double y, const std::vector<double> &coeffs1, 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)/Gamma((1.0 + coeffs1[0])/2., coeffs2);
96 return pow((1. - (y/coeffs1[1])),coeffs1[0])*exp(-pow(cp,2)*pow((1.-(y/coeffs1[1])),2.));
97
98}
99
100double EvtBtoXsgammaFermiUtil::Gamma(double z, const std::vector<double> &coeffs) {
101
102 //Lifted from Numerical Recipies in C
103 double x, y, tmp, ser;
104
105 int j;
106 y = z;
107 x = z;
108
109 tmp = x + 5.5;
110 tmp = tmp - (x+0.5)*log(tmp);
111 ser=1.000000000190015;
112
113 for (j=0;j<6;j++) {
114 y = y +1.0;
115 ser = ser + coeffs[j]/y;
116 }
117
118 return exp(-tmp+log(2.5066282746310005*ser/x));
119
120}
121
123
124 //Lifted from Numerical Recipies in C : Returns the modified Bessel
125 //function K_1(x) for positive real x
126 if (x<0.0) report(INFO,"EvtGen") <<"x is negative !"<<endl;
127
128 double y, ans;
129
130 if (x <= 2.0) {
131 y=x*x/4.0;
132 ans = (log(x/2.0)*BesselI1(x))+(1.0/x)*(1.0+y*(0.15443144+y*(-0.67278579+y*(-0.18156897+y*(-0.1919402e-1+y*(-0.110404e-2+y*(-0.4686e-4)))))));
133 }
134 else {
135 y=2.0/x;
136 ans=(exp(-x)/sqrt(x))*(1.25331414+y*(0.23498619+y*(-0.3655620e-1+y*(0.1504268e-1+y*(-0.780353e-2+y*(0.325614e-2+y*(-0.68245e-3)))))));
137 }
138 return ans;
139
140}
141
143 //Lifted from Numerical Recipies in C : Returns the modified Bessel
144 //function I_1(x) for any real x
145
146 double ax, ans;
147 double y;
148
149 if ((ax=fabs(x)) < 3.75) {
150 y=x/3.75;
151 y*=y;
152 ans=ax*(0.5+y*(0.87890594+y*(0.51498869+y*(0.15084934+y*(0.2658733e-1+y*(0.301532e-2+y*0.32411e-3))))));
153 }
154 else {
155 y=3.75/ax;
156 ans=0.2282967e-1+y*(-0.2895312e-1+y*(0.1787654e-1 -y*0.420059e-2));
157 ans=0.398914228+y*(-0.3988024e-1+y*(-0.362018e-2+y*(0.163801e-2+y*(-0.1031555e-1+y*ans))));
158 ans*=(exp(ax)/sqrt(ax));
159 }
160 return x < 0.0 ? -ans:ans;
161}
162
163double EvtBtoXsgammaFermiUtil::FermiRomanFuncRoot(double lambdabar, double lam1) {
164
165 EvtItgFunction *lhFunc = new EvtItgFunction(&FermiRomanRootFcnA, -1.e-6, 1.e6);
166
168 double rhSide = 1.0 - (lam1/(3.0*lambdabar*lambdabar));
169
170 double rho = rootFinder->GetRootSingleFunc(lhFunc, rhSide, 0.1, 0.4, 1.0e-6);
171 //rho=0.250353;
172 report(INFO,"EvtGen")<<"rho/2 "<<rho/2.<<" bessel "<<BesselK1(rho/2.)<<endl;
173 double pF = lambdabar*sqrt(EvtConst::pi)/(rho*exp(rho/2.)*BesselK1(rho/2.));
174 report(INFO,"EvtGen")<<"rho "<<rho<<" pf "<<pF<<endl;
175
176 delete lhFunc; lhFunc=0;
177 delete rootFinder; rootFinder=0;
178 return rho;
179
180}
181
183
184 return EvtConst::pi*(2. + y)*pow(y,-2.)*exp(-y)*pow(BesselK1(y/2.),-2.);
185
186}
187double EvtBtoXsgammaFermiUtil::FermiRomanFunc(double y, const std::vector<double> &coeffs) {
188 if (y == (coeffs[1]-coeffs[2])) y=0.99999999*(coeffs[1]-coeffs[2]);
189
190 //coeffs: 1 = mB, 2=mb, 3=rho, 4=lambdabar, 5=norm
191 double pF = coeffs[4]*sqrt(EvtConst::pi)/(coeffs[3]*exp(coeffs[3]/2.)*BesselK1(coeffs[3]/2.));
192 // report(INFO,"EvtGen")<<" pf "<<y<<" "<<pF<<" "<<coeffs[1]<<" "<<coeffs[2]<<" "<<coeffs[3]<<" "<<coeffs[4]<<" "<<coeffs[5]<<endl;
193 //double pF=0.382533;
194
195 //report(INFO,"EvtGen")<<(coeffs[1]-coeffs[2])*(1./(sqrt(EvtConst::pi)*pF))<<endl;
196 //report(INFO,"EvtGen")<<(1.-y/(coeffs[1]-coeffs[2]))<<endl;
197 //report(INFO,"EvtGen")<<(coeffs[1]-coeffs[2])<<endl;
198 //report(INFO,"EvtGen")<<(coeffs[1]-coeffs[2])*(1.-y/(coeffs[1]-coeffs[2]))<<endl;
199
200 //report(INFO,"EvtGen")<<" "<<pF*coeffs[3]/((coeffs[1]-coeffs[2])*(1.-y/(coeffs[1]-coeffs[2])))<<endl;
201 // report(INFO,"EvtGen")<<" "<<((coeffs[1]-coeffs[2])/pF)*(1. -y/(coeffs[1]-coeffs[2]))<<endl;
202
203 //report(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];
204
205 //report(INFO,"EvtGen")<<"leaving"<<endl;
206 return (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];
207
208
209}
std::string root
Definition: CalibModel.cxx:39
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:252
ostream & report(Severity severity, const char *facility)
Definition: EvtReport.cc:36
@ 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:28
double y[1000]
double x[1000]