Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

EvtVub Class Reference

#include <EvtVub.hh>

Inheritance diagram for EvtVub:

EvtDecayIncoherent EvtDecayBase List of all members.

Public Member Functions

void checkNArg (int a1, int a2=-1, int a3=-1, int a4=-1)
void checkNDaug (int d1, int d2=-1)
void checkQ ()
void checkSpinDaughter (int d1, EvtSpinType::spintype sp)
void checkSpinParent (EvtSpinType::spintype sp)
EvtDecayBaseclone ()
virtual void command (std::string cmd)
virtual std::string commandName ()
void decay (EvtParticle *p)
void disableCheckQ ()
 EvtVub ()
double getArg (int j)
double * getArgs ()
std::string * getArgsStr ()
std::string getArgStr (int j)
double getBranchingFraction ()
EvtId getDaug (int i)
EvtIdgetDaugs ()
int getDSum ()
std::string getModelName ()
void getName (std::string &name)
int getNArg ()
int getNDaug ()
EvtId getParentId ()
int getPHOTOS ()
double getProbMax (double prob)
void init ()
void initProbMax ()
int isDaughterSpinDensitySet (int daughter)
void makeDecay (EvtParticle *p)
virtual bool matchingDecay (const EvtDecayBase &other) const
void noProbMax ()
virtual int nRealDaughters ()
void printSummary ()
double resetProbMax (double prob)
void saveDecayInfo (EvtId ipar, int ndaug, EvtId *daug, int narg, std::vector< std::string > &args, std::string name, double brfr)
void setDaughterSpinDensity (int daughter)
void setPHOTOS ()
void setProbMax (double prbmx)
void setSummary ()
void setVerbose ()
int summary ()
int verbose ()
virtual ~EvtVub ()

Static Public Member Functions

void findMass (EvtParticle *p)
void findMasses (EvtParticle *p, int ndaugs, EvtId daugs[10], double masses[10])
double findMaxMass (EvtParticle *p)

Protected Member Functions

bool daugsDecayedByParentModel ()

Protected Attributes

bool _daugsDecayedByParentModel

Private Member Functions

double findPFermi ()

Private Attributes

double _a
double _alphas
EvtVubdGamma_dGamma
double _dGMax
double * _masses
double _mb
int _nbins
std::vector< double > _pf
int _storeQplus
double * _weights

Constructor & Destructor Documentation

EvtVub::EvtVub  )  [inline]
 

00038 {}

EvtVub::~EvtVub  )  [virtual]
 

00043                 {
00044   delete _dGamma;
00045   delete [] _masses;
00046   delete [] _weights;
00047 }


Member Function Documentation

void EvtDecayBase::checkNArg int  a1,
int  a2 = -1,
int  a3 = -1,
int  a4 = -1
[inherited]
 

00483                                                            {
00484 
00485   if ( _narg != a1 && _narg != a2 && _narg != a3 && _narg != a4 ) {
00486     report(ERROR,"EvtGen") << _modelname.c_str() << " generator expected "<<endl;
00487     report(ERROR,"EvtGen") << a1<<endl;; 
00488     if ( a2>-1) {
00489       report(ERROR,"EvtGen") << " or " << a2<<endl; 
00490     }
00491     if ( a3>-1) {
00492       report(ERROR,"EvtGen") << " or " << a3<<endl; 
00493     }
00494     if ( a4>-1) {
00495       report(ERROR,"EvtGen") << " or " << a4<<endl; 
00496     }
00497     report(ERROR,"EvtGen") << " arguments but found:"<< _narg << endl;
00498     printSummary();
00499     report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
00500     ::abort();
00501 
00502   } 
00503 
00504 }

void EvtDecayBase::checkNDaug int  d1,
int  d2 = -1
[inherited]
 

00505                                            {
00506 
00507   if ( _ndaug != d1 && _ndaug != d2 ) {
00508     report(ERROR,"EvtGen") << _modelname.c_str() << " generator expected ";
00509     report(ERROR,"EvtGen") << d1; 
00510     if ( d2>-1) {
00511       report(ERROR,"EvtGen") << " or " << d2; 
00512     }
00513     report(ERROR,"EvtGen") << " daughters but found:"<< _ndaug << endl;
00514     printSummary();
00515     report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
00516     ::abort();
00517   } 
00518 
00519 }

void EvtDecayBase::checkQ  )  [inherited]
 

00035                           {
00036   int i;
00037   int q=0;
00038   int qpar;
00039 
00040   //If there are no daughters (jetset etc) then we do not
00041   //want to do this test.  Why?  Because sometimes the parent
00042   //will have a nonzero charge.
00043 
00044   if ( _ndaug != 0) {
00045     for(i=0; i<_ndaug; i++ ) {
00046       q += EvtPDL::chg3(_daug[i]);
00047     }
00048     qpar = EvtPDL::chg3(_parent);
00049 
00050     if ( q != qpar ) {
00051       report(ERROR,"EvtGen") <<_modelname.c_str()<< " generator expected "
00052                              << " charge to be conserved, found:"<<endl;
00053       report(ERROR,"EvtGen") << "Parent charge of "<<(qpar/3)<<endl;
00054       report(ERROR,"EvtGen") << "Sum of daughter charge of "<<(q/3)<<endl;
00055       report(ERROR,"EvtGen") << "The parent is "<< EvtPDL::name(_parent).c_str()<<endl;
00056       for(i=0; i<_ndaug; i++ ) {
00057       report(ERROR,"EvtGen") << "Daughter "<< EvtPDL::name(_daug[i]).c_str()<<endl;
00058       }
00059       report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
00060       
00061       ::abort();
00062     }
00063   }
00064 }

