//-------------------------------------------------------------------------- // // Environment: // This software is part of the EvtGen package developed jointly // for the BaBar and CLEO collaborations. If you use all or part // of it, please give an appropriate acknowledgement. // // Copyright Information: See EvtGen/COPYRIGHT // Copyright (C) 1998 Caltech, UCSB // // Module: EvtDecayTable.cc // // Description: // // Modification history: // // DJL/RYD September 25, 1996 Module created // //------------------------------------------------------------------------ // #include "EvtGenBase/EvtPatches.hh" #include #include #include #include #include #include #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtDecayTable.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtSymTable.hh" #include "EvtGenBase/EvtDecayBase.hh" #include "EvtGenBase/EvtModel.hh" #include "EvtGenBase/EvtParser.hh" #include "EvtGenBase/EvtReport.hh" #include "EvtGenBase/EvtModelAlias.hh" #include "EvtGenBase/EvtRadCorr.hh" using std::endl; using std::fstream; using std::ifstream; std::vector EvtDecayTable::_decaytable; int EvtDecayTable::getNMode(int ipar){ return _decaytable[ipar].getNMode(); } EvtDecayBase* EvtDecayTable::getDecay(int ipar, int imode){ return _decaytable[ipar].getDecayModel(imode); } void EvtDecayTable::printSummary(){ for(size_t i=0;igetId().getAlias(); if ( _decaytable[partnum].getNMode()==0 ) return 0; return _decaytable[partnum].getDecayModel(p); } void EvtDecayTable::readDecayFile(const std::string dec_name, bool verbose){ if ( _decaytable.size() < EvtPDL::entries() ) _decaytable.resize(EvtPDL::entries()); EvtModel &modelist=EvtModel::instance(); int i; report(INFO,"EvtGen") << "In readDecayFile, reading:"< modelAliasList; do{ token=parser.getToken(itoken++); //Easy way to turn off photos... Lange September 5, 2000 if (token=="noPhotos"){ EvtRadCorr::setNeverRadCorr(); if ( verbose ) report(INFO,"EvtGen") << "As requested, PHOTOS will be turned off."< modelArgList; std::string aliasName=parser.getToken(itoken++); std::string modelName=parser.getToken(itoken++); std::string nameTemp; do{ nameTemp=parser.getToken(itoken++); if (nameTemp!=";") { modelArgList.push_back(nameTemp); } }while(nameTemp!=";"); EvtModelAlias newAlias(aliasName,modelName,modelArgList); modelAliasList.push_back(newAlias); } else if (token=="ChargeConj"){ std::string aname; std::string abarname; aname=parser.getToken(itoken++); abarname=parser.getToken(itoken++); EvtId a=EvtPDL::getId(aname); EvtId abar=EvtPDL::getId(abarname); if (a==EvtId(-1,-1)) { report(ERROR,"EvtGen") <<"Unknown particle name:"< 3 ) newWidth=atof(parser.getToken(itoken++).c_str()); //Now make the change! EvtPDL::reSetMass(thisPart, newMass); EvtPDL::reSetWidth(thisPart, newWidth); if (verbose ) report(INFO,"EvtGen") << "Changing particle properties of " << pname.c_str() << " Mass=" << newMass << " Width="<=0; int ismodel=modelist.isModel(parser.getToken(itoken)); if (!(isname||ismodel)){ //see if this is an aliased model for(size_t iAlias=0;iAlias=0){ sdaug=parser.getToken(itoken++); daught[n_daugh++]=EvtPDL::getId(sdaug); if (daught[n_daugh-1]==EvtId(-1,-1)) { report(ERROR,"EvtGen") <<"Unknown particle name:"<setPHOTOS(); } if (verbose){ temp_fcn_new->setVerbose(); } if (summary){ temp_fcn_new->setSummary(); } std::vector temp_fcn_new_args; std::string name; int ierr; if ( foundAnAlias==-1 ) { do{ name=parser.getToken(itoken++); if (name!=";") { temp_fcn_new_args.push_back(EvtSymTable::get(name,ierr)); if (ierr) { report(ERROR,"EvtGen") <<"Reading arguments and found:"<< name.c_str()<<" on line:"<< parser.getLineofToken(itoken-1)<=0; int ismodel=modelist.isModel(name); if (ismodel) { report(ERROR,"EvtGen") <<"Expected ';' but found:"<< name.c_str()<<" on line:"<< parser.getLineofToken(itoken-1)< copyMe=modelAliasList[foundAnAlias].getArgList(); temp_fcn_new_args=copyMe; itoken++; } //Found one decay. brfrsum+=brfr; temp_fcn_new->saveDecayInfo(ipar,n_daugh, daught, temp_fcn_new_args.size(), temp_fcn_new_args, temp_fcn_new_model, brfr); double massmin=0.0; // for (i=0;inRealDaughters();i++){ if ( EvtPDL::getMinMass(daught[i])>0.0001 ){ massmin+=EvtPDL::getMinMass(daught[i]); } else { massmin+=EvtPDL::getMeanMass(daught[i]); } } _decaytable[ipar.getAlias()].addMode(temp_fcn_new,brfrsum,massmin); } } while(token!="Enddecay"); _decaytable[ipar.getAlias()].finalize(); } // Allow copying of decays from one particle to another; useful // in combination with RemoveDecay else if (token=="CopyDecay") { std::string newname; std::string oldname; newname=parser.getToken(itoken++); oldname=parser.getToken(itoken++); EvtId newipar=EvtPDL::getId(newname); EvtId oldipar=EvtPDL::getId(oldname); if (oldipar==EvtId(-1,-1)) { report(ERROR,"EvtGen") <<"Unknown particle name:"<= 0) { sdaug = parser.getToken(itoken++); daught[n_daugh++] = EvtPDL::getId(sdaug); if (daught[n_daugh-1]==EvtId(-1,-1)) { report(ERROR,"EvtGen") <<"Unknown particle name:"< temp_fcn_new_args; std::string temp_fcn_new_model("PHSP"); temp_fcn_new->saveDecayInfo(ipar, n_daugh, daught, 0, temp_fcn_new_args, temp_fcn_new_model, 0.); _decaytable[ipar.getAlias()].removeMode(temp_fcn_new); } } while (token != "Enddecay"); itoken++; } else if (token!="End"){ report(ERROR,"EvtGen") << "Found unknown command:'"< EvtPDL::getMinMass(temp) ) { if ( verbose ) report(INFO,"EvtGen") << "Given allowed decays, resetting minMass " << EvtPDL::name(temp).c_str() << " " << EvtPDL::getMinMass(temp) << " to " << minMass << endl; EvtPDL::reSetMassMin(temp,minMass); } } } int EvtDecayTable::findChannel(EvtId parent, std::string model, int ndaug, EvtId *daugs, int narg, std::string *args){ int i,j,right; EvtId daugs_scratch[50]; int nmatch,k; for(i=0;i<_decaytable[parent.getAlias()].getNMode();i++){ right=1; right=right&&model==_decaytable[parent.getAlias()]. getDecay(i).getDecayModel()->getModelName(); right=right&&(ndaug==_decaytable[parent.getAlias()]. getDecay(i).getDecayModel()->getNDaug()); right=right&&(narg==_decaytable[parent.getAlias()]. getDecay(i).getDecayModel()->getNArg()); if ( right ){ for(j=0;jgetNDaug();j++){ for(k=0;kgetDaug(j)){ daugs_scratch[k]=EvtId(-1,-1); nmatch++; break; } } } right=right&&(nmatch==ndaug); for(j=0;j<_decaytable[parent.getAlias()]. getDecay(i).getDecayModel()->getNArg();j++){ right=right&&(args[j]==_decaytable[parent.getAlias()]. getDecay(i).getDecayModel()->getArgStr(j)); } } if (right) return i; } return -1; } int EvtDecayTable::inChannelList(EvtId parent, int ndaug, EvtId *daugs){ int i,j,k; EvtId daugs_scratch[MAX_DAUG]; int dsum=0; for(i=0;igetDSum()==dsum){ int nd=thedecaymodel->getNDaug(); if (ndaug==nd){ for(j=0;jgetDaug(j)){ daugs_scratch[k]=EvtId(-1,-1); nmatch++; break; } } } if ((nmatch==ndaug)&& (! ((thedecaymodel->getModelName()=="JETSET")|| (thedecaymodel->getModelName()=="PYTHIA")))){ return i; } } } } return -1; }