]>
Commit | Line | Data |
---|---|---|
da0e9ce3 | 1 | |
2 | ////////////////////////////////////////////////////////////////////// | |
3 | // | |
4 | // Module: EvtVubBLNP.cc | |
5 | // | |
6 | // Description: Modeled on Riccardo Faccini's EvtVubNLO module | |
7 | // | |
8 | // tripleDiff from BLNP's notebook (based on BLNP4, hep-ph/0504071) | |
9 | // | |
10 | ////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "EvtGenBase/EvtPatches.hh" | |
13 | #include <stdlib.h> | |
14 | #include "EvtGenBase/EvtParticle.hh" | |
15 | #include "EvtGenBase/EvtGenKine.hh" | |
16 | #include "EvtGenBase/EvtPDL.hh" | |
17 | #include "EvtGenBase/EvtReport.hh" | |
18 | #include "EvtGenModels/EvtVubBLNP.hh" | |
19 | #include <string> | |
20 | #include "EvtGenBase/EvtVector4R.hh" | |
21 | #include "EvtGenModels/EvtItgSimpsonIntegrator.hh" | |
22 | #include "EvtGenModels/EvtItgPtrFunction.hh" | |
23 | #include "EvtGenBase/EvtRandom.hh" | |
24 | #include "EvtGenModels/EvtPFermi.hh" | |
25 | ||
26 | // For incomplete gamma function | |
27 | #include "math.h" | |
28 | #include "signal.h" | |
29 | #define ITMAX 100 | |
30 | #define EPS 3.0e-7 | |
31 | #define FPMIN 1.0e-30 | |
32 | ||
33 | using std::cout; | |
34 | using std::endl; | |
35 | ||
36 | EvtVubBLNP::~EvtVubBLNP() { | |
37 | } | |
38 | ||
39 | std::string EvtVubBLNP::getName(){ | |
40 | return "VUB_BLNP"; | |
41 | } | |
42 | ||
43 | EvtDecayBase *EvtVubBLNP::clone() { | |
44 | ||
45 | return new EvtVubBLNP; | |
46 | ||
47 | } | |
48 | ||
49 | void EvtVubBLNP::init() { | |
50 | ||
51 | // get parameters (declared in the header file) | |
52 | ||
53 | // Input parameters | |
54 | mBB = 5.2792; | |
55 | lambda2 = 0.12; | |
56 | ||
57 | // Shape function parameters | |
58 | b = getArg(0); | |
59 | Lambda = getArg(1); | |
60 | Ecut = 1.8; | |
61 | wzero = mBB - 2*Ecut; | |
62 | ||
63 | // SF and SSF modes | |
64 | itype = (int)getArg(5); | |
65 | dtype = getArg(5); | |
66 | isubl = (int)getArg(6); | |
67 | ||
68 | // flags | |
69 | flag1 = (int)getArg(7); | |
70 | flag2 = (int)getArg(8); | |
71 | flag3 = (int)getArg(9); | |
72 | ||
73 | // Quark mass | |
74 | mb = 4.61; | |
75 | ||
76 | ||
77 | // hidden parameter what and SF stuff | |
78 | const double xlow = 0; | |
79 | const double xhigh = mBB; | |
80 | const int aSize = 10000; | |
81 | EvtPFermi pFermi(Lambda,b); | |
82 | // pf is the cumulative distribution normalized to 1. | |
83 | _pf.resize(aSize); | |
84 | for(int i=0;i<aSize;i++){ | |
85 | double what = xlow + (double)(i+0.5)/((double)aSize)*(xhigh-xlow); | |
86 | if ( i== 0 ) | |
87 | _pf[i] = pFermi.getSFBLNP(what); | |
88 | else | |
89 | _pf[i] = _pf[i-1] + pFermi.getSFBLNP(what); | |
90 | } | |
91 | for (size_t i=0; i<_pf.size(); i++) { | |
92 | _pf[i]/=_pf[_pf.size()-1]; | |
93 | } | |
94 | ||
95 | ||
96 | ||
97 | // Matching scales | |
98 | muh = mBB*getArg(2); // 0.5 | |
99 | mui = getArg(3); // 1.5 | |
100 | mubar = getArg(4); // 1.5 | |
101 | ||
102 | // Perturbative quantities | |
103 | CF = 4.0/3.0; | |
104 | CA = 3.0; | |
105 | double nf = 4.0; | |
106 | ||
107 | beta0 = 11.0/3.0*CA - 2.0/3.0*nf; | |
108 | beta1 = 34.0/3.0*CA*CA - 10.0/3.0*CA*nf - 2.0*CF*nf; | |
109 | beta2 = 2857.0/54.0*CA*CA*CA + (CF*CF - 205.0/18.0*CF*CA - 1415.0/54.0*CA*CA)*nf + (11.0/9.0*CF + 79.0/54.0*CA)*nf*nf; | |
110 | ||
111 | zeta3 = 1.0 + 1/8.0 + 1/27.0 + 1/64.0; | |
112 | ||
113 | Gamma0 = 4*CF; | |
114 | Gamma1 = CF*( (268.0/9.0 - 4.0*M_PI*M_PI/3.0)*CA - 40.0/9.0*nf); | |
115 | Gamma2 = 16*CF*( (245.0/24.0 - 67.0/54.0*M_PI*M_PI + + 11.0/180.0*pow(M_PI,4) + 11.0/6.0*zeta3)*CA*CA* + (-209.0/108.0 + 5.0/27.0*M_PI*M_PI - 7.0/3.0*zeta3)*CA*nf + (-55.0/24.0 + 2*zeta3)*CF*nf - nf*nf/27.0); | |
116 | ||
117 | gp0 = -5.0*CF; | |
118 | gp1 = -8.0*CF*( (3.0/16.0 - M_PI*M_PI/4.0 + 3*zeta3)*CF + (1549.0/432.0 + 7.0/48.0*M_PI*M_PI - 11.0/4.0*zeta3)*CA - (125.0/216.0 + M_PI*M_PI/24.0)*nf ); | |
119 | ||
120 | // Lbar and mupisq | |
121 | ||
122 | Lbar = Lambda; // all models | |
123 | mupisq = 3*Lambda*Lambda/b; | |
124 | if (itype == 1) mupisq = 3*Lambda*Lambda/b; | |
125 | if (itype == 2) mupisq = 3*Lambda*Lambda*(Gamma(1+0.5*b)*Gamma(0.5*b)/pow( Gamma(0.5 + 0.5*b), 2) - 1); | |
126 | ||
127 | // moment2 for SSFs | |
128 | moment2 = pow(0.3,3); | |
129 | ||
130 | // inputs for total rate (T for Total); use BLNP notebook defaults | |
131 | flagpower = 1; | |
132 | flag2loop = 1; | |
133 | ||
134 | // stuff for the integrator | |
135 | maxLoop = 20; | |
136 | //precision = 1.0e-3; | |
137 | precision = 2.0e-2; | |
138 | ||
139 | // vector of global variables, to pass to static functions (which can't access globals); | |
140 | gvars.push_back(0.0); // 0 | |
141 | gvars.push_back(0.0); // 1 | |
142 | gvars.push_back(mui); // 2 | |
143 | gvars.push_back(b); // 3 | |
144 | gvars.push_back(Lambda); // 4 | |
145 | gvars.push_back(mBB); // 5 | |
146 | gvars.push_back(mb); // 6 | |
147 | gvars.push_back(wzero); // 7 | |
148 | gvars.push_back(beta0); // 8 | |
149 | gvars.push_back(beta1); // 9 | |
150 | gvars.push_back(beta2); // 10 | |
151 | gvars.push_back(dtype); // 11 | |
152 | ||
153 | // check that there are 3 daughters and 10 arguments | |
154 | checkNDaug(3); | |
155 | checkNArg(10); | |
156 | ||
157 | } | |
158 | ||
159 | void EvtVubBLNP::initProbMax() { | |
160 | noProbMax(); | |
161 | } | |
162 | ||
163 | void EvtVubBLNP::decay(EvtParticle *Bmeson) { | |
164 | ||
165 | int j; | |
166 | ||
167 | EvtParticle *xuhad, *lepton, *neutrino; | |
168 | EvtVector4R p4; | |
0ca57c2f | 169 | double Pp, Pm, Pl, pdf, EX, sh, El, ml, mpi, ratemax; |
da0e9ce3 | 170 | |
171 | double xhigh, xlow, what; | |
172 | ||
173 | Bmeson->initializePhaseSpace(getNDaug(), getDaugs()); | |
174 | ||
175 | xuhad = Bmeson->getDaug(0); | |
176 | lepton = Bmeson->getDaug(1); | |
177 | neutrino = Bmeson ->getDaug(2); | |
178 | ||
179 | mBB = Bmeson->mass(); | |
180 | ml = lepton->mass(); | |
181 | ||
182 | ||
183 | ||
184 | // get SF value | |
185 | xlow = 0; | |
186 | xhigh = mBB; | |
187 | // the case for alphas = 0 is not considered | |
188 | what = 2*xhigh; | |
189 | while( what > xhigh || what < xlow ) { | |
190 | what = findBLNPWhat(); | |
191 | what = xlow + what*(xhigh-xlow); | |
192 | } | |
193 | ||
194 | ||
195 | ||
196 | bool tryit = true; | |
197 | ||
198 | while (tryit) { | |
199 | ||
200 | // generate pp between 0 and | |
201 | // Flat(min, max) gives R(max - min) + min, where R = random btwn 0 and 1 | |
202 | ||
203 | Pp = EvtRandom::Flat(0, mBB); // P+ = EX - |PX| | |
204 | Pl = EvtRandom::Flat(0, mBB); // mBB - 2El | |
205 | Pm = EvtRandom::Flat(0, mBB); // P- = EX + |PX| | |
206 | ||
207 | sh = Pm*Pp; | |
208 | EX = 0.5*(Pm + Pp); | |
da0e9ce3 | 209 | El = 0.5*(mBB - Pl); |
210 | ||
211 | // Need maximum rate. Waiting for Mr. Paz to give it to me. | |
212 | // Meanwhile, use this. | |
213 | ratemax = 3.0; // From trial and error - most events below 3.0 | |
214 | ||
215 | // kinematic bounds (Eq. 2) | |
216 | mpi = 0.14; | |
217 | if ((Pp > 0)&&(Pp <= Pl)&&(Pl <= Pm)&&(Pm < mBB)&&(El > ml)&&(sh > 4*mpi*mpi)) { | |
218 | ||
219 | // Probability of pass proportional to PDF | |
220 | pdf = rate3(Pp, Pl, Pm); | |
221 | double testRan = EvtRandom::Flat(0., ratemax); | |
222 | if (pdf >= testRan) tryit = false; | |
223 | } | |
224 | } | |
225 | // o.k. we have the three kineamtic variables | |
226 | // now calculate a flat cos Theta_H [-1,1] distribution of the | |
227 | // hadron flight direction w.r.t the B flight direction | |
228 | // because the B is a scalar and should decay isotropic. | |
229 | // Then chose a flat Phi_H [0,2Pi] w.r.t the B flight direction | |
230 | // and and a flat Phi_L [0,2Pi] in the W restframe w.r.t the | |
231 | // W flight direction. | |
232 | ||
233 | double ctH = EvtRandom::Flat(-1,1); | |
234 | double phH = EvtRandom::Flat(0,2*M_PI); | |
235 | double phL = EvtRandom::Flat(0,2*M_PI); | |
236 | ||
237 | // now compute the four vectors in the B Meson restframe | |
238 | ||
239 | double ptmp,sttmp; | |
240 | // calculate the hadron 4 vector in the B Meson restframe | |
241 | ||
242 | sttmp = sqrt(1-ctH*ctH); | |
243 | ptmp = sqrt(EX*EX-sh); | |
244 | double pHB[4] = {EX,ptmp*sttmp*cos(phH),ptmp*sttmp*sin(phH),ptmp*ctH}; | |
245 | p4.set(pHB[0],pHB[1],pHB[2],pHB[3]); | |
246 | xuhad->init( getDaug(0), p4); | |
247 | ||
248 | ||
249 | bool _storeWhat(true); | |
250 | ||
251 | if (_storeWhat ) { | |
252 | // cludge to store the hidden parameter what with the decay; | |
253 | // the lifetime of the Xu is abused for this purpose. | |
254 | // tau = 1 ps corresponds to ctau = 0.3 mm -> in order to | |
255 | // stay well below BaBars sensitivity we take what/(10000 GeV). | |
256 | // To extract what back from the StdHepTrk its necessary to get | |
257 | // delta_ctau = Xu->decayVtx()->point().distanceTo(XuDaughter->decayVtx()->point()); | |
258 | // | |
259 | // what = delta_ctau * 100000 * Mass_Xu/Momentum_Xu | |
260 | // | |
261 | xuhad->setLifetime(what/10000.); | |
262 | } | |
263 | ||
264 | ||
265 | // calculate the W 4 vector in the B Meson restrframe | |
266 | ||
267 | double apWB = ptmp; | |
268 | double pWB[4] = {mBB-EX,-pHB[1],-pHB[2],-pHB[3]}; | |
269 | ||
270 | // first go in the W restframe and calculate the lepton and | |
271 | // the neutrino in the W frame | |
272 | ||
273 | double mW2 = mBB*mBB + sh - 2*mBB*EX; | |
274 | double beta = ptmp/pWB[0]; | |
275 | double gamma = pWB[0]/sqrt(mW2); | |
276 | ||
277 | double pLW[4]; | |
278 | ||
279 | ptmp = (mW2-ml*ml)/2/sqrt(mW2); | |
280 | pLW[0] = sqrt(ml*ml + ptmp*ptmp); | |
281 | ||
282 | double ctL = (El - gamma*pLW[0])/beta/gamma/ptmp; | |
283 | if ( ctL < -1 ) ctL = -1; | |
284 | if ( ctL > 1 ) ctL = 1; | |
285 | sttmp = sqrt(1-ctL*ctL); | |
286 | ||
287 | // eX' = eZ x eW | |
288 | double xW[3] = {-pWB[2],pWB[1],0}; | |
289 | // eZ' = eW | |
290 | double zW[3] = {pWB[1]/apWB,pWB[2]/apWB,pWB[3]/apWB}; | |
291 | ||
292 | double lx = sqrt(xW[0]*xW[0]+xW[1]*xW[1]); | |
293 | for (j=0;j<2;j++) | |
294 | xW[j] /= lx; | |
295 | ||
296 | // eY' = eZ' x eX' | |
297 | double yW[3] = {-pWB[1]*pWB[3],-pWB[2]*pWB[3],pWB[1]*pWB[1]+pWB[2]*pWB[2]}; | |
298 | double ly = sqrt(yW[0]*yW[0]+yW[1]*yW[1]+yW[2]*yW[2]); | |
299 | for (j=0;j<3;j++) | |
300 | yW[j] /= ly; | |
301 | ||
302 | // p_lep = |p_lep| * ( sin(Theta) * cos(Phi) * eX' | |
303 | // + sin(Theta) * sin(Phi) * eY' | |
304 | // + cos(Theta) * eZ') | |
305 | for (j=0;j<3;j++) | |
306 | pLW[j+1] = sttmp*cos(phL)*ptmp*xW[j] | |
307 | + sttmp*sin(phL)*ptmp*yW[j] | |
308 | + ctL *ptmp*zW[j]; | |
309 | ||
310 | double apLW = ptmp; | |
311 | ||
312 | // boost them back in the B Meson restframe | |
313 | ||
314 | double appLB = beta*gamma*pLW[0] + gamma*ctL*apLW; | |
315 | ||
316 | ptmp = sqrt(El*El-ml*ml); | |
317 | double ctLL = appLB/ptmp; | |
318 | ||
319 | if ( ctLL > 1 ) ctLL = 1; | |
320 | if ( ctLL < -1 ) ctLL = -1; | |
321 | ||
322 | double pLB[4] = {El,0,0,0}; | |
323 | double pNB[4] = {pWB[0]-El,0,0,0}; | |
324 | ||
325 | for (j=1;j<4;j++) { | |
326 | pLB[j] = pLW[j] + (ctLL*ptmp - ctL*apLW)/apWB*pWB[j]; | |
327 | pNB[j] = pWB[j] - pLB[j]; | |
328 | } | |
329 | ||
330 | p4.set(pLB[0],pLB[1],pLB[2],pLB[3]); | |
331 | lepton->init( getDaug(1), p4); | |
332 | ||
333 | p4.set(pNB[0],pNB[1],pNB[2],pNB[3]); | |
334 | neutrino->init( getDaug(2), p4); | |
335 | ||
336 | return ; | |
337 | ||
338 | } | |
339 | ||
340 | double EvtVubBLNP::rate3(double Pp, double Pl, double Pm) { | |
341 | ||
342 | // rate3 in units of GF^2*Vub^2/pi^3 | |
343 | ||
344 | double factor = 1.0/16*(mBB-Pp)*U1lo(muh, mui)*pow( (Pm - Pp)/(mBB - Pp), alo(muh, mui)); | |
345 | ||
346 | double doneJS = DoneJS(Pp, Pm, mui); | |
347 | double done1 = Done1(Pp, Pm, mui); | |
348 | double done2 = Done2(Pp, Pm, mui); | |
349 | double done3 = Done3(Pp, Pm, mui); | |
350 | ||
351 | // The EvtSimpsonIntegrator returns zero for bad integrals. | |
352 | // So if any of the integrals are zero (ie bad), return zero. | |
353 | // This will cause pdf = 0, so the event will not pass. | |
354 | // I hope this will not introduce a bias. | |
355 | if (doneJS*done1*done2*done3 == 0.0) { | |
356 | //cout << "Integral failed: (Pp, Pm, Pl) = (" << Pp << ", " << Pm << ", " << Pl << ")" << endl; | |
357 | return 0.0; | |
358 | } | |
359 | // if (doneJS*done1*done2*done3 != 0.0) { | |
360 | // cout << "Integral OK: (Pp, Pm, Pl) = (" << Pp << ", " << Pm << ", " << Pl << ")" << endl; | |
361 | //} | |
362 | ||
363 | double f1 = F1(Pp, Pm, muh, mui, mubar, doneJS, done1); | |
364 | double f2 = F2(Pp, Pm, muh, mui, mubar, done3); | |
365 | double f3 = F3(Pp, Pm, muh, mui, mubar, done2); | |
366 | double answer = factor*( (mBB + Pl - Pp - Pm)*(Pm - Pl)*f1 + 2*(Pl - Pp)*(Pm - Pl)*f2 + (mBB - Pm)*(Pm - Pp)*f3 ); | |
367 | return answer; | |
368 | ||
369 | } | |
370 | ||
371 | double EvtVubBLNP::F1(double Pp, double Pm, double muh, double mui, double mubar, double doneJS, double done1) { | |
372 | ||
373 | std::vector<double> vars(12); | |
374 | vars[0] = Pp; | |
375 | vars[1] = Pm; | |
376 | for (int j=2;j<12;j++) {vars[j] = gvars[j];} | |
377 | ||
378 | double y = (Pm - Pp)/(mBB - Pp); | |
379 | double ah = CF*alphas(muh, vars)/4/M_PI; | |
380 | double ai = CF*alphas(mui, vars)/4/M_PI; | |
381 | double abar = CF*alphas(mubar, vars)/4/M_PI; | |
382 | double lambda1 = -mupisq; | |
383 | ||
384 | double t1 = -4*ai/(Pp - Lbar)*(2*log((Pp - Lbar)/mui) + 1); | |
385 | double t2 = 1 + dU1nlo(muh, mui) + anlo(muh, mui)*log(y); | |
386 | double t3 = -4.0*pow(log(y*mb/muh),2) + 10.0*log(y*mb/muh) - 4.0*log(y) - 2.0*log(y)/(1-y) - 4.0*PolyLog(2, 1-y) - M_PI*M_PI/6.0 - 12.0; | |
387 | double t4 = 2*pow( log(y*mb*Pp/(mui*mui)), 2) - 3*log(y*mb*Pp/(mui*mui)) + 7 - M_PI*M_PI; | |
388 | ||
389 | double t5 = -wS(Pp) + 2*t(Pp) + (1.0/y - 1.0)*(u(Pp) - v(Pp)); | |
390 | double t6 = -(lambda1 + 3.0*lambda2)/3.0 + 1.0/pow(y,2)*(4.0/3.0*lambda1 - 2.0*lambda2); | |
391 | ||
392 | double shapePp = Shat(Pp, vars); | |
393 | ||
394 | double answer = (t2 + ah*t3 + ai*t4)*shapePp + ai*doneJS + 1/(mBB - Pp)*(flag2*abar*done1 + flag1*t5) + 1/pow(mBB - Pp, 2)*flag3*shapePp*t6; | |
395 | if (Pp > Lbar + mui/exp(0.5)) answer = answer + t1; | |
396 | return answer; | |
397 | ||
398 | } | |
399 | ||
0ca57c2f | 400 | double EvtVubBLNP::F2(double Pp, double Pm, double muh, double /*mui*/, double mubar, double done3) { |
da0e9ce3 | 401 | |
402 | std::vector<double> vars(12); | |
403 | vars[0] = Pp; | |
404 | vars[1] = Pm; | |
405 | for (int j=2;j<12;j++) {vars[j] = gvars[j];} | |
406 | ||
407 | double y = (Pm - Pp)/(mBB - Pp); | |
408 | double lambda1 = -mupisq; | |
409 | double ah = CF*alphas(muh, vars)/4/M_PI; | |
410 | double abar = CF*alphas(mubar, vars)/4/M_PI; | |
411 | ||
412 | double t6 = -wS(Pp) - 2*t(Pp) + 1.0/y*(t(Pp) + v(Pp)); | |
413 | double t7 = 1/pow(y,2)*(2.0/3.0*lambda1 + 4.0*lambda2) - 1/y*(2.0/3.0*lambda1 + 3.0/2.0*lambda2); | |
414 | ||
415 | double shapePp = Shat(Pp, vars); | |
416 | ||
417 | double answer = ah*log(y)/(1-y)*shapePp + 1/(mBB - Pp)*(flag2*abar*0.5*done3 + flag1/y*t6) + 1.0/pow(mBB - Pp,2)*flag3*shapePp*t7; | |
418 | return answer; | |
419 | ||
420 | } | |
421 | ||
0ca57c2f | 422 | double EvtVubBLNP::F3(double Pp, double Pm, double /*muh*/, double /*mui*/, double mubar, double done2) { |
da0e9ce3 | 423 | |
424 | std::vector<double> vars(12); | |
425 | vars[0] = Pp; | |
426 | vars[1] = Pm; | |
427 | for (int j=2;j<12;j++) {vars[j] = gvars[j];} | |
428 | ||
429 | double y = (Pm - Pp)/(mBB - Pp); | |
430 | double lambda1 = -mupisq; | |
431 | double abar = CF*alphas(mubar, vars)/4/M_PI; | |
432 | ||
433 | double t7 = 1.0/pow(y,2)*(-2.0/3.0*lambda1 + lambda2); | |
434 | ||
435 | double shapePp = Shat(Pp, vars); | |
436 | ||
437 | double answer = 1.0/(Pm - Pp)*flag2*0.5*y*abar*done2 + 1.0/pow(mBB-Pp,2)*flag3*shapePp*t7; | |
438 | return answer; | |
439 | ||
440 | } | |
441 | ||
0ca57c2f | 442 | double EvtVubBLNP::DoneJS(double Pp, double Pm, double /*mui*/) { |
da0e9ce3 | 443 | |
444 | std::vector<double> vars(12); | |
445 | vars[0] = Pp; | |
446 | vars[1] = Pm; | |
447 | for (int j=2;j<12;j++) {vars[j] = gvars[j];} | |
448 | ||
449 | double lowerlim = 0.001*Pp; | |
450 | double upperlim = (1.0-0.001)*Pp; | |
451 | ||
452 | EvtItgPtrFunction *func = new EvtItgPtrFunction(&IntJS, lowerlim, upperlim, vars); | |
453 | EvtItgSimpsonIntegrator *integ = new EvtItgSimpsonIntegrator(*func, precision, maxLoop); | |
454 | double myintegral = integ->evaluate(lowerlim, upperlim); | |
455 | delete integ; | |
456 | delete func; | |
457 | return myintegral; | |
458 | ||
459 | } | |
460 | ||
0ca57c2f | 461 | double EvtVubBLNP::Done1(double Pp, double Pm, double /*mui*/) { |
da0e9ce3 | 462 | |
463 | std::vector<double> vars(12); | |
464 | vars[0] = Pp; | |
465 | vars[1] = Pm; | |
466 | for (int j=2;j<12;j++) {vars[j] = gvars[j];} | |
467 | ||
468 | double lowerlim = 0.001*Pp; | |
469 | double upperlim = (1.0-0.001)*Pp; | |
470 | ||
471 | EvtItgPtrFunction *func = new EvtItgPtrFunction(&Int1, lowerlim, upperlim, vars); | |
472 | EvtItgSimpsonIntegrator *integ = new EvtItgSimpsonIntegrator(*func, precision, maxLoop); | |
473 | double myintegral = integ->evaluate(lowerlim, upperlim); | |
474 | delete integ; | |
475 | delete func; | |
476 | return myintegral; | |
477 | ||
478 | } | |
479 | ||
0ca57c2f | 480 | double EvtVubBLNP::Done2(double Pp, double Pm, double /*mui*/) { |
da0e9ce3 | 481 | |
482 | std::vector<double> vars(12); | |
483 | vars[0] = Pp; | |
484 | vars[1] = Pm; | |
485 | for (int j=2;j<12;j++) {vars[j] = gvars[j];} | |
486 | ||
487 | double lowerlim = 0.001*Pp; | |
488 | double upperlim = (1.0-0.001)*Pp; | |
489 | ||
490 | EvtItgPtrFunction *func = new EvtItgPtrFunction(&Int2, lowerlim, upperlim, vars); | |
491 | EvtItgSimpsonIntegrator *integ = new EvtItgSimpsonIntegrator(*func, precision, maxLoop); | |
492 | double myintegral = integ->evaluate(lowerlim, upperlim); | |
493 | delete integ; | |
494 | delete func; | |
495 | return myintegral; | |
496 | ||
497 | } | |
498 | ||
0ca57c2f | 499 | double EvtVubBLNP::Done3(double Pp, double Pm, double /*mui*/) { |
da0e9ce3 | 500 | |
501 | std::vector<double> vars(12); | |
502 | vars[0] = Pp; | |
503 | vars[1] = Pm; | |
504 | for (int j=2;j<12;j++) {vars[j] = gvars[j];} | |
505 | ||
506 | double lowerlim = 0.001*Pp; | |
507 | double upperlim = (1.0-0.001)*Pp; | |
508 | ||
509 | EvtItgPtrFunction *func = new EvtItgPtrFunction(&Int3, lowerlim, upperlim, vars); | |
510 | EvtItgSimpsonIntegrator *integ = new EvtItgSimpsonIntegrator(*func, precision, maxLoop); | |
511 | double myintegral = integ->evaluate(lowerlim, upperlim); | |
512 | delete integ; | |
513 | delete func; | |
514 | return myintegral; | |
515 | ||
516 | } | |
517 | ||
518 | double EvtVubBLNP::Int1(double what, const std::vector<double> &vars) { | |
519 | return Shat(what, vars)*g1(what, vars); | |
520 | } | |
521 | ||
522 | double EvtVubBLNP::Int2(double what, const std::vector<double> &vars) { | |
523 | return Shat(what, vars)*g2(what, vars); | |
524 | } | |
525 | ||
526 | double EvtVubBLNP::Int3(double what, const std::vector<double> &vars) { | |
527 | return Shat(what, vars)*g3(what, vars); | |
528 | } | |
529 | ||
530 | double EvtVubBLNP::IntJS(double what, const std::vector<double> &vars) { | |
531 | ||
532 | double Pp = vars[0]; | |
533 | double Pm = vars[1]; | |
534 | double mui = vars[2]; | |
535 | double mBB = vars[5]; | |
536 | double mb = vars[6]; | |
537 | double y = (Pm - Pp)/(mBB - Pp); | |
538 | ||
539 | return 1/(Pp-what)*(Shat(what, vars) - Shat(Pp, vars))*(4*log(y*mb*(Pp-what)/(mui*mui)) - 3); | |
540 | } | |
541 | ||
542 | double EvtVubBLNP::g1(double w, const std::vector<double> &vars) { | |
543 | ||
544 | double Pp = vars[0]; | |
545 | double Pm = vars[1]; | |
546 | double mBB = vars[5]; | |
547 | double y = (Pm - Pp)/(mBB - Pp); | |
548 | double x = (Pp - w)/(mBB - Pp); | |
549 | ||
550 | double q1 = (1+x)*(1+x)*y*(x+y); | |
551 | double q2 = y*(-9 + 10*y) + x*x*(-12.0 + 13.0*y) + 2*x*(-8.0 + 6*y + 3*y*y); | |
552 | double q3 = 4/x*log(y + y/x); | |
553 | double q4 = 3.0*pow(x,4)*(-2.0 + y) - 2*pow(y,3) - 4*pow(x,3)*(2.0+y) - 2*x*y*y*(4+y) - x*x*y*(12 + 4*y + y*y); | |
554 | double q5 = log(1 + y/x); | |
555 | ||
556 | double answer = q2/q1 - q3 - 2*q4*q5/(q1*y*x); | |
557 | return answer; | |
558 | ||
559 | } | |
560 | ||
561 | double EvtVubBLNP::g2(double w, const std::vector<double> &vars) { | |
562 | ||
563 | double Pp = vars[0]; | |
564 | double Pm = vars[1]; | |
565 | double mBB = vars[5]; | |
566 | double y = (Pm - Pp)/(mBB - Pp); | |
567 | double x = (Pp - w)/(mBB - Pp); | |
568 | ||
569 | double q1 = (1+x)*(1+x)*pow(y,3)*(x+y); | |
570 | double q2 = 10.0*pow(x,4) + y*y + 3.0*pow(x,2)*y*(10.0+y) + pow(x,3)*(12.0+19.0*y) + x*y*(8.0 + 4.0*y + y*y); | |
571 | double q3 = 5*pow(x,4) + 2.0*y*y + 6.0*pow(x,3)*(1.0+2.0*y) + 4.0*x*y*(1+2.0*y) + x*x*y*(18.0+5.0*y); | |
572 | double q4 = log(1 + y/x); | |
573 | ||
574 | double answer = 2.0/q1*( y*q2 - 2*x*q3*q4); | |
575 | return answer; | |
576 | ||
577 | } | |
578 | ||
579 | double EvtVubBLNP::g3(double w, const std::vector<double> &vars) { | |
580 | ||
581 | double Pp = vars[0]; | |
582 | double Pm = vars[1]; | |
583 | double mBB = vars[5]; | |
584 | double y = (Pm - Pp)/(mBB - Pp); | |
585 | double x = (Pp - w)/(mBB - Pp); | |
586 | ||
587 | double q1 = (1+x)*(1+x)*pow(y,3)*(x+y); | |
588 | double q2 = 2.0*pow(y,3)*(-11.0+2.0*y) - 10.0*pow(x,4)*(6 - 6*y + y*y) + x*y*y*(-94.0 + 29.0*y + 2.0*y*y) + 2.0*x*x*y*(-72.0 +18.0*y + 13.0*y*y) - x*x*x*(72.0 + 42.0*y - 70.0*y*y + 3.0*y*y*y); | |
589 | double q3 = -6.0*x*(-5.0+y)*pow(y,3) + 4*pow(y,4) + 5*pow(x,5)*(6-6*y + y*y) - 4*x*x*y*y*(-20.0 + 6*y + y*y) + pow(x,3)*y*(90.0 - 10.0*y - 28.0*y*y + y*y*y) + pow(x,4)*(36.0 + 36.0*y - 50.0*y*y + 4*y*y*y); | |
590 | double q4 = log(1 + y/x); | |
591 | ||
592 | double answer = q2/q1 + 2/q1/y*q3*q4; | |
593 | return answer; | |
594 | ||
595 | } | |
596 | ||
597 | ||
598 | double EvtVubBLNP::Shat(double w, const std::vector<double> &vars) { | |
599 | ||
600 | double mui = vars[2]; | |
601 | double b = vars[3]; | |
602 | double Lambda = vars[4]; | |
603 | double wzero = vars[7]; | |
604 | int itype = (int)vars[11]; | |
605 | ||
606 | double norm = 0.0; | |
607 | double shape = 0.0; | |
608 | ||
609 | if (itype == 1) { | |
610 | ||
611 | double Lambar = (Lambda/b)*(Gamma(1+b)-Gamma(1+b,b*wzero/Lambda))/(Gamma(b) - Gamma(b, b*wzero/Lambda)); | |
612 | double muf = wzero - Lambar; | |
613 | double mupisq = 3*pow(Lambda,2)/pow(b,2)*(Gamma(2+b) - Gamma(2+b, b*wzero/Lambda))/(Gamma(b) - Gamma(b, b*wzero/Lambda)) - 3*Lambar*Lambar; | |
614 | norm = Mzero(muf, mui, mupisq, vars)*Gamma(b)/(Gamma(b) - Gamma(b, b*wzero/Lambda)); | |
615 | shape = pow(b,b)/Lambda/Gamma(b)*pow(w/Lambda, b-1)*exp(-b*w/Lambda); | |
616 | } | |
617 | ||
618 | if (itype == 2) { | |
619 | double dcoef = pow( Gamma(0.5*(1+b))/Gamma(0.5*b), 2); | |
620 | double t1 = wzero*wzero*dcoef/(Lambda*Lambda); | |
621 | double Lambar = Lambda*(Gamma(0.5*(1+b)) - Gamma(0.5*(1+b),t1))/pow(dcoef, 0.5)/(Gamma(0.5*b) - Gamma(0.5*b, t1)); | |
622 | double muf = wzero - Lambar; | |
623 | double mupisq = 3*Lambda*Lambda*( Gamma(1+0.5*b) - Gamma(1+0.5*b, t1))/dcoef/(Gamma(0.5*b) - Gamma(0.5*b, t1)) - 3*Lambar*Lambar; | |
624 | norm = Mzero(muf, mui, mupisq, vars)*Gamma(0.5*b)/(Gamma(0.5*b) - Gamma(0.5*b, wzero*wzero*dcoef/(Lambda*Lambda))); | |
625 | shape = 2*pow(dcoef, 0.5*b)/Lambda/Gamma(0.5*b)*pow(w/Lambda, b-1)*exp(-dcoef*w*w/(Lambda*Lambda)); | |
626 | } | |
627 | ||
628 | double answer = norm*shape; | |
629 | return answer; | |
630 | } | |
631 | ||
632 | double EvtVubBLNP::Mzero(double muf, double mu, double mupisq, const std::vector<double> &vars) { | |
633 | ||
634 | double CF = 4.0/3.0; | |
635 | double amu = CF*alphas(mu, vars)/M_PI; | |
636 | double answer = 1 - amu*( pow(log(muf/mu), 2) + log(muf/mu) + M_PI*M_PI/24.0) + amu*(log(muf/mu) - 0.5)*mupisq/(3*muf*muf); | |
637 | return answer; | |
638 | ||
639 | } | |
640 | ||
641 | double EvtVubBLNP::wS(double w) { | |
642 | ||
643 | double answer = (Lbar - w)*Shat(w, gvars); | |
644 | return answer; | |
645 | } | |
646 | ||
647 | double EvtVubBLNP::t(double w) { | |
648 | ||
649 | double t1 = -3*lambda2/mupisq*(Lbar - w)*Shat(w, gvars); | |
650 | double myf = myfunction(w, Lbar, moment2); | |
651 | double myBIK = myfunctionBIK(w, Lbar, moment2); | |
652 | double answer = t1; | |
653 | ||
654 | if (isubl == 1) answer = t1; | |
655 | if (isubl == 3) answer = t1 - myf; | |
656 | if (isubl == 4) answer = t1 + myf; | |
657 | if (isubl == 5) answer = t1 - myBIK; | |
658 | if (isubl == 6) answer = t1 + myBIK; | |
659 | ||
660 | return answer; | |
661 | } | |
662 | ||
663 | double EvtVubBLNP::u(double w) { | |
664 | ||
665 | double u1 = -2*(Lbar - w)*Shat(w, gvars); | |
666 | double myf = myfunction(w, Lbar, moment2); | |
667 | double myBIK = myfunctionBIK(w, Lbar, moment2); | |
668 | double answer = u1; | |
669 | ||
670 | if (isubl == 1) answer = u1; | |
671 | if (isubl == 3) answer = u1 + myf; | |
672 | if (isubl == 4) answer = u1 - myf; | |
673 | if (isubl == 5) answer = u1 + myBIK; | |
674 | if (isubl == 6) answer = u1 - myBIK; | |
675 | ||
676 | return answer; | |
677 | } | |
678 | ||
679 | double EvtVubBLNP::v(double w) { | |
680 | ||
681 | double v1 = 3*lambda2/mupisq*(Lbar - w)*Shat(w, gvars); | |
682 | double myf = myfunction(w, Lbar, moment2); | |
683 | double myBIK = myfunctionBIK(w, Lbar, moment2); | |
684 | double answer = v1; | |
685 | ||
686 | if (isubl == 1) answer = v1; | |
687 | if (isubl == 3) answer = v1 - myf; | |
688 | if (isubl == 4) answer = v1 + myf; | |
689 | if (isubl == 5) answer = v1 - myBIK; | |
690 | if (isubl == 6) answer = v1 + myBIK; | |
691 | ||
692 | return answer; | |
693 | } | |
694 | ||
695 | double EvtVubBLNP::myfunction(double w, double Lbar, double mom2) { | |
696 | ||
697 | double bval = 5.0; | |
698 | double x = w/Lbar; | |
699 | double factor = 0.5*mom2*pow(bval/Lbar, 3); | |
700 | double answer = factor*exp(-bval*x)*(1 - 2*bval*x + 0.5*bval*bval*x*x); | |
701 | return answer; | |
702 | ||
703 | } | |
704 | ||
0ca57c2f | 705 | double EvtVubBLNP::myfunctionBIK(double w, double Lbar, double /*mom2*/) { |
da0e9ce3 | 706 | |
707 | double aval = 10.0; | |
708 | double normBIK = (4 - M_PI)*M_PI*M_PI/8/(2-M_PI)/aval + 1; | |
709 | double z = 3*M_PI*w/8/Lbar; | |
710 | double q = M_PI*M_PI*2*pow(M_PI*aval, 0.5)*exp(-aval*z*z)/(4*M_PI - 8)*(1 - 2*pow(aval/M_PI, 0.5)*z) + 8/pow(1+z*z, 4)*(z*log(z) + 0.5*z*(1+z*z) - M_PI/4*(1-z*z)); | |
711 | double answer = q/normBIK; | |
712 | return answer; | |
713 | ||
714 | } | |
715 | ||
716 | double EvtVubBLNP::dU1nlo(double muh, double mui) { | |
717 | ||
718 | double ai = alphas(mui, gvars); | |
719 | double ah = alphas(muh, gvars); | |
720 | ||
721 | double q1 = (ah - ai)/(4*M_PI*beta0); | |
722 | double q2 = log(mb/muh)*Gamma1 + gp1; | |
723 | double q3 = 4*beta1*(log(mb/muh)*Gamma0 + gp0) + Gamma2*(1-ai/ah); | |
724 | double q4 = beta1*beta1*Gamma0*(-1.0 + ai/ah)/(4*pow(beta0,3)); | |
725 | double q5 = -beta2*Gamma0*(1.0 + ai/ah) + beta1*Gamma1*(3 - ai/ah); | |
726 | double q6 = beta1*beta1*Gamma0*(ah - ai)/beta0 - beta2*Gamma0*ah + beta1*Gamma1*ai; | |
727 | ||
728 | double answer = q1*(q2 - q3/4/beta0 + q4 + q5/(4*beta0*beta0)) + 1/(8*M_PI*beta0*beta0*beta0)*log(ai/ah)*q6; | |
729 | return answer; | |
730 | } | |
731 | ||
732 | double EvtVubBLNP::U1lo(double muh, double mui) { | |
733 | double epsilon = 0.0; | |
734 | double answer = pow(mb/muh, -2*aGamma(muh, mui, epsilon))*exp(2*Sfun(muh, mui, epsilon) - 2*agp(muh, mui, epsilon)); | |
735 | return answer; | |
736 | } | |
737 | ||
738 | double EvtVubBLNP::Sfun(double mu1, double mu2, double epsilon) { | |
739 | double a1 = alphas(mu1, gvars)/4/M_PI; | |
740 | double a2 = alphas(mu2, gvars)/alphas(mu1, gvars); | |
741 | ||
742 | double answer = S0(a1,a2) + S1(a1,a2) + epsilon*S2(a1,a2); | |
743 | return answer; | |
744 | ||
745 | } | |
746 | ||
747 | double EvtVubBLNP::S0(double a1, double r) { | |
748 | double answer = -Gamma0/(4.0*beta0*beta0*a1)*(-1.0 + 1.0/r + log(r)); | |
749 | return answer; | |
750 | } | |
751 | ||
0ca57c2f | 752 | double EvtVubBLNP::S1(double /*a1*/, double r) { |
da0e9ce3 | 753 | double answer = Gamma0/(4*beta0*beta0)*(0.5*log(r)*log(r)*beta1/beta0 + (Gamma1/Gamma0 - beta1/beta0)*(1 - r + log(r))); |
754 | return answer; | |
755 | } | |
756 | ||
757 | double EvtVubBLNP::S2(double a1, double r) { | |
758 | ||
759 | double w1 = pow(beta1,2)/pow(beta0,2) - beta2/beta0 - beta1*Gamma1/(beta0*Gamma0) + Gamma2/Gamma0; | |
760 | double w2 = pow(beta1,2)/pow(beta0,2) - beta2/beta0; | |
761 | double w3 = beta1*Gamma1/(beta0*Gamma0) - beta2/beta0; | |
762 | double w4 = a1*Gamma0/(4*beta0*beta0); | |
763 | ||
764 | double answer = w4*(-0.5*pow(1-r,2)*w1 + w2*(1-r)*log(r) + w3*(1-r+r*log(r))); | |
765 | return answer; | |
766 | } | |
767 | ||
768 | double EvtVubBLNP::aGamma(double mu1, double mu2, double epsilon) { | |
769 | double a1 = alphas(mu1, gvars); | |
770 | double a2 = alphas(mu2, gvars); | |
771 | double answer = Gamma0/(2*beta0)*log(a2/a1) + epsilon*(a2-a1)/(8.0*M_PI)*(Gamma1/beta0 - beta1*Gamma0/(beta0*beta0)); | |
772 | return answer; | |
773 | } | |
774 | ||
775 | double EvtVubBLNP::agp(double mu1, double mu2, double epsilon) { | |
776 | double a1 = alphas(mu1, gvars); | |
777 | double a2 = alphas(mu2, gvars); | |
778 | double answer = gp0/(2*beta0)*log(a2/a1) + epsilon*(a2-a1)/(8.0*M_PI)*(gp1/beta0 - beta1*gp0/(beta0*beta0)); | |
779 | return answer; | |
780 | } | |
781 | ||
782 | double EvtVubBLNP::alo(double muh, double mui) { return -2.0*aGamma(muh, mui, 0);} | |
783 | ||
784 | double EvtVubBLNP::anlo(double muh, double mui) { // d/depsilon of aGamma | |
785 | ||
786 | double ah = alphas(muh, gvars); | |
787 | double ai = alphas(mui, gvars); | |
788 | double answer = (ah-ai)/(8.0*M_PI)*(Gamma1/beta0 - beta1*Gamma0/(beta0*beta0)); | |
789 | return answer; | |
790 | } | |
791 | ||
792 | double EvtVubBLNP::alphas(double mu, const std::vector<double> &vars) { | |
793 | ||
794 | // Note: Lambda4 and Lambda5 depend on mbMS = 4.25 | |
795 | // So if you change mbMS, then you will have to recalculate them. | |
796 | ||
797 | double beta0 = vars[8]; | |
798 | double beta1 = vars[9]; | |
799 | double beta2 = vars[10]; | |
800 | ||
801 | double Lambda4 = 0.298791; | |
802 | double lg = 2*log(mu/Lambda4); | |
803 | double answer = 4*M_PI/(beta0*lg)*( 1 - beta1*log(lg)/(beta0*beta0*lg) + beta1*beta1/(beta0*beta0*beta0*beta0*lg*lg)*( (log(lg) - 0.5)*(log(lg) - 0.5) - 5.0/4.0 + beta2*beta0/(beta1*beta1))); | |
804 | return answer; | |
805 | ||
806 | } | |
807 | ||
808 | double EvtVubBLNP::PolyLog(double v, double z) { | |
809 | ||
810 | if (z >= 1) cout << "Error in EvtVubBLNP: 2nd argument to PolyLog is >= 1." << endl; | |
811 | ||
812 | double sum = 0.0; | |
813 | for (int k=1; k<101; k++) { | |
814 | sum = sum + pow(z,k)/pow(k,v); | |
815 | } | |
816 | return sum; | |
817 | } | |
818 | ||
819 | double EvtVubBLNP::Gamma(double z) | |
820 | { | |
821 | if (z<=0) return 0; | |
822 | ||
823 | double v = lgamma(z); | |
824 | return exp(v); | |
825 | } | |
826 | ||
827 | double EvtVubBLNP::Gamma(double a, double x) | |
828 | { | |
829 | double LogGamma; | |
830 | /* if (x<0.0 || a<= 0.0) raise(SIGFPE);*/ | |
831 | if(x<0.0) x=0.0; | |
832 | if(a<=0.0)a=1.e-50; | |
833 | LogGamma = lgamma(a); | |
834 | if (x < (a+1.0)) | |
835 | return gamser(a,x,LogGamma); | |
836 | else | |
837 | return 1.0-gammcf(a,x,LogGamma); | |
838 | } | |
839 | ||
840 | /* ------------------Incomplete gamma function-----------------*/ | |
841 | /* ------------------via its series representation-------------*/ | |
842 | ||
843 | double EvtVubBLNP::gamser(double a, double x, double LogGamma) | |
844 | { | |
845 | double n; | |
846 | double ap,del,sum; | |
847 | ||
848 | ap=a; | |
849 | del=sum=1.0/a; | |
850 | for (n=1;n<ITMAX;n++) { | |
851 | ++ap; | |
852 | del *= x/ap; | |
853 | sum += del; | |
854 | if (fabs(del) < fabs(sum)*EPS) return sum*exp(-x + a*log(x) - LogGamma); | |
855 | } | |
856 | raise(SIGFPE); | |
857 | ||
858 | return 0.0; | |
859 | } | |
860 | ||
861 | /* ------------------Incomplete gamma function complement------*/ | |
862 | /* ------------------via its continued fraction representation-*/ | |
863 | ||
864 | double EvtVubBLNP::gammcf(double a, double x, double LogGamma) { | |
865 | ||
866 | double an,b,c,d,del,h; | |
867 | int i; | |
868 | ||
869 | b = x + 1.0 -a; | |
870 | c = 1.0/FPMIN; | |
871 | d = 1.0/b; | |
872 | h = d; | |
873 | for (i=1;i<ITMAX;i++) { | |
874 | an = -i*(i-a); | |
875 | b+=2.0; | |
876 | d=an*d+b; | |
877 | if (fabs(d) < FPMIN) d = FPMIN; | |
878 | c = b+an/c; | |
879 | if (fabs(c) < FPMIN) c = FPMIN; | |
880 | d = 1.0/d; | |
881 | del=d*c; | |
882 | h *= del; | |
883 | if (fabs(del-1.0) < EPS) return exp(-x+a*log(x)-LogGamma)*h; | |
884 | } | |
885 | raise(SIGFPE); | |
886 | ||
887 | return 0.0; | |
888 | ||
889 | } | |
890 | ||
891 | ||
892 | double EvtVubBLNP::findBLNPWhat() { | |
893 | ||
894 | double ranNum=EvtRandom::Flat(); | |
895 | double oOverBins= 1.0/(float(_pf.size())); | |
896 | int nBinsBelow = 0; // largest k such that I[k] is known to be <= rand | |
897 | int nBinsAbove = _pf.size(); // largest k such that I[k] is known to be > rand | |
898 | int middle; | |
899 | ||
900 | while (nBinsAbove > nBinsBelow+1) { | |
901 | middle = (nBinsAbove + nBinsBelow+1)>>1; | |
902 | if (ranNum >= _pf[middle]) { | |
903 | nBinsBelow = middle; | |
904 | } else { | |
905 | nBinsAbove = middle; | |
906 | } | |
907 | } | |
908 | ||
909 | double bSize = _pf[nBinsAbove] - _pf[nBinsBelow]; | |
910 | // binMeasure is always aProbFunc[nBinsBelow], | |
911 | ||
912 | if ( bSize == 0 ) { | |
913 | // rand lies right in a bin of measure 0. Simply return the center | |
914 | // of the range of that bin. (Any value between k/N and (k+1)/N is | |
915 | // equally good, in this rare case.) | |
916 | return (nBinsBelow + .5) * oOverBins; | |
917 | } | |
918 | ||
919 | double bFract = (ranNum - _pf[nBinsBelow]) / bSize; | |
920 | ||
921 | return (nBinsBelow + bFract) * oOverBins; | |
922 | ||
923 | } |