47static std::vector<EvtParticleDecayList> decaytable;
50 return decaytable[ipar].getNMode();
54 return decaytable[ipar].getDecayModel(imode);
59 EvtDecayBase* thedecaymodel=decaytable[ipar].getDecay(imode).getDecayModel();
68 decaytable[i].printSummary();
78 if ( decaytable[partnum].
getNMode()==0 )
return 0;
79 return decaytable[partnum].getDecayModel(p);
89 report(
INFO,
"EvtGen") <<
"In readDecayFile, reading:"<<dec_name.c_str()<<endl;
93 fin.open(dec_name.c_str());
95 report(
ERROR,
"EvtGen") <<
"Could not open "<<dec_name.c_str()<<endl;
100 parser.
Read(dec_name);
108 for(itok=0;itok<parser.
getNToken();itok++){
112 if (token==
"End") hasend=1;
117 report(
ERROR,
"EvtGen") <<
"Could not find an 'End' in "<<dec_name.c_str()<<endl;
118 report(
ERROR,
"EvtGen") <<
"Will terminate execution."<<endl;
124 std::string model,parent,sdaug;
134 std::vector<EvtModelAlias> modelAliasList;
142 if (token==
"noPhotos"){
145 <<
"As requested, PHOTOS will be turned off."<<endl;
147 else if (token==
"yesPhotos"){
150 <<
"As requested, PHOTOS will be turned on."<<endl;
152 else if (token==
"normalPhotos"){
155 <<
"As requested, PHOTOS will be turned on only when requested."<<endl;
157 else if (token==
"Alias"){
167 if (
id==
EvtId(-1,-1)) {
168 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<oldname.c_str()
170 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
177 }
else if (token==
"ModelAlias"){
178 std::vector<std::string> modelArgList;
180 std::string aliasName=parser.
getToken(itoken++);
181 std::string modelName=parser.
getToken(itoken++);
183 std::string nameTemp;
187 modelArgList.push_back(nameTemp);
189 }
while(nameTemp!=
";");
191 modelAliasList.push_back(newAlias);
192 }
else if (token==
"ChargeConj"){
195 std::string abarname;
203 if (a==
EvtId(-1,-1)) {
204 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<aname.c_str()
206 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
210 if (abar==
EvtId(-1,-1)) {
211 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<abarname.c_str()
213 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
228 }
else if (token==
"CDecay"){
235 if (ipar==
EvtId(-1,-1)) {
236 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<name.c_str()
239 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
245 if (decaytable[ipar.
getAlias()].getNMode()!=0) {
248 "Redefined decay of "<<name.c_str()<<
" in CDecay"<<endl;
250 decaytable[ipar.
getAlias()].removeDecay();
256 }
else if (token==
"Define"){
268 }
else if (token==
"Particle"){
272 report(
INFO,
"EvtGen") << pname.c_str() << endl;
274 double newMass=atof(parser.
getToken(itoken++).c_str());
283 report(
INFO,
"EvtGen") <<
"Changing particle properties of " <<
284 pname.c_str() <<
" Mass=" << newMass <<
" Width="<<newWidth<<endl;
286 }
else if ( token==
"ChangeMassMin") {
289 double tmass=atof(parser.
getToken(itoken++).c_str());
293 report(
DEBUG,
"EvtGen") <<
"Refined minimum mass for " <<
EvtPDL::name(thisPart).c_str() <<
" to be " << tmass << endl;
295 }
else if ( token==
"ChangeMassMax") {
298 double tmass=atof(parser.
getToken(itoken++).c_str());
301 report(
DEBUG,
"EvtGen") <<
"Refined maximum mass for " <<
EvtPDL::name(thisPart).c_str() <<
" to be " << tmass << endl;
303 }
else if ( token==
"IncludeBirthFactor") {
307 if ( parser.
getToken(itoken++).c_str()==
"yes") yesno=
true;
311 if ( !yesno )
report(
DEBUG,
"EvtGen") <<
"No longer include birth factor for " <<
EvtPDL::name(thisPart).c_str() <<endl;
314 }
else if ( token==
"IncludeDecayFactor") {
318 if ( parser.
getToken(itoken++).c_str()==
"yes") yesno=
true;
322 if ( !yesno )
report(
DEBUG,
"EvtGen") <<
"No longer include decay factor for " <<
EvtPDL::name(thisPart).c_str() <<endl;
324 }
else if ( token==
"AddFactorPn") {
327 double factor=atof(parser.
getToken(itoken++).c_str());
330 report(
DEBUG,
"EvtGen") <<
"Include momentum factor Pn= "<<factor <<
" for " <<
EvtPDL::name(thisPart).c_str() <<endl;
331 }
else if ( token==
"LSNONRELBW") {
335 std::string tstr=
"NONRELBW";
338 }
else if ( token==
"SP6LSFIX") {
345 }
else if ( token==
"LSFLAT") {
349 std::string tstr=
"FLAT";
352 }
else if ( token==
"LSMANYDELTAFUNC") {
356 std::string tstr=
"MANYDELTAFUNC";
360 }
else if ( token==
"BlattWeisskopf") {
363 double tnum=atof(parser.
getToken(itoken++).c_str());
366 report(
DEBUG,
"EvtGen") <<
"Redefined Blatt-Weisskopf factor " <<
EvtPDL::name(thisPart).c_str() <<
" to be " << tnum << endl;
367 }
else if ( token==
"SetLineshapePW") {
371 std::string pnameD1=parser.
getToken(itoken++);
373 std::string pnameD2=parser.
getToken(itoken++);
375 int pw=atoi(parser.
getToken(itoken++).c_str());
376 report(
DEBUG,
"EvtGen") <<
"Redefined Partial wave for " << pname.c_str() <<
" to " << pnameD1.c_str() <<
" " << pnameD2.c_str() <<
" ("<<pw<<
")"<<endl;
379 }
else if (token==
"Decay") {
381 std::string temp_fcn_new_model;
392 if (ipar==
EvtId(-1,-1)) {
393 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<parent.c_str()
396 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
400 if (decaytable[ipar.
getAlias()].getNMode()!=0) {
402 <<parent.c_str()<<endl;
403 decaytable[ipar.
getAlias()].removeDecay();
411 if (token!=
"Enddecay"){
414 while (token.c_str()[i++]!=0){
415 if (isalpha(token.c_str()[i])){
417 "Expected to find a branching fraction or Enddecay "<<
418 "but found:"<<token.c_str()<<
" on line "<<
420 report(
ERROR,
"EvtGen") <<
"Possibly to few arguments to model "<<
421 "on previous line!"<<endl;
422 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
427 brfr=atof(token.c_str());
432 if (!(isname||ismodel)){
435 for(iAlias=0;iAlias<modelAliasList.size();iAlias++){
436 if ( modelAliasList[iAlias].matchAlias(parser.
getToken(itoken)) ) {
443 if (!(isname||ismodel)){
446 <<
" is neither a particle name nor "
447 <<
"the name of a model. "<<endl;
448 report(
INFO,
"EvtGen") <<
"It was encountered on line "<<
450 report(
INFO,
"EvtGen") <<
"Please fix it. Thank you."<<endl;
451 report(
INFO,
"EvtGen") <<
"Be sure to check that the "
452 <<
"correct case has been used. \n";
453 report(
INFO,
"EvtGen") <<
"Terminating execution. \n";
464 if (daught[n_daugh-1]==
EvtId(-1,-1)) {
465 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<sdaug.c_str()
467 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
481 if (model==
"PHOTOS"){
485 if (model==
"VERBOSE"){
489 if (model==
"SUMMARY"){
493 }
while(model==
"PHOTOS"||
500 for(iAlias=0;iAlias<modelAliasList.size();iAlias++){
501 if ( modelAliasList[iAlias].matchAlias(model) ) {
507 if ( foundAnAlias==-1 ) {
510 "Expected to find a model name,"<<
511 "found:"<<model.c_str()<<
" on line "<<
513 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
518 model=modelAliasList[foundAnAlias].getName();
521 temp_fcn_new_model=model;
522 temp_fcn_new=modelist.
getFcn(model);
536 std::vector<std::string> temp_fcn_new_args;
541 if ( foundAnAlias==-1 ) {
548 <<
"Reading arguments and found:"<<
549 name.c_str()<<
" on line:"<<
552 <<
"Will terminate execution!"<<endl;
557 int ismodel=modelist.
isModel(name);
560 <<
"Expected ';' but found:"<<
561 name.c_str()<<
" on line:"<<
564 <<
"Most probable error is omitted ';'."<<endl;
566 <<
"Will terminate execution!"<<endl;
572 std::vector<std::string> copyMe=modelAliasList[foundAnAlias].getArgList();
573 temp_fcn_new_args=copyMe;
582 temp_fcn_new_args.size(),
598 decaytable[ipar.
getAlias()].addMode(temp_fcn_new,brfrsum,massmin);
602 }
while(token!=
"Enddecay");
604 decaytable[ipar.
getAlias()].finalize();
609 else if (token==
"CopyDecay") {
619 if (oldipar==
EvtId(-1,-1)) {
620 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<oldname.c_str()
622 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
625 if (newipar==
EvtId(-1,-1)) {
626 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<newname.c_str()
628 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
631 if (decaytable[newipar.
getAlias()].getNMode()!=0) {
634 decaytable[newipar.
getAlias()].removeDecay();
640 else if (token==
"RemoveDecay") {
644 if (ipar==
EvtId(-1,-1)) {
645 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<parent.c_str()
648 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
652 if (decaytable[ipar.
getAlias()].getNMode()==0) {
653 report(
DEBUG,
"EvtGen") <<
"No decays to delete for "
654 << parent.c_str() << endl;
656 report(
DEBUG,
"EvtGen") <<
"Deleting selected decays of "
657 <<parent.c_str()<<endl;
663 if (token !=
"Enddecay") {
668 if (daught[n_daugh-1]==
EvtId(-1,-1)) {
669 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<sdaug.c_str()
671 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
678 <<
"Expected ';' but found:"<<
679 token <<
" on line:"<<
682 <<
"Most probable error is omitted ';'."<<endl;
684 <<
"Will terminate execution!"<<endl;
689 std::vector<std::string> temp_fcn_new_args;
690 std::string temp_fcn_new_model(
"PHSP");
697 decaytable[ipar.
getAlias()].removeMode(temp_fcn_new);
699 }
while (token !=
"Enddecay");
702 else if (token!=
"End"){
704 report(
ERROR,
"EvtGen") <<
"Found unknown command:'"<<token.c_str()<<
"' on line "
706 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
711 }
while ((token!=
"End")&&itoken!=parser.
getNToken());
720 if ( nModTot == 0 )
continue;
725 for (jj=0; jj<nModTot; jj++) {
726 double tmass=decaytable[ii].getDecay(jj).getMassMin();
727 if ( tmass< minMass) minMass=tmass;
741 int ndaug,
EvtId *daugs,
742 int narg, std::string *args){
745 EvtId daugs_scratch[50];
752 right=right&&model==decaytable[parent.
getAlias()].
754 right=right&&(ndaug==decaytable[parent.
getAlias()].
755 getDecay(i).getDecayModel()->getNDaug());
756 right=right&&(narg==decaytable[parent.
getAlias()].
757 getDecay(i).getDecayModel()->getNArg());
763 for(j=0;j<ndaug;j++){
764 daugs_scratch[j]=daugs[j];
769 for(j=0;j<decaytable[parent.
getAlias()].
770 getDecay(i).getDecayModel()->getNDaug();j++){
772 for(k=0;k<ndaug;k++){
773 if (daugs_scratch[k]==decaytable[parent.
getAlias()].
774 getDecay(i).getDecayModel()->getDaug(j)){
775 daugs_scratch[k]=
EvtId(-1,-1);
782 right=right&&(nmatch==ndaug);
784 for(j=0;j<decaytable[parent.
getAlias()].
785 getDecay(i).getDecayModel()->getNArg();j++){
786 right=right&&(args[j]==decaytable[parent.
getAlias()].
787 getDecay(i).getDecayModel()->getArgStr(j));
802 for(i=0;i<ndaug;i++){
810 int nmode=decaytable[ipar].getNMode();
812 for(i=0;i<nmode;i++){
814 EvtDecayBase* thedecaymodel=decaytable[ipar].getDecay(i).getDecayModel();
816 if (thedecaymodel->
getDSum()==dsum){
821 for(j=0;j<ndaug;j++){
822 daugs_scratch[j]=daugs[j];
826 for(k=0;k<ndaug;k++){
827 if (
EvtId(daugs_scratch[k])==thedecaymodel->
getDaug(j)){
828 daugs_scratch[k]=
EvtId(-1,-1);
834 if ((nmatch==ndaug)&&
EvtDecayBase * getDecay(int ipar, int imode)
ostream & report(Severity severity, const char *facility)
std::string getModelName()
void saveDecayInfo(EvtId ipar, int ndaug, EvtId *daug, int narg, std::vector< std::string > &args, std::string name, double brfr)
virtual int nRealDaughters()
static EvtDecayBase * gettheDecay(EvtId parent, int imode)
static int findChannel(EvtId parent, std::string model, int ndaug, EvtId *daugs, int narg, std::string *args)
static int getNMode(int ipar)
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
static EvtDecayBase * getDecayFunc(EvtParticle *)
static EvtDecayBase * getDecay(int ipar, int imode)
static void readDecayFile(const std::string dec_name)
static void printSummary()
EvtDecayBase * getFcn(std::string model_name)
void storeCommand(std::string cmd, std::string cnfgstr)
int isModel(std::string name)
static EvtModel & instance()
int isCommand(std::string cmd)
static double getWidth(EvtId i)
static void reSetBlatt(EvtId i, double blatt)
static void addFactorPn(EvtId i, double factor)
static void fixLSForSP8(EvtId i)
static void changeLS(EvtId i, std::string &newLS)
static double getMeanMass(EvtId i)
static void reSetWidth(EvtId i, double width)
static void reSetMass(EvtId i, double mass)
static void alias(EvtId num, const std::string &newname)
static void includeDecayFactor(EvtId i, bool yesno)
static void reSetMassMax(EvtId i, double mass)
static std::string name(EvtId i)
static EvtId chargeConj(EvtId id)
static double getMinMass(EvtId i)
static void setPWForDecay(EvtId i, int spin, EvtId d1, EvtId d2)
static void aliasChgConj(EvtId a, EvtId abar)
static void includeBirthFactor(EvtId i, bool yesno)
static double getMaxMass(EvtId i)
static EvtId getId(const std::string &name)
static void reSetMassMin(EvtId i, double mass)
int getLineofToken(int i)
const std::string & getToken(int i)
int Read(const std::string filename)
static void setAlwaysRadCorr()
static void setNormalRadCorr()
static void setNeverRadCorr()
static void Define(const std::string &name, std::string d)
static std::string Get(const std::string &name, int &ierr)