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

EvtPythia Class Reference

#include <EvtPythia.hh>

Inheritance diagram for EvtPythia:

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 ()
void command (std::string cmd)
std::string commandName ()
void decay (EvtParticle *p)
void disableCheckQ ()
 EvtPythia ()
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 ~EvtPythia ()

Static Public Member Functions

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

Protected Member Functions

bool daugsDecayedByParentModel ()

Protected Attributes

bool _daugsDecayedByParentModel

Private Member Functions

void fixPolarizations (EvtParticle *p)
void store (EvtDecayBase *jsdecay)

Static Private Member Functions

bool diquark (int)
void MakePythiaFile (char *fname)
double NominalMass (int)
void WritePythiaEntryHeader (std::ofstream &outdec, int lundkc, EvtId evtnum, std::string name, int chg, int cchg, int spin2, double mass, double width, double maxwidth, double ctau, int stable, double rawbrfrsum)
void WritePythiaParticle (std::ofstream &outdec, EvtId ipar, EvtId iparname, int &first)

Static Private Attributes

std::string * commands = 0
EvtDecayBasePtrjetsetdecays = 0
int lcommand = 0
int ncommand = 0
int njetsetdecays = 0
int ntable = 0

Constructor & Destructor Documentation

EvtPythia::EvtPythia  ) 
 

00091 {}

EvtPythia::~EvtPythia  )  [virtual]
 

00093                      {
00094 
00095 
00096   int i;
00097 
00098 
00099   //the deletion of commands is really uggly!
00100 
00101   if (njetsetdecays==0) {
00102     delete [] commands;
00103     commands=0;
00104     return;
00105   }
00106 
00107   for(i=0;i<njetsetdecays;i++){
00108     if (jetsetdecays[i]==this){
00109       jetsetdecays[i]=jetsetdecays[njetsetdecays-1];
00110       njetsetdecays--;
00111       if (njetsetdecays==0) {
00112         delete [] commands;
00113         commands=0;
00114       }
00115       return;
00116     }
00117   }
00118 
00119   report(ERROR,"EvtGen") << "Error in destroying Pythia model!"<<endl;
00120  
00121 }


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 * EvtPythia::clone  )  [virtual]
 

Implements EvtDecayBase.

00130                               {
00131 
00132   return new EvtPythia;
00133 
00134 }

void EvtPythia::command std::string  cmd  )  [virtual]
 

Reimplemented from EvtDecayBase.

00174                                     {
00175 
00176   if (ncommand==lcommand){
00177 
00178     lcommand=10+2*lcommand;
00179 
00180     std::string* newcommands=new std::string[lcommand];
00181     
00182     int i;
00183 
00184     for(i=0;i<ncommand;i++){
00185       newcommands[i]=commands[i];
00186     }
00187     
00188     delete [] commands;
00189 
00190     commands=newcommands;
00191 
00192   }
00193 
00194   commands[ncommand]=cmd;
00195 
00196   ncommand++;
00197 
00198 }

std::string EvtPythia::commandName  )  [virtual]
 

Reimplemented from EvtDecayBase.

00167                                 {
00168 
00169   return std::string("JetSetPar");
00170   
00171 }

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

00111 {return _daugsDecayedByParentModel;}

void EvtPythia::decay EvtParticle p  )  [virtual]
 

Implements EvtDecayBase.