void EvtDecayBase::checkSpinDaughter int  d1,
EvtSpinType::spintype  sp
[inherited]
 

00534                                                                    {
00535 
00536   EvtSpinType::spintype parenttype = EvtPDL::getSpinType(getDaug(d1));
00537   if ( parenttype != sp ) {
00538     report(ERROR,"EvtGen") << _modelname.c_str() 
00539                            << " did not get the correct daughter spin d=" 
00540                            << d1 << endl;
00541     printSummary();
00542     report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
00543     ::abort();
00544   } 
00545 
00546 }

void EvtDecayBase::checkSpinParent EvtSpinType::spintype  sp  )  [inherited]
 

00521                                                          {
00522 
00523   EvtSpinType::spintype parenttype = EvtPDL::getSpinType(getParentId());
00524   if ( parenttype != sp ) {
00525     report(ERROR,"EvtGen") << _modelname.c_str() 
00526                            << " did not get the correct parent spin\n";
00527     printSummary();
00528     report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
00529     ::abort();
00530   } 
00531 
00532 }

EvtDecayBase * EvtVub::clone  )  [virtual]
 

Implements EvtDecayBase.

00055                            {
00056 
00057   return new EvtVub;
00058 
00059 }

void EvtDecayBase::command std::string  cmd  )  [virtual, inherited]
 

Reimplemented in EvtJetSet, EvtLunda, EvtLundCharm, EvtPythia, and EvtTauola.

00132                                        {
00133   report(ERROR,"EvtGen") << "Should never call EvtDecayBase::command"<<endl;
00134   ::abort();
00135 }

std::string EvtDecayBase::commandName  )  [virtual, inherited]
 

Reimplemented in EvtJetSet, EvtLunda, EvtLundCharm, EvtPythia, and EvtTauola.

00129                                    {
00130   return std::string("");
00131 }

bool EvtDecayBase::daugsDecayedByParentModel  )  [inline, protected, inherited]
 

00111 {return _daugsDecayedByParentModel;}

void EvtVub::decay EvtParticle p  )  [virtual]
 

Implements EvtDecayBase.

