33#include "CLHEP/Random/RandGeneral.h"
68 report(
ERROR,
"EvtGen") <<
"EvtVub generator expected "
69 <<
" at least 6 arguments (mb,a,alpha_s,Nbins,m1,w1,...) but found: "
71 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
80 _storeQplus = (
getArg(3)<0?1:0);
81 _masses =
new double[_nbins];
82 _weights =
new double[_nbins];
85 report(
ERROR,
"EvtGen") <<
"EvtVub generator expected "
86 << _nbins <<
" masses and weights but found: "
88 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
93 for (i=0;i<_nbins;i++) {
95 if (i>0 && _masses[i] <= _masses[i-1]) {
96 report(
ERROR,
"EvtGen") <<
"EvtVub generator expected "
97 <<
" mass bins in ascending order!"
98 <<
"Will terminate execution!"<<endl;
101 _weights[i] =
getArg(j++);
102 if (_weights[i] < 0) {
103 report(
ERROR,
"EvtGen") <<
"EvtVub generator expected "
104 <<
" weights >= 0, but found: "
105 <<_weights[i] <<endl;
106 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
109 if ( _weights[i] > maxw ) maxw = _weights[i];
112 report(
ERROR,
"EvtGen") <<
"EvtVub generator expected at least one "
113 <<
" weight > 0, but found none! "
114 <<
"Will terminate execution!"<<endl;
117 for (i=0;i<_nbins;i++) _weights[i]/=maxw;
121 const double dGMax0 = 3.;
122 _dGMax = 0.21344+8.905*_alphas;
123 if ( _dGMax < dGMax0 ) _dGMax = dGMax0;
135 double mB = (mB0<mBP?mB0:mBP);
137 const double xlow = -_mb;
138 const double xhigh = mB-_mb;
139 const int aSize = 10000;
145 for(i=0;i<aSize;i++){
146 double kplus =
xlow + (double)(i+0.5)/((double)aSize)*(xhigh-
xlow);
152 for (i=0; i<_pf.size(); i++) _pf[i]/=_pf[_pf.size()-1];
180 double mB,ml,
xlow,xhigh,qplus;
184 const double lp2epsilon=-10;
210 while( kplus >= xhigh || kplus <=
xlow
211 || (_alphas == 0 && kplus >= mB/2-_mb
212 + sqrt(mB*mB/4-_masses[0]*_masses[0]))) {
213 kplus = findPFermi();
216 qplus = mB-_mb-kplus;
217 if( (mB-qplus)/2.<=ml)
continue;
225 p2 = pow(10,lp2epsilon*
p2);
228 if ( El > ml && El < mB/2) {
230 Eh = z*(mB-qplus)/2+qplus;
231 if ( Eh > 0 && Eh < mB ) {
233 sh =
p2*pow(mB-qplus,2)+2*qplus*(Eh-qplus)+qplus*qplus;
234 if ( sh > _masses[0]*_masses[0]
235 && mB*mB + sh - 2*mB*Eh > ml*ml) {
241 if (
y > 1 )
report(
WARNING,
"EvtGen")<<
"EvtVub decay probability > 1 found: " <<
y << endl;
242 if (
y >= xran ) tryit = 0;
250 double m = sqrt(sh);j=0;
251 while ( j < _nbins && m > _masses[j] ) j++;
252 double w = _weights[j-1];
253 if (
w >= xran1 ) rew =
false;
277 sttmp = sqrt(1-ctH*ctH);
278 ptmp = sqrt(Eh*Eh-sh);
279 double pHB[4] = {Eh,ptmp*sttmp*
cos(phH),ptmp*sttmp*
sin(phH),ptmp*ctH};
280 p4.set(pHB[0],pHB[1],pHB[2],pHB[3]);
303 double pWB[4] = {mB-Eh,-pHB[1],-pHB[2],-pHB[3]};
308 double mW2 = mB*mB + sh - 2*mB*Eh;
309 double beta = ptmp/pWB[0];
310 double gamma = pWB[0]/sqrt(mW2);
314 ptmp = (mW2-ml*ml)/2/sqrt(mW2);
315 pLW[0] = sqrt(ml*ml + ptmp*ptmp);
317 double ctL = (El - gamma*pLW[0])/beta/gamma/ptmp;
318 if ( ctL < -1 ) ctL = -1;
319 if ( ctL > 1 ) ctL = 1;
320 sttmp = sqrt(1-ctL*ctL);
323 double xW[3] = {-pWB[2],pWB[1],0};
325 double zW[3] = {pWB[1]/apWB,pWB[2]/apWB,pWB[3]/apWB};
327 double lx = sqrt(xW[0]*xW[0]+xW[1]*xW[1]);
332 double yW[3] = {-pWB[1]*pWB[3],-pWB[2]*pWB[3],pWB[1]*pWB[1]+pWB[2]*pWB[2]};
333 double ly = sqrt(yW[0]*yW[0]+yW[1]*yW[1]+yW[2]*yW[2]);
341 pLW[j+1] = sttmp*
cos(phL)*ptmp*xW[j]
342 + sttmp*
sin(phL)*ptmp*yW[j]
351 double appLB = beta*gamma*pLW[0] + gamma*ctL*apLW;
353 ptmp = sqrt(El*El-ml*ml);
354 double ctLL = appLB/ptmp;
356 if ( ctLL > 1 ) ctLL = 1;
357 if ( ctLL < -1 ) ctLL = -1;
359 double pLB[4] = {El,0,0,0};
360 double pNB[4] = {pWB[0]-El,0,0,0};
363 pLB[j] = pLW[j] + (ctLL*ptmp - ctL*apLW)/apWB*pWB[j];
364 pNB[j] = pWB[j] - pLB[j];
367 p4.set(pLB[0],pLB[1],pLB[2],pLB[3]);
370 p4.set(pNB[0],pNB[1],pNB[2],pNB[3]);
377double EvtVub::findPFermi() {
380 double oOverBins= 1.0/(float(_pf.size()));
382 int nBinsAbove = _pf.size();
385 while (nBinsAbove > nBinsBelow+1) {
386 middle = (nBinsAbove + nBinsBelow+1)>>1;
387 if (ranNum >= _pf[middle]) {
394 double bSize = _pf[nBinsAbove] - _pf[nBinsBelow];
401 return (nBinsBelow + .5) * oOverBins;
404 HepDouble bFract = (ranNum - _pf[nBinsBelow]) / bSize;
406 return (nBinsBelow + bFract) * oOverBins;
double sin(const BesAngle a)
double cos(const BesAngle a)
DOUBLE_PRECISION xlow[20]
ostream & report(Severity severity, const char *facility)
void checkNDaug(int d1, int d2=-1)
static double getMaxMass(EvtId i)
static EvtId getId(const std::string &name)
double getFPFermi(const double &kplus)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
void setLifetime(double tau)
EvtParticle * getDaug(int i)
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
void getName(std::string &name)
void decay(EvtParticle *p)
double getdGdxdzdp(const double &x, const double &z, const double &p2)
double double double * p4