00208                                     {
00209   
00210   
00211   //added by Lange Jan4,2000
00212   static EvtId STRNG=EvtPDL::getId("string");
00213   
00214   int istdheppar=EvtPDL::getStdHep(p->getId());
00215   
00216   if (pycomp_(&istdheppar)==0){
00217     report(ERROR,"EvtGen") << "Pythia can not decay:"
00218       <<EvtPDL::name(p->getId()).c_str()<<endl;
00219     //    return;  //comment by Ping RG, due not to decay eta_c(2S)
00220   }
00221   
00222   double mp=p->mass();
00223   
00224   EvtVector4R p4[20];
00225   
00226   int i,more;
00227   int ip=EvtPDL::getStdHep(p->getId());
00228   int ndaugjs;
00229   int kf[100];
00230   EvtId evtnumstable[100],evtnumparton[100];
00231   int stableindex[100],partonindex[100];
00232   int numstable;
00233   int numparton;
00234   int km[100];
00235   EvtId type[MAX_DAUG];
00236   
00237   pythiaInit(0);
00238   
00239   double px[100],py[100],pz[100],e[100];
00240   if ( p->getNDaug() != 0 ) { p->deleteDaughters(true);}
00241   
00242   int count=0;
00243 
00244   do{
00245     
00246     pythiadec_(&ip,&mp,&ndaugjs,kf,km,px,py,pz,e);
00247     
00248     
00249     numstable=0;
00250     numparton=0;
00251     
00252     for(i=0;i<ndaugjs;i++){
00253       
00254       if (EvtPDL::evtIdFromStdHep(kf[i])==EvtId(-1,-1)) {
00255         report(ERROR,"EvtGen") << "Pythia returned particle:"<<kf[i]<<endl;
00256         report(ERROR,"EvtGen") << "This can not be translated to evt number"<<endl;
00257         report(ERROR,"EvtGen") << "and the decay will be rejected!"<<endl;
00258         report(ERROR,"EvtGen") << "The decay was of particle:"<<ip<<endl;
00259         int i=1;
00260         pylist_(i);
00261       }
00262 
00263       //sort out the partons
00264       if (abs(kf[i])<=6||kf[i]==21){
00265         partonindex[numparton]=i;
00266         evtnumparton[numparton]=EvtPDL::evtIdFromStdHep(kf[i]);
00267         numparton++;
00268       }
00269       else{
00270         stableindex[numstable]=i;
00271         evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(kf[i]); 
00272         numstable++;
00273       }
00274       
00275       
00276       // have to protect against negative mass^2 for massless particles
00277       // i.e. neutrinos and photons.
00278       // this is uggly but I need to fix it right now....
00279       
00280       if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i]){
00281         
00282         e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000000001;
00283         
00284       }
00285       
00286       p4[i].set(e[i],px[i],py[i],pz[i]);
00287       
00288       
00289     }
00290     
00291     int channel=EvtDecayTable::inChannelList(p->getId(),numstable,evtnumstable);
00292     
00293     
00294    more=(channel!=-1);
00295    
00296    
00297    
00298    
00299    count++;
00300    
00301   }while( more && (count<10000) );
00302   
00303   if (count>9999) {
00304     report(INFO,"EvtGen") << "Too many loops in EvtPythia!!!"<<endl;
00305     report(INFO,"EvtGen") << "Parent:"<<EvtPDL::name(getParentId()).c_str()<<endl;
00306     for(i=0;i<numstable;i++){
00307       report(INFO,"EvtGen") << "Daug("<<i<<")"<<EvtPDL::name(evtnumstable[i]).c_str()<<endl;
00308     }
00309     
00310   }
00311   
00312   
00313   
00314   if (numparton==0){
00315     
00316     p->makeDaughters(numstable,evtnumstable);
00317     
00318     for(i=0;i<numstable;i++){
00319       p->getDaug(i)->init(evtnumstable[i],p4[stableindex[i]]);
00320     }
00321     
00322     fixPolarizations(p);
00323     
00324     return ;
00325    
00326   }
00327   else{
00328     
00329     //have partons in JETSET
00330     
00331     EvtVector4R p4string(0.0,0.0,0.0,0.0);
00332     
00333     for(i=0;i<numparton;i++){
00334       p4string+=p4[partonindex[i]];
00335     }
00336     
00337     int nprimary=1;
00338     type[0]=STRNG;
00339     for(i=0;i<numstable;i++){
00340       if (km[stableindex[i]]==0){
00341         type[nprimary++]=evtnumstable[i];
00342       }
00343     }
00344     
00345     p->makeDaughters(nprimary,type);
00346     
00347     p->getDaug(0)->init(STRNG,p4string);
00348     
00349     EvtVector4R p4partons[10];
00350     
00351     for(i=0;i<numparton;i++){
00352       p4partons[i]=p4[partonindex[i]];
00353     }
00354     
00355     ((EvtStringParticle*)p->getDaug(0))->initPartons(numparton,p4partons,evtnumparton);
00356     
00357     
00358     
00359     nprimary=1;
00360     
00361     for(i=0;i<numstable;i++){
00362       
00363       if (km[stableindex[i]]==0){
00364         p->getDaug(nprimary++)->init(evtnumstable[i],p4[stableindex[i]]);
00365       }
00366     }
00367     
00368     
00369     int nsecond=0;
00370     for(i=0;i<numstable;i++){
00371       if (km[stableindex[i]]!=0){
00372         type[nsecond++]=evtnumstable[i];
00373       }
00374     }
00375     
00376     
00377     p->getDaug(0)->makeDaughters(nsecond,type);
00378     
00379     nsecond=0;
00380     for(i=0;i<numstable;i++){
00381       if (km[stableindex[i]]!=0){
00382         p4[stableindex[i]]=boostTo(p4[stableindex[i]],p4string);
00383         p->getDaug(0)->getDaug(nsecond)->init(evtnumstable[i],p4[stableindex[i]]);
00384         p->getDaug(0)->getDaug(nsecond)->setDiagonalSpinDensity();
00385         p->getDaug(0)->getDaug(nsecond)->decay();
00386         nsecond++;
00387       }
00388     }
00389     
00390     fixPolarizations(p);
00391     
00392     return ;
00393     
00394   }
00395 
00396 }