00169                                   {
00170 
00171   int j;
00172   // B+ -> u-bar specflav l+ nu
00173   
00174   EvtParticle *xuhad, *lepton, *neutrino;
00175   EvtVector4R p4;
00176   // R. Faccini 21/02/03
00177   // move the reweighting up , before also shooting the fermi distribution
00178   double x,z,p2;
00179   double sh=0.0;
00180   double mB,ml,xlow,xhigh,qplus;
00181   double El=0.0;
00182   double Eh=0.0;
00183   double kplus;
00184   const double lp2epsilon=-10;
00185   bool rew(true);
00186   while(rew){
00187     
00188     p->initializePhaseSpace(getNDaug(),getDaugs());
00189     
00190     xuhad=p->getDaug(0);
00191     lepton=p->getDaug(1);
00192     neutrino=p->getDaug(2);
00193     
00194     mB = p->mass();
00195     ml = lepton->mass();
00196     
00197     xlow = -_mb;
00198     xhigh = mB-_mb;    
00199     
00200     
00201     // Fermi motion does not need to be computed inside the
00202     // tryit loop as m_b in Gamma0 does not need to be replaced by (m_b+kplus).
00203     // The difference however should be of the Order (lambda/m_b)^2 which is
00204     // beyond the considered orders in the paper anyway ...
00205     
00206     // for alpha_S = 0 and a mass cut on X_u not all values of kplus are 
00207     // possible. The maximum value is mB/2-_mb + sqrt(mB^2/4-_masses[0]^2)
00208     kplus = 2*xhigh;
00209     
00210     while( kplus >= xhigh || kplus <= xlow 
00211            || (_alphas == 0 && kplus >= mB/2-_mb 
00212                + sqrt(mB*mB/4-_masses[0]*_masses[0]))) {
00213       kplus = findPFermi(); //_pFermi->shoot();
00214       kplus = xlow + kplus*(xhigh-xlow);
00215     }
00216     qplus = mB-_mb-kplus;
00217     if( (mB-qplus)/2.<=ml)continue;
00218    
00219     int tryit = 1;
00220     while (tryit) {
00221       
00222       x = EvtRandom::Flat();
00223       z = EvtRandom::Flat(0,2);
00224       p2=EvtRandom::Flat();
00225       p2 = pow(10,lp2epsilon*p2);
00226       
00227       El = x*(mB-qplus)/2;
00228       if ( El > ml && El < mB/2) {
00229         
00230         Eh = z*(mB-qplus)/2+qplus;
00231         if ( Eh > 0 && Eh < mB ) {
00232           
00233           sh = p2*pow(mB-qplus,2)+2*qplus*(Eh-qplus)+qplus*qplus;
00234           if ( sh > _masses[0]*_masses[0]
00235                && mB*mB + sh - 2*mB*Eh > ml*ml) {
00236             
00237             double xran = EvtRandom::Flat();
00238             
00239             double y = _dGamma->getdGdxdzdp(x,z,p2)/_dGMax*p2;
00240             
00241             if ( y > 1 ) report(WARNING,"EvtGen")<<"EvtVub decay probability > 1 found: " << y << endl;
00242             if ( y >= xran ) tryit = 0;
00243           }
00244         }
00245       }
00246     }
00247     // reweight the Mx distribution
00248     if(_nbins>0){
00249       double xran1 = EvtRandom::Flat();
00250       double m = sqrt(sh);j=0;
00251       while ( j < _nbins && m > _masses[j] ) j++; 
00252       double w = _weights[j-1]; 
00253       if ( w >= xran1 ) rew = false;
00254     } else {
00255       rew = false;
00256     }
00257     
00258   }
00259 
00260   // o.k. we have the three kineamtic variables 
00261   // now calculate a flat cos Theta_H [-1,1] distribution of the 
00262   // hadron flight direction w.r.t the B flight direction 
00263   // because the B is a scalar and should decay isotropic.
00264   // Then chose a flat Phi_H [0,2Pi] w.r.t the B flight direction 
00265   // and and a flat Phi_L [0,2Pi] in the W restframe w.r.t the 
00266   // W flight direction.
00267 
00268   double ctH = EvtRandom::Flat(-1,1);
00269   double phH = EvtRandom::Flat(0,2*M_PI);
00270   double phL = EvtRandom::Flat(0,2*M_PI);
00271 
00272   // now compute the four vectors in the B Meson restframe
00273     
00274   double ptmp,sttmp;
00275   // calculate the hadron 4 vector in the B Meson restframe
00276 
00277   sttmp = sqrt(1-ctH*ctH);
00278   ptmp = sqrt(Eh*Eh-sh);
00279   double pHB[4] = {Eh,ptmp*sttmp*cos(phH),ptmp*sttmp*sin(phH),ptmp*ctH};
00280   p4.set(pHB[0],pHB[1],pHB[2],pHB[3]);
00281   xuhad->init( getDaug(0), p4);
00282 
00283   if (_storeQplus ) {
00284     // cludge to store the hidden parameter q+ with the decay; 
00285     // the lifetime of the Xu is abused for this purpose.
00286     // tau = 1 ps corresponds to ctau = 0.3 mm -> in order to
00287     // stay well below BaBars sensitivity we take q+/(10000 GeV) which 
00288     // goes up to 0.0005 in the most extreme cases as ctau in mm.
00289     // To extract q+ back from the StdHepTrk its necessary to get
00290     // delta_ctau = Xu->anyDaughter->getVertexTime()-Xu->getVertexTime()
00291     // where these pseudo calls refere to the StdHep time stored at
00292     // the production vertex in the lab for each particle. The boost 
00293     // has to be reversed and the result is:
00294     //
00295     // q+ = delta_ctau * 10000 GeV/mm * Mass_Xu/Energy_Xu     
00296     //
00297     xuhad->setLifetime(qplus/10000.);
00298   }
00299 
00300   // calculate the W 4 vector in the B Meson restrframe
00301 
00302   double apWB = ptmp;
00303   double pWB[4] = {mB-Eh,-pHB[1],-pHB[2],-pHB[3]};
00304 
00305   // first go in the W restframe and calculate the lepton and
00306   // the neutrino in the W frame
00307 
00308   double mW2   = mB*mB + sh - 2*mB*Eh;
00309   double beta  = ptmp/pWB[0];
00310   double gamma = pWB[0]/sqrt(mW2);
00311 
00312   double pLW[4];
00313     
00314   ptmp = (mW2-ml*ml)/2/sqrt(mW2);
00315   pLW[0] = sqrt(ml*ml + ptmp*ptmp);
00316 
00317   double ctL = (El - gamma*pLW[0])/beta/gamma/ptmp;
00318   if ( ctL < -1 ) ctL = -1;
00319   if ( ctL >  1 ) ctL =  1;
00320   sttmp = sqrt(1-ctL*ctL);
00321 
00322   // eX' = eZ x eW
00323   double xW[3] = {-pWB[2],pWB[1],0};
00324   // eZ' = eW
00325   double zW[3] = {pWB[1]/apWB,pWB[2]/apWB,pWB[3]/apWB};
00326   
00327   double lx = sqrt(xW[0]*xW[0]+xW[1]*xW[1]);
00328   for (j=0;j<2;j++) 
00329     xW[j] /= lx;
00330 
00331   // eY' = eZ' x eX'
00332   double yW[3] = {-pWB[1]*pWB[3],-pWB[2]*pWB[3],pWB[1]*pWB[1]+pWB[2]*pWB[2]};
00333   double ly = sqrt(yW[0]*yW[0]+yW[1]*yW[1]+yW[2]*yW[2]);
00334   for (j=0;j<3;j++) 
00335     yW[j] /= ly;
00336 
00337   // p_lep = |p_lep| * (  sin(Theta) * cos(Phi) * eX'
00338   //                    + sin(Theta) * sin(Phi) * eY'
00339   //                    + cos(Theta) *            eZ')
00340   for (j=0;j<3;j++)
00341     pLW[j+1] = sttmp*cos(phL)*ptmp*xW[j] 
00342       +        sttmp*sin(phL)*ptmp*yW[j]
00343       +          ctL         *ptmp*zW[j];
00344 
00345   double apLW = ptmp;
00346   // calculate the neutrino 4 vector in the W restframe
00347   //double pNW[4] = {sqrt(mW2)-pLW[0],-pLW[1],-pLW[2],-pLW[3]};
00348     
00349   // boost them back in the B Meson restframe
00350   
00351   double appLB = beta*gamma*pLW[0] + gamma*ctL*apLW;
00352  
00353   ptmp = sqrt(El*El-ml*ml);
00354   double ctLL = appLB/ptmp;
00355 
00356   if ( ctLL >  1 ) ctLL =  1;
00357   if ( ctLL < -1 ) ctLL = -1;
00358     
00359   double pLB[4] = {El,0,0,0};
00360   double pNB[4] = {pWB[0]-El,0,0,0};
00361 
00362   for (j=1;j<4;j++) {
00363     pLB[j] = pLW[j] + (ctLL*ptmp - ctL*apLW)/apWB*pWB[j];
00364     pNB[j] = pWB[j] - pLB[j];
00365   }
00366 
00367   p4.set(pLB[0],pLB[1],pLB[2],pLB[3]);
00368   lepton->init( getDaug(1), p4);
00369 
00370   p4.set(pNB[0],pNB[1],pNB[2],pNB[3]);
00371   neutrino->init( getDaug(2), p4);
00372 
00373   return ;
00374 }

