43 cout <<
" max pdf : " << _gmax << endl;
44 cout <<
" efficiency : " << (float)_ngood / (
float)_ntot << endl;
69 report(
ERROR,
"EvtGen" ) <<
"EvtVubNLO generator expected "
70 <<
" at least npar arguments but found: " <<
getNArg() << endl;
71 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
82 _masses =
new double[_nbins];
83 _weights =
new double[_nbins];
88 std::vector<double> sCoeffs( 11 );
93 sCoeffs[7] = lambda_SF();
97 _SFNorm = SFNorm( sCoeffs );
99 cout <<
" pdf 0.66, 1.32 , 4.32 " << tripleDiff( 0.66, 1.32, 4.32 ) << endl;
100 cout <<
" pdf 0.23,0.37,3.76 " << tripleDiff( 0.23, 0.37, 3.76 ) << endl;
101 cout <<
" pdf 0.97,4.32,4.42 " << tripleDiff( 0.97, 4.32, 4.42 ) << endl;
102 cout <<
" pdf 0.52,1.02,2.01 " << tripleDiff( 0.52, 1.02, 2.01 ) << endl;
103 cout <<
" pdf 1.35,1.39,2.73 " << tripleDiff( 1.35, 1.39, 2.73 ) << endl;
105 if (
getNArg() - npar + 2 != 2 * _nbins )
107 report(
ERROR,
"EvtGen" ) <<
"EvtVubNLO generator expected " << _nbins
108 <<
" masses and weights but found: " << (
getNArg() - npar ) / 2
110 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
115 for ( i = 0; i < _nbins; i++ )
117 _masses[i] =
getArg( j++ );
118 if ( i > 0 && _masses[i] <= _masses[i - 1] )
120 report(
ERROR,
"EvtGen" ) <<
"EvtVubNLO generator expected "
121 <<
" mass bins in ascending order!"
122 <<
"Will terminate execution!" << endl;
125 _weights[i] =
getArg( j++ );
126 if ( _weights[i] < 0 )
128 report(
ERROR,
"EvtGen" ) <<
"EvtVubNLO generator expected "
129 <<
" weights >= 0, but found: " << _weights[i] << endl;
130 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
133 if ( _weights[i] > maxw ) maxw = _weights[i];
137 report(
ERROR,
"EvtGen" ) <<
"EvtVubNLO generator expected at least one "
138 <<
" weight > 0, but found none! "
139 <<
"Will terminate execution!" << endl;
142 for ( i = 0; i < _nbins; i++ ) _weights[i] /= maxw;
167 double pp, pm, pl,
ml, El( 0.0 ), Eh( 0.0 ), sh( 0.0 );
184 pm = pow( pm, 1. / 3. ) * _mB;
187 pl = sqrt( pl ) * pm;
193 El = ( _mB - pl ) / 2.;
194 Eh = ( pp + pm ) / 2;
198 if ( pp < pl && El >
ml && sh > _masses[0] * _masses[0] &&
199 _mB * _mB + sh - 2 * _mB * Eh >
ml *
ml )
202 pdf = tripleDiff( pp, pl, pm );
207 <<
"EvtVubNLO pdf above maximum: " << pdf <<
" P+,P-,Pl,Pdf= " << pp <<
" " << pm
208 <<
" " << pl <<
" " << pdf << endl;
211 if ( pdf >= xran ) tryit =
false;
213 if ( pdf > _gmax ) _gmax = pdf;
221 if ( !tryit && _nbins > 0 )
225 double m = sqrt( sh );
227 while ( j < _nbins && m > _masses[j] ) j++;
228 double w = _weights[j - 1];
229 if (
w < xran1 ) tryit =
true;
252 sttmp = sqrt( 1 - ctH * ctH );
253 ptmp = sqrt( Eh * Eh - sh );
254 double pHB[4] = { Eh, ptmp * sttmp *
cos( phH ), ptmp * sttmp *
sin( phH ), ptmp * ctH };
255 p4.
set( pHB[0], pHB[1], pHB[2], pHB[3] );
261 double pWB[4] = { _mB - Eh, -pHB[1], -pHB[2], -pHB[3] };
266 double mW2 = _mB * _mB + sh - 2 * _mB * Eh;
270 double beta = ptmp / pWB[0];
271 double gamma = pWB[0] / sqrt( mW2 );
275 ptmp = ( mW2 -
ml *
ml ) / 2 / sqrt( mW2 );
276 pLW[0] = sqrt(
ml *
ml + ptmp * ptmp );
278 double ctL = ( El - gamma * pLW[0] ) / beta / gamma / ptmp;
279 if ( ctL < -1 ) ctL = -1;
280 if ( ctL > 1 ) ctL = 1;
281 sttmp = sqrt( 1 - ctL * ctL );
284 double xW[3] = { -pWB[2], pWB[1], 0 };
286 double zW[3] = { pWB[1] / apWB, pWB[2] / apWB, pWB[3] / apWB };
288 double lx = sqrt( xW[0] * xW[0] + xW[1] * xW[1] );
289 for ( j = 0; j < 2; j++ ) xW[j] /= lx;
292 double yW[3] = { -pWB[1] * pWB[3], -pWB[2] * pWB[3], pWB[1] * pWB[1] + pWB[2] * pWB[2] };
293 double ly = sqrt( yW[0] * yW[0] + yW[1] * yW[1] + yW[2] * yW[2] );
294 for ( j = 0; j < 3; j++ ) yW[j] /= ly;
299 for ( j = 0; j < 3; j++ )
300 pLW[j + 1] = sttmp *
cos( phL ) * ptmp * xW[j] + sttmp *
sin( phL ) * ptmp * yW[j] +
307 double appLB = beta * gamma * pLW[0] + gamma * ctL * apLW;
309 ptmp = sqrt( El * El -
ml *
ml );
310 double ctLL = appLB / ptmp;
312 if ( ctLL > 1 ) ctLL = 1;
313 if ( ctLL < -1 ) ctLL = -1;
315 double pLB[4] = { El, 0, 0, 0 };
316 double pNB[8] = { pWB[0] - El, 0, 0, 0 };
318 for ( j = 1; j < 4; j++ )
320 pLB[j] = pLW[j] + ( ctLL * ptmp - ctL * apLW ) / apWB * pWB[j];
321 pNB[j] = pWB[j] - pLB[j];
324 p4.
set( pLB[0], pLB[1], pLB[2], pLB[3] );
327 p4.
set( pNB[0], pNB[1], pNB[2], pNB[3] );
333double EvtVubNLO::tripleDiff(
double pp,
double pl,
double pm ) {
335 std::vector<double> sCoeffs( 11 );
343 sCoeffs[7] = lambda_SF();
346 sCoeffs[10] = _SFNorm;
348 double c1 = ( _mB + pl - pp - pm ) * ( pm - pl );
349 double c2 = 2 * ( pl - pp ) * ( pm - pl );
350 double c3 = ( _mB - pm ) * ( pm - pp );
351 double aF1 = F10( sCoeffs );
352 double aF2 = F20( sCoeffs );
353 double aF3 = F30( sCoeffs );
354 double td0 = c1 * aF1 + c2 * aF2 + c3 * aF3;
360 double tdInt = jetSF->
evaluate( 0, pp * ( 1 - smallfrac ) );
364 U1lo( mu_h(), mu_i() ) * pow( ( pm - pp ) / ( _mB - pp ), alo( mu_h(), mu_i() ) );
365 double TD = ( _mB - pp ) * SU * ( td0 + tdInt );
370double EvtVubNLO::integrand(
double omega,
const std::vector<double>& coeffs ) {
372 double c1 = ( coeffs[5] + coeffs[1] - coeffs[0] - coeffs[2] ) * ( coeffs[2] - coeffs[1] );
373 double c2 = 2 * ( coeffs[1] - coeffs[0] ) * ( coeffs[2] - coeffs[1] );
374 double c3 = ( coeffs[5] - coeffs[2] ) * ( coeffs[2] - coeffs[0] );
376 return c1 * F1Int( omega, coeffs ) + c2 * F2Int( omega, coeffs ) +
377 c3 * F3Int( omega, coeffs );
380double EvtVubNLO::F10(
const std::vector<double>& coeffs ) {
381 double pp = coeffs[0];
382 double y = ( coeffs[2] - coeffs[0] ) / ( coeffs[5] - coeffs[0] );
383 double mui = coeffs[9];
384 double muh = coeffs[8];
386 double result = U1nlo( muh, mui ) / U1lo( muh, mui );
388 result += anlo( muh, mui ) * log( y );
390 result += C_F( muh ) *
391 ( -4 * pow( log( y * coeffs[4] / muh ), 2 ) + 10 * log( y * coeffs[4] / muh ) -
392 4 * log( y ) - 2 * log( y ) / ( 1 - y ) - 4.0 *
ddilog_( &z ) -
395 result += C_F( mui ) *
396 ( 2 * pow( log( y * coeffs[4] * pp / pow( mui, 2 ) ), 2 ) -
397 3 * log( y * coeffs[4] * pp / pow( mui, 2 ) ) + 7 - pow(
EvtConst::pi, 2 ) );
398 result *= shapeFunction( pp, coeffs );
400 result += ( -subS( coeffs ) + 2 * subT( coeffs ) +
401 ( subU( coeffs ) - subV( coeffs ) ) * ( 1 / y - 1. ) ) /
403 result += shapeFunction( pp, coeffs ) / pow( ( coeffs[5] - coeffs[0] ), 2 ) *
404 ( -5 * ( lambda1() + 3 * lambda2() ) / 6 +
405 2 * ( 2 * lambda1() / 3 - lambda2() ) / pow( y, 2 ) );
414double EvtVubNLO::F1Int(
double omega,
const std::vector<double>& coeffs ) {
415 double pp = coeffs[0];
416 double y = ( coeffs[2] - coeffs[0] ) / ( coeffs[5] - coeffs[0] );
418 return C_F( coeffs[9] ) *
419 ( ( shapeFunction( omega, coeffs ) - shapeFunction( pp, coeffs ) ) *
420 ( 4 * log( y * coeffs[4] * ( pp - omega ) / pow( coeffs[9], 2 ) ) - 3 ) /
422 (
g1( y, ( pp - omega ) / ( coeffs[5] - coeffs[0] ) ) / ( coeffs[5] - pp ) *
423 shapeFunction( omega, coeffs ) ) );
426double EvtVubNLO::F20(
const std::vector<double>& coeffs ) {
427 double pp = coeffs[0];
428 double y = ( coeffs[2] - coeffs[0] ) / ( coeffs[5] - coeffs[0] );
430 C_F( coeffs[8] ) * log( y ) / ( 1 - y ) * shapeFunction( pp, coeffs ) -
432 ( subS( coeffs ) + 2 * subT( coeffs ) - ( subT( coeffs ) + subV( coeffs ) ) / y ) /
435 result += shapeFunction( pp, coeffs ) / pow( ( coeffs[5] - coeffs[0] ) * y, 2 ) *
436 ( 2 * lambda1() / 3 + 4 * lambda2() - y * ( 7 / 6 * lambda1() + 3 * lambda2() ) );
440double EvtVubNLO::F2Int(
double omega,
const std::vector<double>& coeffs ) {
441 double pp = coeffs[0];
442 double y = ( coeffs[2] - coeffs[0] ) / ( coeffs[5] - coeffs[0] );
443 return C_F( coeffs[9] ) * g3( y, ( pp - omega ) / ( coeffs[5] - coeffs[0] ) ) *
444 shapeFunction( omega, coeffs ) / ( coeffs[5] - pp );
447double EvtVubNLO::F30(
const std::vector<double>& coeffs ) {
448 double y = ( coeffs[2] - coeffs[0] ) / ( coeffs[5] - coeffs[0] );
449 return shapeFunction( coeffs[0], coeffs ) / pow( ( coeffs[5] - coeffs[0] ) * y, 2 ) *
450 ( -2 * lambda1() / 3 + lambda2() );
453double EvtVubNLO::F3Int(
double omega,
const std::vector<double>& coeffs ) {
454 double pp = coeffs[0];
455 double y = ( coeffs[2] - coeffs[0] ) / ( coeffs[5] - coeffs[0] );
456 return C_F( coeffs[9] ) * g3( y, ( pp - omega ) / ( coeffs[5] - coeffs[0] ) ) / 2 *
457 shapeFunction( omega, coeffs ) / ( coeffs[2] - coeffs[0] );
460double EvtVubNLO::g1(
double y,
double x ) {
462 ( y * ( -9 + 10 * y ) +
x *
x * ( -12 + 13 * y ) + 2 *
x * ( -8 + 6 * y + 3 * y * y ) ) /
463 y / pow( 1 +
x, 2 ) / (
x + y );
464 result -= 4 * log( ( 1 + 1 /
x ) * y ) /
x;
465 result -= 2 * log( 1 + y /
x ) *
466 ( 3 * pow(
x, 4 ) * ( -2 + y ) - 2 * pow( y, 3 ) - 4 * pow(
x, 3 ) * ( 2 + y ) -
467 2 *
x * y * y * ( 4 + y ) -
x *
x * y * ( 12 + 4 * y + y * y ) ) /
468 x / pow( ( 1 +
x ) * y, 2 ) / (
x + y );
472double EvtVubNLO::g2(
double y,
double x ) {
473 double result = y * ( 10 * pow(
x, 4 ) + y * y + 3 *
x *
x * y * ( 10 + y ) +
474 pow(
x, 3 ) * ( 12 + 19 * y ) +
x * y * ( 8 + 4 * y + y * y ) );
475 result -= 2 *
x * log( 1 + y /
x ) *
476 ( 5 * pow(
x, 4 ) + 2 * y * y + 6 * pow(
x, 3 ) * ( 1 + 2 * y ) +
477 4 * y *
x * ( 1 + 2 * y ) +
x *
x * y * ( 18 + 5 * y ) );
478 result *= 2 / ( pow( y * ( 1 +
x ), 2 ) * y * (
x + y ) );
482double EvtVubNLO::g3(
double y,
double x ) {
484 ( 2 * pow( y, 3 ) * ( -11 + 2 * y ) - 10 * pow(
x, 4 ) * ( 6 - 6 * y + y * y ) +
485 x * y * y * ( -94 + 29 * y + 2 * y * y ) +
486 2 *
x *
x * y * ( -72 + 18 * y + 13 * y * y ) -
487 pow(
x, 3 ) * ( 72 + 42 * y - 70 * y * y + 3 * pow( y, 3 ) ) ) /
488 ( pow( y * ( 1 +
x ), 2 ) * y * (
x + y ) );
489 result += 2 * log( 1 + y /
x ) *
490 ( -6 *
x * pow( y, 3 ) * ( -5 + y ) + 4 * pow( y, 4 ) +
491 5 * pow(
x, 5 ) * ( 6 - 6 * y + y * y ) -
492 4 * pow(
x * y, 2 ) * ( -20 + 6 * y + y * y ) +
493 pow(
x, 3 ) * y * ( 90 - 10 * y - 28 * y * y + pow( y, 3 ) ) +
494 pow(
x, 4 ) * ( 36 + 36 * y - 50 * y * y + 4 * pow( y, 3 ) ) ) /
495 ( pow( ( 1 +
x ) * y * y, 2 ) * (
x + y ) );
527double EvtVubNLO::SFNorm(
const std::vector<double>& coeffs ) {
529 double omega0 = 1.68;
532 double omega0 = 1.68;
533 return M0( mu_i(), omega0 ) * pow( _b, _b ) / lambda_SF() /
534 ( Gamma( _b ) - Gamma( _b, _b * omega0 / lambda_SF() ) );
536 else if ( _idSF == 2 )
538 double c = cGaus( _b );
539 return M0( mu_i(), omega0 ) * 2 / lambda_SF() / pow( c, -( 1 + _b ) / 2. ) /
540 ( Gamma( ( 1 + _b ) / 2 ) -
541 Gamma( ( 1 + _b ) / 2, pow( omega0 / lambda_SF(), 2 ) * c ) );
545 report(
ERROR,
"EvtGen" ) <<
"unknown SF " << _idSF << endl;
550double EvtVubNLO::shapeFunction(
double omega,
const std::vector<double>& sCoeffs ) {
551 if ( sCoeffs[6] == 1 ) {
return sCoeffs[10] * expShapeFunction( omega, sCoeffs ); }
552 else if ( sCoeffs[6] == 2 ) {
return sCoeffs[10] * gausShapeFunction( omega, sCoeffs ); }
555 report(
ERROR,
"EvtGen" ) <<
"EvtVubNLO : unknown shape function # " << sCoeffs[6] << endl;
561double EvtVubNLO::subS(
const std::vector<double>& c ) {
562 return ( lambda_bar( 1.68 ) - c[0] ) * shapeFunction( c[0], c );
564double EvtVubNLO::subT(
const std::vector<double>& c ) {
565 return -3 * lambda2() * subS( c ) / mu_pi2( 1.68 );
567double EvtVubNLO::subU(
const std::vector<double>& c ) {
return -2 * subS( c ); }
568double EvtVubNLO::subV(
const std::vector<double>& c ) {
return -subT( c ); }
570double EvtVubNLO::lambda_bar(
double omega0 ) {
575 double rat = omega0 * _b / lambda_SF();
576 _lbar = lambda_SF() / _b * ( Gamma( 1 + _b ) - Gamma( 1 + _b, rat ) ) /
577 ( Gamma( _b ) - Gamma( _b, rat ) );
579 else if ( _idSF == 2 )
581 double c = cGaus( _b );
584 ( Gamma( 1 + _b / 2 ) - Gamma( 1 + _b / 2, pow( omega0 / lambda_SF(), 2 ) * c ) ) /
585 ( Gamma( ( 1 + _b ) / 2 ) -
586 Gamma( ( 1 + _b ) / 2, pow( omega0 / lambda_SF(), 2 ) * c ) ) /
593double EvtVubNLO::mu_pi2(
double omega0 ) {
598 double rat = omega0 * _b / lambda_SF();
599 _mupi2 = 3 * ( pow( lambda_SF() / _b, 2 ) * ( Gamma( 2 + _b ) - Gamma( 2 + _b, rat ) ) /
600 ( Gamma( _b ) - Gamma( _b, rat ) ) -
601 pow( lambda_bar( omega0 ), 2 ) );
603 else if ( _idSF == 2 )
605 double c = cGaus( _b );
606 double m1 = Gamma( ( 3 + _b ) / 2 ) -
607 Gamma( ( 3 + _b ) / 2, pow( omega0 / lambda_SF(), 2 ) * c );
609 Gamma( 1 + _b / 2 ) - Gamma( 1 + _b / 2, pow( omega0 / lambda_SF(), 2 ) * c );
610 double m3 = Gamma( ( 1 + _b ) / 2 ) -
611 Gamma( ( 1 + _b ) / 2, pow( omega0 / lambda_SF(), 2 ) * c );
612 _mupi2 = 3 * pow( lambda_SF(), 2 ) * (
m1 / m3 - pow(
m2 / m3, 2 ) ) / c;
618double EvtVubNLO::M0(
double mui,
double omega0 ) {
619 double mf = omega0 - lambda_bar( omega0 );
622 ( -pow( log( mf / mui ), 2 ) - log( mf / mui ) - pow(
EvtConst::pi / 2, 2 ) / 6. +
623 mu_pi2( omega0 ) / 3 / pow( mf, 2 ) * ( log( mf / mui ) - 0.5 ) );
626double EvtVubNLO::alphas(
double mu ) {
627 double Lambda4 = 0.302932;
628 double lg = 2 * log( mu / Lambda4 );
630 ( 1 - beta1() * log( lg ) / pow( beta0(), 2 ) / lg +
631 pow( beta1() / lg, 2 ) / pow( beta0(), 4 ) *
632 ( pow( log( lg ) - 0.5, 2 ) - 1.25 + beta2() * beta0() / pow( beta1(), 2 ) ) );
635double EvtVubNLO::gausShapeFunction(
double omega,
const std::vector<double>& sCoeffs ) {
636 double b = sCoeffs[3];
637 double l = sCoeffs[7];
638 double wL = omega / l;
640 return pow( wL, b ) *
exp( -cGaus( b ) * wL * wL );
643double EvtVubNLO::expShapeFunction(
double omega,
const std::vector<double>& sCoeffs ) {
644 double b = sCoeffs[3];
645 double l = sCoeffs[7];
646 double wL = omega / l;
648 return pow( wL, b - 1 ) *
exp( -b * wL );
651double EvtVubNLO::Gamma(
double z ) {
653 std::vector<double> gammaCoeffs( 6 );
654 gammaCoeffs[0] = 76.18009172947146;
655 gammaCoeffs[1] = -86.50532032941677;
656 gammaCoeffs[2] = 24.01409824083091;
657 gammaCoeffs[3] = -1.231739572450155;
658 gammaCoeffs[4] = 0.1208650973866179e-2;
659 gammaCoeffs[5] = -0.5395239384953e-5;
662 double x, y, tmp, ser;
669 tmp = tmp - (
x + 0.5 ) * log( tmp );
670 ser = 1.000000000190015;
672 for ( j = 0; j < 6; j++ )
675 ser = ser + gammaCoeffs[j] / y;
678 return exp( -tmp + log( 2.5066282746310005 * ser /
x ) );
681double EvtVubNLO::Gamma(
double z,
double tmin ) {
682 std::vector<double> c( 1 );
684 EvtItgPtrFunction* func =
new EvtItgPtrFunction( &dgamma, tmin, 100., c );
685 EvtItgAbsIntegrator* jetSF =
new EvtItgSimpsonIntegrator( *func, 0.001 );
686 return jetSF->
evaluate( tmin, 100. );
character *LEPTONflag integer iresonances real zeta5 real adp3 real large_3 real zeta5 common params adp3 common switch large_3 common lepton LEPTONflag common RESFIT IRESON common RES iresonances common alpgmu era0 common physparams ERMW common leptomass ml
EvtComplex exp(const EvtComplex &c)
ostream & report(Severity severity, const char *facility)
double ddilog_(const double *)
double ddilog_(const double &sh)
double sin(const BesAngle a)
double cos(const BesAngle a)
void checkNDaug(int d1, int d2=-1)
double evaluate(double lower, double upper) const
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtParticle * getDaug(int i)
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
void set(int i, double d)
void getName(std::string &name)
void decay(EvtParticle *p)