//-------------------------------------------------------------------------- // // 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/EvtDecayParm.hh" #include "EvtGenBase/EvtSymTable.hh" #include "EvtGenBase/EvtDecayBase.hh" #include "EvtGenBase/EvtModel.hh" #include "EvtGenBase/EvtParticleDecayList.hh" #include "EvtGenBase/EvtParser.hh" #include "EvtGenBase/EvtReport.hh" #include "EvtGenBase/EvtModelAlias.hh" #include "EvtGenBase/EvtRadCorr.hh" #include using std::endl; using std::fstream; using std::ifstream; static std::vector decaytable; int EvtDecayTable::getNMode(int ipar){ return decaytable[ipar].getNMode(); } EvtDecayBase* getDecay(int ipar, int imode){ return decaytable[ipar].getDecayModel(imode); } void EvtDecayTable::printSummary(){ int i; for(i=0;igetId().getAlias(); if ( decaytable[partnum].getNMode()==0 ) return 0; return decaytable[partnum].getDecayModel(p); } void EvtDecayTable::readDecayFile(const std::string dec_name){ 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(); 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); 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 int iAlias; for(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 fismodel=modelist.isModel(name); if (fismodel) { 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(); } else if (token!="End"){ report(ERROR,"EvtGen") << "Found unknown command:'"< EvtPDL::getMinMass(temp) ) { 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;igetModelName(); 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;jgetNArg();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; }