void EvtDecayBase::disableCheckQ  )  [inline, inherited]
 

00062 {_chkCharge=0;};

void EvtDecayBase::findMass EvtParticle p  )  [static, inherited]
 

00347                                           {
00348 
00349   //Need to also check that this mass does not screw
00350   //up the parent
00351   //This code assumes that for the ith daughter, 0..i-1
00352   //already have a mass
00353   double maxOkMass=findMaxMass(p);
00354 
00355   int count=0;
00356   double mass;
00357   bool massOk=false;
00358   int i;
00359   while (!massOk) { 
00360     count++;
00361     if ( count > 10000 ) {
00362       report(INFO,"EvtGen") << "Can not find a valid mass for: " << EvtPDL::name(p->getId()).c_str() <<endl;
00363       report(INFO,"EvtGen") << "Now printing parent and/or grandparent tree\n";
00364       if ( p->getParent() ) {
00365         if ( p->getParent()->getParent() ) {
00366           p->getParent()->getParent()->printTree();
00367           report(INFO,"EvtGen") << p->getParent()->getParent()->mass() <<endl;
00368           report(INFO,"EvtGen") << p->getParent()->mass() <<endl;
00369         }
00370         else{
00371           p->getParent()->printTree();
00372           report(INFO,"EvtGen") << p->getParent()->mass() <<endl;
00373         }
00374       }
00375       else  p->printTree();
00376       report(INFO,"EvtGen") << "maxokmass=" << maxOkMass << " " << EvtPDL::getMinMass(p->getId()) << " " << EvtPDL::getMaxMass(p->getId())<<endl;
00377       if ( p->getNDaug() ) { 
00378         for (i=0; i<p->getNDaug(); i++) {
00379           report(INFO,"EvtGen") << p->getDaug(i)->mass()<<" ";
00380         }
00381         report(INFO,"EvtGen") << endl;
00382       }
00383       if ( maxOkMass >= EvtPDL::getMinMass(p->getId()) ) {
00384         report(INFO,"EvtGen") << "taking a default value\n";
00385         p->setMass(maxOkMass);
00386         return;
00387       } 
00388       assert(0);
00389     }
00390     mass = EvtPDL::getMass(p->getId());
00391     //Just need to check that this mass is > than
00392     //the mass of all daughters
00393     double massSum=0.;
00394     if ( p->getNDaug() ) { 
00395       for (i=0; i<p->getNDaug(); i++) {
00396         massSum+= p->getDaug(i)->mass();
00397       }
00398     }
00399     //some special cases are handled with 0 (stable) or 1 (k0->ks/kl) daughters
00400     if (p->getNDaug()<2)  massOk=true;
00401     if ( p->getParent() ) {
00402       if ( p->getParent()->getNDaug()==1 ) massOk=true;
00403     }
00404     if ( !massOk ) { 
00405       if (massSum < mass) massOk=true;
00406       if ( mass> maxOkMass) massOk=false;
00407     }
00408   }
00409 
00410   p->setMass(mass);
00411   
00412 }

void EvtDecayBase::findMasses EvtParticle p,
int  ndaugs,
EvtId  daugs[10],
double  masses[10]
[static, inherited]
 