bool EvtPythia::diquark int   )  [static, private]
 

00768 {
00769   switch(ID)
00770     {
00771     case 1103:
00772     case 2101:
00773     case 2103:
00774     case 2203:
00775     case 3101:
00776     case 3103:
00777     case 3201:
00778     case 3203:
00779     case 3303:
00780     case 4101:
00781     case 4103:
00782     case 4201:
00783     case 4203:
00784     case 4301:
00785     case 4303:
00786     case 4403:
00787     case 5101:
00788     case 5103:
00789     case 5201:
00790     case 5203:
00791     case 5301:
00792     case 5303:
00793     case 5401:
00794     case 5403:
00795     case 5503:
00796       return true;
00797       break;
00798     default:
00799       return false;
00800       break;
00801     }
00802 }

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 }

void EvtPythia::fixPolarizations EvtParticle p  )  [private]
 

00398                                               {
00399 
00400   //special case for now to handle the J/psi polarization
00401 
00402   int ndaug=p->getNDaug();
00403   
00404   int i;
00405 
00406   static EvtId Jpsi=EvtPDL::getId("J/psi");
00407 
00408   for(i=0;i<ndaug;i++){
00409     if(p->getDaug(i)->getId()==Jpsi){
00410   
00411       EvtSpinDensity rho;
00412       
00413       rho.SetDim(3);
00414       rho.Set(0,0,0.5);
00415       rho.Set(0,1,0.0);
00416       rho.Set(0,2,0.0);
00417 
00418       rho.Set(1,0,0.0);
00419       rho.Set(1,1,1.0);
00420       rho.Set(1,2,0.0);
00421 
00422       rho.Set(2,0,0.0);
00423       rho.Set(2,1,0.0);
00424       rho.Set(2,2,0.5);
00425 
00426       EvtVector4R p4Psi=p->getDaug(i)->getP4();
00427 
00428       double alpha=atan2(p4Psi.get(2),p4Psi.get(1));
00429       double beta=acos(p4Psi.get(3)/p4Psi.d3mag());
00430 
00431 
00432       p->getDaug(i)->setSpinDensityForwardHelicityBasis(rho,alpha,beta,0.0);
00433       setDaughterSpinDensity(i);
00434 
00435     }
00436   }
00437 
00438 }

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 EvtPythia::getName std::string &  name  )  [virtual]
 

Implements EvtDecayBase.

00124                                             {
00125 
00126   model_name="PYTHIA";     
00127 
00128 }

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 EvtPythia::init  )  [virtual]
 

Reimplemented from EvtDecayBase.

00144                     {
00145 
00146   checkNArg(1);
00147 
00148 
00149   if (getParentId().isAlias()){
00150 
00151     report(ERROR,"EvtGen") << "EvtPythia finds that you are decaying the"<<endl
00152                            << " aliased particle "
00153                            << EvtPDL::name(getParentId()).c_str()
00154                            << " with the Pythia model"<<endl
00155                            << " this does not work, please modify decay table."
00156                            << endl;
00157     report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
00158     ::abort();
00159 
00160   }
00161 
00162   store(this);
00163 
00164 }