00416                                                                      {
00417 
00418   int i;
00419   double mass_sum;
00420 
00421   int count=0;
00422 
00423   if (!( p->firstornot() )) {
00424     for (i = 0; i < ndaugs; i++ ) {
00425       masses[i] = p->getDaug(i)->mass();
00426     } //for
00427   } //if
00428   else {
00429     p->setFirstOrNot();
00430     // if only one daughter do it
00431 
00432     if (ndaugs==1) {
00433       masses[0]=p->mass();
00434       return;
00435     }
00436     
00437     //until we get a combo whose masses are less than _parent mass.
00438     do {
00439       mass_sum = 0.0;
00440 
00441       for (i = 0; i < ndaugs; i++ ) {
00442         masses[i] = EvtPDL::getMass(daugs[i]);
00443         mass_sum = mass_sum + masses[i];
00444       } 
00445 
00446       count++;
00447 
00448      
00449       if(count==10000) {
00450         report(ERROR,"EvtGen") <<"Decaying particle:"<<
00451           EvtPDL::name(p->getId()).c_str()<<" (m="<<p->mass()<<")"<<endl;
00452         report(ERROR,"EvtGen") <<"To the following daugthers"<<endl;
00453         for (i = 0; i < ndaugs; i++ ) {
00454           report(ERROR,"EvtGen") <<  
00455             EvtPDL::name(daugs[i]).c_str() << endl;
00456         } 
00457         report(ERROR,"EvtGen") << "Has been rejected "<<count
00458                                << " times, will now take minimal masses "
00459                                << " of daugthers"<<endl;
00460         
00461         mass_sum=0.;
00462         for (i = 0; i < ndaugs; i++ ) {
00463           masses[i] = EvtPDL::getMinMass(daugs[i]);
00464           mass_sum = mass_sum + masses[i];
00465         } 
00466         if (mass_sum > p->mass()){
00467           report(ERROR,"EvtGen") << "Parent mass="<<p->mass()
00468                                  << "to light for daugthers."<<endl
00469                                  << "Will throw the event away."<<endl;
00470           //dont terminate - start over on the event.
00471           EvtStatus::setRejectFlag();
00472           mass_sum=0.;
00473           //      ::abort();
00474         }
00475 
00476       }
00477     } while ( mass_sum > p->mass());
00478   } //else
00479   
00480   return;
00481 }       

double EvtDecayBase::findMaxMass EvtParticle p  )  [static, inherited]
 

00312                                                {
00313 
00314   
00315   double maxOkMass=EvtPDL::getMaxMass(p->getId());
00316 
00317   //protect against vphotons
00318   if ( maxOkMass < 0.0000000001 ) return 10000000.;
00319   //and against already determined masses
00320   if ( p->hasValidP4() ) maxOkMass=p->mass();
00321 
00322   EvtParticle *par=p->getParent();
00323   if ( par ) {
00324     double maxParMass=findMaxMass(par);
00325     int i;
00326     double minDaugMass=0.;
00327     for(i=0;i<par->getNDaug();i++){
00328       EvtParticle *dau=par->getDaug(i);
00329       if ( dau!=p) {
00330         // it might already have a mass
00331         if ( dau->isInitialized() || dau->hasValidP4() )
00332           minDaugMass+=dau->mass();
00333         else
00334         //give it a bit of phase space 
00335           minDaugMass+=1.000001*EvtPDL::getMinMass(dau->getId());
00336       }
00337     }
00338     if ( maxOkMass>(maxParMass-minDaugMass)) maxOkMass=maxParMass-minDaugMass;
00339   }
00340   return maxOkMass;
00341 }

double EvtVub::findPFermi  )  [private]
 

00377                           {
00378 
00379   double ranNum=EvtRandom::Flat();
00380   double oOverBins= 1.0/(float(_pf.size()));
00381   int nBinsBelow = 0;     // largest k such that I[k] is known to be <= rand
00382   int nBinsAbove = _pf.size();  // largest k such that I[k] is known to be >  rand
00383   int middle;
00384   
00385   while (nBinsAbove > nBinsBelow+1) {
00386     middle = (nBinsAbove + nBinsBelow+1)>>1;
00387     if (ranNum >= _pf[middle]) {
00388       nBinsBelow = middle;
00389     } else {
00390       nBinsAbove = middle;
00391     }
00392   } 
00393 
00394   double bSize = _pf[nBinsAbove] - _pf[nBinsBelow];
00395   // binMeasure is always aProbFunc[nBinsBelow], 
00396   
00397   if ( bSize == 0 ) { 
00398     // rand lies right in a bin of measure 0.  Simply return the center
00399     // of the range of that bin.  (Any value between k/N and (k+1)/N is 
00400     // equally good, in this rare case.)
00401     return (nBinsBelow + .5) * oOverBins;
00402   }
00403   
00404   HepDouble bFract = (ranNum - _pf[nBinsBelow]) / bSize;
00405   
00406   return (nBinsBelow + bFract) * oOverBins;
00407 
00408 } 

double EvtDecayBase::getArg int  j  )  [inherited]
 

00565                                  {
00566 
00567   // Verify string
00568 
00569   const char* str = _args[j].c_str();
00570   int i = 0;
00571   while(str[i]!=0){
00572     if (isalpha(str[i]) && str[i]!='e') {
00573 
00574       report(INFO,"EvtGen") << "String " << str << " is not a number" << endl;
00575       assert(0);
00576     }
00577     i++;
00578   }
00579   
00580   char** tc=0; 
00581   return strtod(_args[j].c_str(),tc);
00582 }

double * EvtDecayBase::getArgs  )  [inherited]
 

00548                               {
00549 
00550   if ( _argsD ) return _argsD;
00551   //The user has asked for a list of doubles - the arguments 
00552   //better all be doubles...
00553   if ( _narg==0 ) return _argsD;
00554 
00555   _argsD = new double[_narg];
00556 
00557   int i;
00558   char * tc;
00559   for(i=0;i<_narg;i++) { 
00560     _argsD[i] =  strtod(_args[i].c_str(),&tc);
00561   }
00562   return _argsD;
00563 }