void EvtPythia::initProbMax  )  [virtual]
 

Reimplemented from EvtDecayBase.

00137                            {
00138 
00139   noProbMax();
00140 
00141 }

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 }

void EvtPythia::MakePythiaFile char *  fname  )  [static, private]
 

00930                                          {
00931   
00932   EvtId ipar;
00933   int lundkc;
00934   
00935   //int part_list[MAX_PART];
00936   
00937   ofstream outdec;
00938   
00939   outdec.open(fname);
00940   
00941   //outdec << "ERROR;"<<endl;
00942   //outdec << ";"<<endl;
00943   //outdec << ";This decayfile has been automatically created by"<<endl;
00944   //outdec << ";EvtGen from the DECAY.DEC file"<<endl;
00945   //outdec << ";"<<endl;
00946   
00947   int nokcentry;
00948   
00949   for(lundkc=1;lundkc<500;lundkc++){
00950     
00951     nokcentry=1;
00952     
00953     int iipar;
00954     
00955     for(iipar=0;iipar<EvtPDL::entries();iipar++){
00956       
00957       ipar=EvtId(iipar,iipar);
00958       //no aliased particles!
00959       std::string tempStr = EvtPDL::name(ipar);
00960       EvtId realId = EvtPDL::getId(tempStr);
00961       if ( realId.isAlias() != 0 ) continue;
00962       
00963       if(!(
00964                EvtPDL::getStdHep(ipar)==21 ||
00965                EvtPDL::getStdHep(ipar)==22 ||
00966                EvtPDL::getStdHep(ipar)==23))
00967         {
00968           
00969           if (lundkc==EvtPDL::getLundKC(ipar)){
00970             
00971             nokcentry=0;
00972             
00973             int first=1;
00974             
00975             WritePythiaParticle(outdec,ipar,ipar,first);
00976             
00977             
00978             EvtId ipar2=EvtPDL::chargeConj(ipar);
00979             
00980             
00981             if (ipar2!=ipar){
00982               WritePythiaParticle(outdec,ipar2,ipar,first);
00983             }
00984             
00985             if (first){
00986               WritePythiaEntryHeader(outdec, 
00987                                      //EvtPDL::getLundKC(ipar),
00988                                      EvtPDL::getStdHep(ipar),
00989                                      ipar,
00990                                      EvtPDL::name(ipar),
00991                                      EvtPDL::chg3(ipar),
00992                                      0,0,EvtPDL::getMeanMass(ipar),
00993                                      EvtPDL::getWidth(ipar),
00994                                      EvtPDL::getMeanMass(ipar)-EvtPDL::getMinMass(ipar),
00995                                      EvtPDL::getctau(ipar),0,0.0);
00996               
00997             }
00998           }
00999         }
01000     }
01001     if (lundkc==99999) // Write out diquarks after quarks, but only once
01002       for(iipar=0;iipar<EvtPDL::entries();iipar++){
01003         
01004         ipar=EvtId(iipar,iipar);
01005         
01006         if (diquark(EvtPDL::getStdHep(ipar))){
01007           
01008           nokcentry=0;
01009           
01010           int first=1;
01011           
01012           WritePythiaParticle(outdec,ipar,ipar,first);
01013           
01014           
01015           EvtId ipar2=EvtPDL::chargeConj(ipar);
01016           
01017           
01018           if (ipar2!=ipar){
01019             WritePythiaParticle(outdec,ipar2,ipar,first);
01020           }
01021           
01022           if (first){
01023             WritePythiaEntryHeader(outdec, 
01024                                    EvtPDL::getStdHep(ipar),
01025                                    ipar,
01026                                    EvtPDL::name(ipar),
01027                                    NominalCharge(EvtPDL::getStdHep(ipar)),
01028                                    -1,0,
01029                                    NominalMass(EvtPDL::getStdHep(ipar)),
01030                                    0, 0, 0, 0,0.0);
01031             
01032           }
01033         }
01034       }
01035     /* if (nokcentry){
01036        
01037        WritePythiaEntryHeader(outdec, 
01038        lundkc,EvtId(-1,-1),"  ",
01039        0,0,0,EvtPDL::getNominalMass(ipar),0.0,0.0,
01040        EvtPDL::getctau(ipar),0,0.0);
01041        
01042        } */
01043   }
01044   outdec.close();
01045 }

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 }

double EvtPythia::NominalMass int   )  [static, private]
 

00806 {
00807   // return default mass in PYTHIA
00808   switch(ID)
00809     {
00810     case 1103:
00811       return 0.77133;
00812     case 2101:
00813       return 0.57933;
00814     case 2103:
00815       return 0.77133;
00816     case 2203:
00817       return 0.77133;
00818     case 3101:
00819       return 0.80473;
00820     case 3103:
00821       return 0.92953;
00822     case 3201:
00823       return 0.80473;
00824     case 3203:
00825       return 0.92953;
00826     case 3303:
00827       return 1.09361;
00828     case 4101:
00829       return 1.96908;
00830     case 4103:
00831       return 2.00808;
00832     case 4201:
00833       return 1.96908;
00834     case 4203:
00835       return 2.00808;
00836     case 4301:
00837       return 2.15432;
00838     case 4303:
00839       return 2.17967;
00840     case 4403:
00841       return 3.27531;
00842     case 5101:
00843       return 5.38897;
00844     case 5103:
00845       return 5.40145;
00846     case 5201:
00847       return 5.38897;
00848     case 5203:
00849       return 5.40145;
00850     case 5301:
00851       return 5.56725;
00852     case 5303:
00853       return 5.57536;
00854     case 5401:
00855       return 6.67143;
00856     case 5403:
00857       return 6.67397;
00858     case 5503:
00859       return 10.07354;
00860       break;
00861     default:
00862       return 0.0;
00863       break;
00864     }
00865 }

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 }

void EvtPythia::pythiacont double *  ,
int *  ,
int *  ,
double *  ,
double *  ,
double *  ,
double * 
[static]
 

00202 {
00203   pycontinuum_(energy,ndaugjs,kf,px,py,pz,e);
00204 }

void EvtPythia::pythiaInit int  f  )  [static]
 

01047                                    {
01048   
01049   static int first=1;
01050   if (first){
01051     
01052     first=0;
01053     
01054     report(INFO,"EvtGen") << "Will initialize Pythia."<<endl;
01055     for(int i=0;i<ncommand;i++)
01056       pygive_(commands[i].c_str(),strlen(commands[i].c_str()));
01057     
01058     char fname[200];
01059     
01060     char hostBuffer[100];
01061     
01062     if ( gethostname( hostBuffer, 100 ) != 0 ){
01063       report(ERROR,"EvtGen") << " couldn't get hostname." << endl;
01064       strncpy( hostBuffer, "hostnameNotFound", 100 );
01065     }
01066     
01067     char pid[100];
01068     
01069     int thePid=getpid();
01070     
01071     if ( sprintf( pid, "%d", thePid ) == 0 ){
01072       report(ERROR,"EvtGen") << " couldn't get process ID." << endl;
01073       strncpy( pid, "666", 100 );
01074     }
01075     
01076     strcpy(fname,"jet.d-");
01077     strcat(fname,hostBuffer);
01078     strcat(fname,"-");
01079     strcat(fname,pid);
01080     
01081     MakePythiaFile(fname);
01082     evtpythiainit_(fname,strlen(fname));
01083     initpythia_(&dummy);
01084     
01085     if (0==getenv("EVTSAVEJETD")){
01086       char delcmd[300];
01087       strcpy(delcmd,"rm -f ");
01088       strcat(delcmd,fname); 
01089       system(delcmd);
01090     }
01091     
01092     report(INFO,"EvtGen") << "Done initializing Pythia."<<endl;
01093     
01094   }
01095 
01096 }

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;}

void EvtPythia::store EvtDecayBase jsdecay  )  [private]
 