std::string* EvtDecayBase::getArgsStr  )  [inline, inherited]
 

00073 {return _args;}

std::string EvtDecayBase::getArgStr int  j  )  [inline, inherited]
 

00075 {return _args[j];}

double EvtDecayBase::getBranchingFraction  )  [inline, inherited]
 

00061 {return _brfr;}

EvtId EvtDecayBase::getDaug int  i  )  [inline, inherited]
 

00066 {return _daug[i];}

EvtId* EvtDecayBase::getDaugs  )  [inline, inherited]
 

00065 {return _daug;}

int EvtDecayBase::getDSum  )  [inline, inherited]
 

00077 {return _dsum; }

std::string EvtDecayBase::getModelName  )  [inline, inherited]
 

00076 {return _modelname; }

void EvtVub::getName std::string &  name  )  [virtual]
 

Implements EvtDecayBase.

00049                                          {
00050 
00051   model_name="VUB";     
00052 
00053 }

int EvtDecayBase::getNArg  )  [inline, inherited]
 

00067 {return _narg;}

int EvtDecayBase::getNDaug  )  [inline, inherited]
 

00064 {return _ndaug;}

EvtId EvtDecayBase::getParentId  )  [inline, inherited]
 

00060 {return _parent;}

int EvtDecayBase::getPHOTOS  )  [inline, inherited]
 

00068 {return _photos;}

double EvtDecayBase::getProbMax double  prob  )  [inherited]
 

00067                                              {
00068 
00069   int i;
00070 
00071   //diagnostics
00072   sum_prob+=prob;
00073   if (prob>max_prob) max_prob=prob;
00074 
00075 
00076   if ( defaultprobmax && ntimes_prob<=500 ) { 
00077     //We are building up probmax with this iteration
00078      ntimes_prob += 1;
00079      if ( prob > probmax ) { probmax = prob;}
00080      if (ntimes_prob==500) { 
00081        probmax*=1.2;
00082      }
00083      return 1000000.0*prob;
00084   }
00085 
00086   if ( prob> probmax*1.0001) {
00087 
00088     report(INFO,"EvtGen") << "prob > probmax:("<<prob<<">"<<probmax<<")";
00089     report(INFO,"") << "("<<_modelname.c_str()<<") ";
00090     report(INFO,"") << EvtPDL::name(_parent).c_str()<<" -> ";
00091     for(i=0;i<_ndaug;i++){
00092        report(INFO,"") << EvtPDL::name(_daug[i]).c_str() << " ";
00093     }
00094     report(INFO,"") << endl;
00095 
00096     if (defaultprobmax) probmax = prob;
00097 
00098   }
00099 
00100   ntimes_prob += 1;
00101 
00102 
00103   return probmax;
00104 
00105 } //getProbMax

void EvtVub::init  )  [virtual]
 

Reimplemented from EvtDecayBase.

00062                  {
00063 
00064   // check that there are at least 6 arguments
00065 
00066   if (getNArg()<6) {
00067 
00068     report(ERROR,"EvtGen") << "EvtVub generator expected "
00069                            << " at least 6 arguments (mb,a,alpha_s,Nbins,m1,w1,...) but found: "
00070                            <<getNArg()<<endl;
00071     report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
00072     ::abort();
00073 
00074   }
00075   
00076   _mb           = getArg(0);
00077   _a            = getArg(1);
00078   _alphas       = getArg(2);
00079   _nbins        = abs((int)getArg(3));
00080   _storeQplus   = (getArg(3)<0?1:0);
00081   _masses       = new double[_nbins];
00082   _weights      = new double[_nbins];
00083  
00084   if (getNArg()-4 != 2*_nbins) {
00085     report(ERROR,"EvtGen") << "EvtVub generator expected " 
00086                            << _nbins << " masses and weights but found: "
00087                            <<(getNArg()-4)/2 <<endl;
00088     report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
00089     ::abort();
00090   }
00091   int i,j = 4;
00092   double maxw = 0.;
00093   for (i=0;i<_nbins;i++) {
00094     _masses[i] = getArg(j++);
00095     if (i>0 && _masses[i] <= _masses[i-1]) {
00096       report(ERROR,"EvtGen") << "EvtVub generator expected " 
00097                              << " mass bins in ascending order!"
00098                              << "Will terminate execution!"<<endl;
00099       ::abort();
00100     }
00101     _weights[i] = getArg(j++);
00102     if (_weights[i] < 0) {
00103       report(ERROR,"EvtGen") << "EvtVub generator expected " 
00104                              << " weights >= 0, but found: " 
00105                              <<_weights[i] <<endl;
00106       report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
00107       ::abort();
00108     }
00109     if ( _weights[i] > maxw ) maxw = _weights[i];
00110   }
00111   if (maxw == 0) {
00112     report(ERROR,"EvtGen") << "EvtVub generator expected at least one " 
00113                            << " weight > 0, but found none! " 
00114                            << "Will terminate execution!"<<endl;
00115     ::abort();
00116   }
00117   for (i=0;i<_nbins;i++) _weights[i]/=maxw;
00118 
00119   // the maximum dGamma*p2 value depends on alpha_s only:
00120 
00121   const double dGMax0 = 3.;
00122   _dGMax = 0.21344+8.905*_alphas;
00123   if ( _dGMax < dGMax0 ) _dGMax = dGMax0;
00124 
00125   // for the Fermi Motion we need a B-Meson mass - but it's not critical
00126   // to get an exact value; in order to stay in the phase space for
00127   // B+- and B0 use the smaller mass
00128 
00129   EvtId BP=EvtPDL::getId("B+");
00130   EvtId B0=EvtPDL::getId("B0");
00131   
00132   double mB0 = EvtPDL::getMaxMass(B0);
00133   double mBP = EvtPDL::getMaxMass(BP);
00134 
00135   double mB = (mB0<mBP?mB0:mBP);
00136   
00137   const double xlow = -_mb;
00138   const double xhigh = mB-_mb;
00139   const int aSize = 10000;
00140 
00141   EvtPFermi pFermi(_a,mB,_mb);
00142   // pf is the cumulative distribution
00143   // normalized to 1.
00144   _pf.resize(aSize);
00145   for(i=0;i<aSize;i++){
00146     double kplus = xlow + (double)(i+0.5)/((double)aSize)*(xhigh-xlow);
00147     if ( i== 0 )
00148       _pf[i] = pFermi.getFPFermi(kplus);
00149     else
00150       _pf[i] = _pf[i-1] + pFermi.getFPFermi(kplus);
00151   }
00152   for (i=0; i<_pf.size(); i++) _pf[i]/=_pf[_pf.size()-1];
00153 
00154   //  static EvtHepRandomEngine myEngine;
00155 
00156   //  _pFermi = new RandGeneral(myEngine,pf,aSize,0);
00157   _dGamma = new EvtVubdGamma(_alphas);
00158   
00159   // check that there are 3 daughters
00160   checkNDaug(3);
00161 }