00440                                           {
00441 
00442   if (njetsetdecays==ntable){
00443 
00444     EvtDecayBasePtr* newjetsetdecays=new EvtDecayBasePtr[2*ntable+10];
00445     int i;
00446     for(i=0;i<ntable;i++){
00447       newjetsetdecays[i]=jetsetdecays[i];
00448     }
00449     ntable=2*ntable+10;
00450     delete [] jetsetdecays;
00451     jetsetdecays=newjetsetdecays;
00452   }
00453 
00454   jetsetdecays[njetsetdecays++]=jsdecay;
00455 
00456 
00457 
00458 }

int EvtDecayBase::summary  )  [inline, inherited]
 

00078 {return _summary; }

int EvtDecayBase::verbose  )  [inline, inherited]
 

00079 {return _verbose; }

void EvtPythia::WritePythiaEntryHeader std::ofstream outdec,
int  lundkc,
EvtId  evtnum,
std::string  name,
int  chg,
int  cchg,
int  spin2,
double  mass,
double  width,
double  maxwidth,
double  ctau,
int  stable,
double  rawbrfrsum
[static, private]
 

00465                                                             {
00466 
00467   char sname[100];
00468   char ccsname[100];
00469   
00470   // RS changed to 16, new PYTHIA standard
00471   int namelength=16;
00472   
00473   int i,j;
00474   int temp;
00475   temp = spin2;
00476 
00477   if (ctau>1000000.0) ctau=0.0;
00478   
00479   strcpy(sname,name.c_str());
00480   
00481   i=0;
00482 
00483   while (sname[i]!=0){
00484     i++;
00485   }
00486 
00487   // strip up to two + or -
00488  
00489   if(evtnum.getId()>=0) {
00490     if (sname[i-1]=='+'||sname[i-1]=='-'){ 
00491       sname[i-1]=0;
00492       i--;
00493     }
00494     if (sname[i-1]=='+'||sname[i-1]=='-'){ 
00495       sname[i-1]=0;
00496       i--;
00497     }
00498     // strip 0 except for _0 and chi...0
00499     if (sname[i-1]=='0' && sname[i-2]!='_' && !(sname[0]=='c' && sname[1]=='h')){
00500       sname[i-1]=0;
00501       i--;
00502     }
00503   }
00504   
00505   if (i>namelength) {
00506     for(j=1;j<namelength;j++){
00507       sname[j]=sname[j+i-namelength];
00508     }
00509     sname[namelength]=0;
00510   }
00511   
00512   // RS: copy name for cc particle
00513   for(j=0;j<=namelength;j++)
00514     ccsname[j]=sname[j];
00515   i=0;
00516   while (ccsname[i]!=' '){
00517     i++;
00518     if(ccsname[i]==0) break;
00519   }
00520   if(i<namelength)
00521     {
00522       ccsname[i]='b';
00523       ccsname[i+1]=0;
00524     }
00525   
00526   //cchg=0;
00527   
00528   if(evtnum.getId()>=0) {
00529     if (abs(EvtPDL::getStdHep(evtnum))==21) cchg=2;
00530     if (abs(EvtPDL::getStdHep(evtnum))==90) cchg=-1;
00531     if ((abs(EvtPDL::getStdHep(evtnum))<=8)&&
00532         (abs(EvtPDL::getStdHep(evtnum))!=0)) cchg=1;
00533 
00534   }
00535   
00536   // RS output format changed to new PYTHIA style
00537   outdec << " " << setw(9) << lundkc;
00538   outdec << "  ";
00539   outdec.width(namelength);
00540   outdec << setiosflags(ios::left)
00541          << sname;
00542   // RS: name for cc paricle
00543   if ((evtnum.getId()>=0) && (EvtPDL::chargeConj(evtnum)!=evtnum))
00544     {
00545       outdec << "  ";
00546       outdec.width(namelength);
00547       outdec << ccsname;
00548     }else{
00549       // 2+16 spaces
00550       outdec << "                  ";
00551     }
00552   
00553   outdec << resetiosflags(ios::left);
00554   outdec << setw(3) << chg;
00555   outdec << setw(3) << cchg;
00556   outdec.width(3);
00557   if (evtnum.getId()>=0) {
00558     if (EvtPDL::chargeConj(evtnum)==evtnum) {
00559       outdec << 0;
00560     }
00561     else{
00562       outdec << 1;
00563     }
00564   }
00565   else{
00566     outdec << 0;
00567   }
00568   outdec.setf(ios::fixed,ios::floatfield);
00569   outdec.precision(5);
00570   outdec << setw(12) << mass;
00571   outdec.setf(ios::fixed,ios::floatfield);
00572   outdec << setw(12) << width;
00573   outdec.setf(ios::fixed,ios::floatfield);
00574   outdec.width(12);
00575   if (fabs(width)<0.0000000001) {
00576     outdec << 0.0 ;
00577   }
00578   else{
00579     outdec << maxwidth;
00580   }
00581   // scientific notation ...  outdec << setw(14) << ctau;
00582   outdec.setf(ios::scientific,ios::floatfield);
00583   outdec << "  ";
00584   outdec << ctau;
00585   outdec.width(3);
00586   if (evtnum.getId()>=0) {
00587     if (ctau>1.0 || rawbrfrsum<0.000001) {  
00588       stable=0;
00589     }
00590   }
00591   //resonance width treatment
00592   outdec.width(3);
00593   outdec << 0;
00594   outdec.width(3);
00595   outdec << stable;
00596   outdec << endl;
00597   outdec.width(0);
00598   //outdec.setf(0,0);
00599 
00600 }