void EvtVub::initProbMax  )  [virtual]
 

Reimplemented from EvtDecayBase.

00163                         {
00164 
00165   noProbMax();
00166 
00167 }

int EvtDecayIncoherent::isDaughterSpinDensitySet int  daughter  )  [inline, inherited]
 

00041   {return spinDensitySet[daughter];}

void EvtDecayIncoherent::makeDecay EvtParticle p  )  [virtual, inherited]
 

Implements EvtDecayBase.

00030                                                 {
00031 
00032   int i;
00033   //initialize this the hard way..
00034   //Lange June 26, 2000
00035   for (i=0; i<MAX_DAUG; i++ ) { spinDensitySet[i]=0;}
00036   _daugsDecayedByParentModel=false;
00037 
00038   decay(p);
00039   p->setDecayProb(1.);
00040 
00041   EvtSpinDensity rho;
00042 
00043   rho.SetDiag(p->getSpinStates());
00044 
00045   p->setSpinDensityBackward(rho);
00046 
00047   if (getPHOTOS() || EvtRadCorr::alwaysRadCorr()) {
00048     EvtRadCorr::doRadCorr(p);
00049   }
00050 
00051   //Now decay the daughters.
00052 
00053   if ( !daugsDecayedByParentModel()) {
00054     
00055     for(i=0;i<p->getNDaug();i++){
00056       //Need to set the spin density of the daughters to be
00057       //diagonal.
00058       rho.SetDiag(p->getDaug(i)->getSpinStates());
00059       //if (p->getDaug(i)->getNDaug()==0){
00060       //only do this if the user has not already set the 
00061       //spin density matrix herself.
00062       //Lange June 26, 2000
00063       if ( isDaughterSpinDensitySet(i)==0 ) { 
00064         p->getDaug(i)->setSpinDensityForward(rho);
00065       }
00066       else{
00067         //report(INFO,"EvtGen") << "spinDensitymatrix already set!!!\n";
00068         EvtSpinDensity temp=p->getDaug(i)->getSpinDensityForward();
00069         //      report(INFO,"EvtGen") <<temp<<endl;
00070       }
00071       //Now decay the daughter.  Really!
00072       p->getDaug(i)->decay();
00073       //}
00074     } 
00075   }
00076                             
00077 }

bool EvtDecayBase::matchingDecay const EvtDecayBase other  )  const [virtual, inherited]
 

00588                                                                 {
00589 
00590   if ( _ndaug != other._ndaug) return false;
00591   if ( _parent != other._parent) return false;
00592   
00593   std::vector<int> useDs;
00594   for ( unsigned int i=0; i<_ndaug; i++) useDs.push_back(0);
00595 
00596   for ( unsigned int i=0; i<_ndaug; i++) {
00597     bool foundIt=false;
00598     for ( unsigned int j=0; j<_ndaug; j++) {
00599       if ( useDs[j] == 1 ) continue;
00600       if ( _daug[i] == other._daug[j] && _daug[i].getAlias() == other._daug[j].getAlias()) {
00601         foundIt=true;
00602         useDs[j]=1;
00603         break;
00604       }
00605     }
00606     if ( foundIt==false) return false;
00607   }
00608   for ( unsigned int i=0; i<_ndaug; i++) if ( useDs[i]==0) return false;
00609 
00610   return true;
00611 
00612 }

void EvtDecayBase::noProbMax  )  [inherited]
 

00305                             {
00306 
00307   defaultprobmax=0;
00308 
00309 }

virtual int EvtDecayBase::nRealDaughters  )  [inline, virtual, inherited]
 

Reimplemented in EvtBtoKD3P, and EvtVSSBMixCPT.