void EvtPythia::WritePythiaParticle std::ofstream outdec,
EvtId  ipar,
EvtId  iparname,
int &  first
[static, private]
 

00603                                                               {
00604 
00605   int ijetset;
00606 
00607   double br_sum=0.0;
00608 
00609   for(ijetset=0;ijetset<njetsetdecays;ijetset++){
00610    
00611     if (jetsetdecays[ijetset]->getParentId()==ipar){
00612       br_sum+=jetsetdecays[ijetset]->getBranchingFraction();
00613     }
00614     if (jetsetdecays[ijetset]->getParentId()!=
00615         EvtPDL::chargeConj(jetsetdecays[ijetset]->getParentId())&&
00616         EvtPDL::chargeConj(jetsetdecays[ijetset]->getParentId())==ipar){
00617       br_sum+=jetsetdecays[ijetset]->getBranchingFraction();
00618     }
00619 
00620 
00621   }
00622 
00623   double br_sum_true=br_sum;
00624 
00625   if (br_sum<0.000001) br_sum=1.0;
00626   
00627   for(ijetset=0;ijetset<njetsetdecays;ijetset++){
00628     if (jetsetdecays[ijetset]->getParentId()==ipar){
00629       
00630       double br=jetsetdecays[ijetset]->getBranchingFraction();
00631       
00632       int i,daugs[5];
00633       EvtId cdaugs[5];
00634       
00635       for(i=0;i<5;i++){
00636         
00637         if(i<jetsetdecays[ijetset]->getNDaug()){
00638           daugs[i]=EvtPDL::getStdHep(
00639                          jetsetdecays[ijetset]->getDaugs()[i]);
00640           cdaugs[i]=EvtPDL::chargeConj(jetsetdecays[ijetset]->getDaugs()[i]);
00641         }
00642         else{
00643           daugs[i]=0;
00644         }
00645       }
00646       
00647       int channel;
00648       
00649       channel=EvtDecayTable::findChannel(EvtPDL::chargeConj(ipar),
00650                              jetsetdecays[ijetset]->getModelName(),
00651                              jetsetdecays[ijetset]->getNDaug(),
00652                              cdaugs,
00653                              jetsetdecays[ijetset]->getNArg(),
00654                              jetsetdecays[ijetset]->getArgsStr());     
00655       
00656       if (jetsetdecays[ijetset]->getModelName()=="PYTHIA"){
00657         
00658         if (first) {
00659           first=0;      
00660           WritePythiaEntryHeader(outdec,
00661                                  //EvtPDL::getLundKC(iparname),
00662                                  EvtPDL::getStdHep(iparname),
00663                                  iparname,
00664                                  EvtPDL::name(iparname), 
00665                                  EvtPDL::chg3(iparname),
00666                                  0,0,EvtPDL::getMeanMass(ipar),
00667                                  EvtPDL::getWidth(ipar),
00668                                  EvtPDL::getMeanMass(ipar)-EvtPDL::getMinMass(ipar),
00669                                  EvtPDL::getctau(ipar),1,br_sum_true);
00670         }
00671         
00672         int dflag=2;
00673         
00674         if (EvtPDL::getStdHep(ipar)<0) {
00675           dflag=3;
00676           for(i=0;i<jetsetdecays[ijetset]->getNDaug();i++){
00677             daugs[i]=EvtPDL::getStdHep(cdaugs[i]);
00678           }
00679           
00680         }
00681         
00682         /* RS
00683           PYTHIA allows to introduce new particles via a call to PYUPDA
00684           so no need for this check any more
00685           
00686           //now lets check to make sure that jetset, lucomp, knows
00687           //about all particles!
00688           int unknown=0;
00689           for(i=0;i<jetsetdecays[ijetset]->getNDaug();i++){
00690           if (pycomp_(&daugs[i])==0) {
00691           unknown=1;
00692           report(ERROR,"EvtGen") << "Pythia (pycomp) does not "
00693           << "know the particle:"<<
00694           EvtPDL::name(jetsetdecays[ijetset]->getDaugs()[i])<<endl;
00695           }
00696           }
00697           
00698           int istdheppar=EvtPDL::getStdHep(ipar);
00699           
00700           if (pycomp_(&istdheppar)==0){
00701           unknown=1;
00702           report(ERROR,"EvtGen") << "Pythia (pycomp) does not "
00703           << "know the particle:"<<
00704           EvtPDL::name(ipar)<<endl;
00705           }
00706           
00707           
00708           
00709           if (unknown){
00710           report(ERROR,"EvtGen") << "Therfore the decay:"<<endl;
00711           report(ERROR,"EvtGen") << EvtPDL::name(jetsetdecays[ijetset]->getParentId())<<" -> ";
00712           for(i=0;i<jetsetdecays[ijetset]->getNDaug();i++){
00713           report(ERROR,"") << EvtPDL::name(jetsetdecays[ijetset]->getDaugs()[i])<<" ";
00714           }
00715           report(ERROR,"")<<endl;
00716           report(ERROR,"EvtGen")<<"Will not be generated."<<endl;
00717           return;
00718           }
00719           */
00720         
00721         if (EvtPDL::chargeConj(ipar)==ipar) {
00722           dflag=1;
00723           //report(INFO,"EvtGen") << EvtPDL::name(iparname) << " dflag=1 because C(ipar)=ipar!"<<endl;
00724         }
00725         
00726         
00727         //if (channel>=0) {
00728         //  dflag=1;
00729         //report(INFO,"EvtGen") << EvtPDL::name(iparname) << " dflag=1 because channel>=0"<<endl;
00730         //}
00731         
00732         //      if (!(EvtPDL::getStdHep(ipar)<0&&channel>=0)){
00733         if (1){
00734           
00735           // RS changed format to new PYTHIA one
00736           outdec << "          ";
00737           outdec.width(5);
00738           outdec <<dflag;
00739           outdec.width(5);
00740           outdec <<(int)jetsetdecays[ijetset]->getArgs()[0];
00741           outdec.width(12);
00742           if (fabs(br)<0.000000001) {
00743             outdec <<"0.00000";
00744           }
00745           else{
00746             outdec <<br/br_sum;
00747           }
00748           outdec.width(10);
00749           outdec <<daugs[0];
00750           outdec.width(10);
00751           outdec <<daugs[1];
00752           outdec.width(10);
00753           outdec <<daugs[2];
00754           outdec.width(10);
00755           outdec <<daugs[3];
00756           outdec.width(10);
00757           outdec <<daugs[4];
00758           outdec<<endl;
00759           outdec.width(0);
00760         }
00761       }
00762     }
00763   }
00764 }


Member Data Documentation

bool EvtDecayBase::_daugsDecayedByParentModel [protected, inherited]
 

std::string * EvtPythia::commands = 0 [static, private]
 

EvtDecayBasePtr * EvtPythia::jetsetdecays = 0 [static, private]
 

int EvtPythia::lcommand = 0 [static, private]
 

int EvtPythia::ncommand = 0 [static, private]
 

int EvtPythia::njetsetdecays = 0 [static, private]
 

int EvtPythia::ntable = 0 [static, private]
 


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