00105 { return _ndaug;}

void EvtDecayBase::printSummary  )  [inherited]
 

00259                                 {
00260 
00261   int i;
00262 
00263   if (ntimes_prob>0) {
00264 
00265     report(INFO,"EvtGen") << "Calls="<<ntimes_prob<<" eff:"<<
00266       sum_prob/(probmax*ntimes_prob)<<" frac. max:"<<max_prob/probmax;
00267     report(INFO,"") <<" probmax:"<<probmax<<" max:"<<max_prob<<" : ";
00268   }
00269 
00270   report(INFO,"") << EvtPDL::name(_parent).c_str()<<" -> ";
00271   for(i=0;i<_ndaug;i++){
00272     report(INFO,"") << EvtPDL::name(_daug[i]).c_str() << " ";
00273   }
00274   report(INFO,"") << " ("<<_modelname.c_str()<<"):"<< endl;
00275   
00276   
00277   
00278 }

double EvtDecayBase::resetProbMax double  prob  )  [inherited]
 

00108                                              {
00109   
00110   report(INFO,"EvtGen") << "Reseting prob max\n"; 
00111   report(INFO,"EvtGen") << "prob > probmax:("<<prob<<">"<<probmax<<")";
00112   report(INFO,"") << "("<<_modelname.c_str()<<")";
00113   report(INFO,"") << EvtPDL::getStdHep(_parent)<<"->";
00114   
00115   for( int i=0;i<_ndaug;i++){
00116     report(INFO,"") << EvtPDL::getStdHep(_daug[i]) << " ";
00117   }
00118   report(INFO,"") << endl;
00119   
00120   probmax = 0.0;
00121   defaultprobmax = 0;
00122   ntimes_prob = 0;
00123   
00124   return prob;
00125 
00126 }

void EvtDecayBase::saveDecayInfo EvtId  ipar,
int  ndaug,
EvtId daug,
int  narg,
std::vector< std::string > &  args,
std::string  name,
double  brfr
[inherited]
 

00170                                               {
00171 
00172   int i;
00173 
00174   _brfr=brfr;
00175   _ndaug=ndaug;
00176   _narg=narg;
00177   _parent=ipar; 
00178 
00179   _dsum=0;
00180 
00181   if (_ndaug>0) {
00182     _daug=new EvtId [_ndaug];
00183     for(i=0;i<_ndaug;i++){
00184       _daug[i]=daug[i];
00185       _dsum+=daug[i].getAlias();
00186     }
00187   }
00188   else{
00189     _daug=0;
00190   }
00191 
00192   if (_narg>0) {
00193     _args=new std::string[_narg+1];
00194     for(i=0;i<_narg;i++){
00195       _args[i]=args[i];
00196     }
00197   }
00198   else{
00199      _args = 0;
00200   }
00201 
00202   _modelname=name;
00203 
00204   this->init();
00205   this->initProbMax();
00206 
00207   if (_chkCharge){
00208     this->checkQ();
00209   }
00210 
00211 
00212   if (defaultprobmax){
00213     report(INFO,"EvtGen") << "No default probmax for ";
00214     report(INFO,"") << "("<<_modelname.c_str()<<") ";
00215     report(INFO,"") << EvtPDL::name(_parent).c_str()<<" -> ";
00216     for(i=0;i<_ndaug;i++){
00217       report(INFO,"") << EvtPDL::name(_daug[i]).c_str() << " ";
00218     }
00219     report(INFO,"") << endl;
00220     report(INFO,"") << "This is fine for development, but must be provided for production."<<endl;
00221     report(INFO,"EvtGen") << "Never fear though - the decay will use the \n";
00222     report(INFO,"EvtGen") << "500 iterations to build up a good probmax \n";
00223     report(INFO,"EvtGen") << "before accepting a decay. "<<endl;
00224   }
00225 
00226 }

void EvtDecayIncoherent::setDaughterSpinDensity int  daughter  )  [inline, inherited]
 

00038   { spinDensitySet[daughter]=1; return;}

void EvtDecayBase::setPHOTOS  )  [inline, inherited]
 

00069 {_photos=1;}

void EvtDecayBase::setProbMax double  prbmx  )  [inherited]
 

00298                                          {
00299 
00300   defaultprobmax=0;
00301   probmax=prbmx;
00302 
00303 }

void EvtDecayBase::setSummary  )  [inline, inherited]
 

00071 {_summary=1;}

void EvtDecayBase::setVerbose  )  [inline, inherited]
 

00070 {_verbose=1;}

int EvtDecayBase::summary  )  [inline, inherited]
 

00078 {return _summary; }

int EvtDecayBase::verbose  )  [inline, inherited]
 

00079 {return _verbose; }


Member Data Documentation

double EvtVub::_a [private]
 

double EvtVub::_alphas [private]
 

bool EvtDecayBase::_daugsDecayedByParentModel [protected, inherited]
 

EvtVubdGamma* EvtVub::_dGamma [private]
 

double EvtVub::_dGMax [private]
 

double* EvtVub::_masses [private]
 

double EvtVub::_mb [private]
 

int EvtVub::_nbins [private]
 

std::vector<double> EvtVub::_pf [private]
 

int EvtVub::_storeQplus [private]
 

double* EvtVub::_weights [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:13:15 2011 for BOSS6.5.5 by  doxygen 1.3.9.1