83 report(
INFO,
"EvtGen" ) <<
"In readDecayFile, reading:" << dec_name.c_str() << endl;
87 fin.open( dec_name.c_str() );
88 if ( !fin ) {
report(
ERROR,
"EvtGen" ) <<
"Could not open " << dec_name.c_str() << endl; }
92 parser.
Read( dec_name );
100 for ( itok = 0; itok < parser.
getNToken(); itok++ )
105 if ( token ==
"End" ) hasend = 1;
110 report(
ERROR,
"EvtGen" ) <<
"Could not find an 'End' in " << dec_name.c_str() << endl;
111 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution." << endl;
115 std::string model, parent, sdaug;
125 std::vector<EvtModelAlias> modelAliasList;
129 token = parser.
getToken( itoken++ );
132 if ( token ==
"noPhotos" )
135 report(
INFO,
"EvtGen" ) <<
"As requested, PHOTOS will be turned off." << endl;
137 else if ( token ==
"yesPhotos" )
140 report(
INFO,
"EvtGen" ) <<
"As requested, PHOTOS will be turned on." << endl;
142 else if ( token ==
"normalPhotos" )
145 report(
INFO,
"EvtGen" ) <<
"As requested, PHOTOS will be turned on only when requested."
148 else if ( token ==
"Alias" )
154 newname = parser.
getToken( itoken++ );
155 oldname = parser.
getToken( itoken++ );
159 if (
id ==
EvtId( -1, -1 ) )
161 report(
ERROR,
"EvtGen" ) <<
"Unknown particle name:" << oldname.c_str() <<
" on line "
163 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
170 else if ( token ==
"ModelAlias" )
172 std::vector<std::string> modelArgList;
174 std::string aliasName = parser.
getToken( itoken++ );
175 std::string modelName = parser.
getToken( itoken++ );
177 std::string nameTemp;
179 nameTemp = parser.
getToken( itoken++ );
180 if ( nameTemp !=
";" ) { modelArgList.push_back( nameTemp ); }
181 }
while ( nameTemp !=
";" );
182 EvtModelAlias newAlias( aliasName, modelName, modelArgList );
183 modelAliasList.push_back( newAlias );
185 else if ( token ==
"ChargeConj" )
189 std::string abarname;
191 aname = parser.
getToken( itoken++ );
192 abarname = parser.
getToken( itoken++ );
197 if ( a ==
EvtId( -1, -1 ) )
199 report(
ERROR,
"EvtGen" ) <<
"Unknown particle name:" << aname.c_str() <<
" on line "
201 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
205 if ( abar ==
EvtId( -1, -1 ) )
207 report(
ERROR,
"EvtGen" ) <<
"Unknown particle name:" << abarname.c_str()
209 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
220 cnfgstr = parser.
getToken( itoken++ );
224 else if ( token ==
"CDecay" )
232 if ( ipar ==
EvtId( -1, -1 ) )
234 report(
ERROR,
"EvtGen" ) <<
"Unknown particle name:" << name.c_str() <<
" on line "
236 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
242 if ( decaytable[ipar.
getAlias()].getNMode() != 0 )
246 <<
"Redefined decay of " << name.c_str() <<
" in CDecay" << endl;
248 decaytable[ipar.
getAlias()].removeDecay();
252 decaytable[ipar.
getAlias()].makeChargeConj( &decaytable[cipar.
getAlias()] );
254 else if ( token ==
"Define" )
268 else if ( token ==
"Particle" )
272 pname = parser.
getToken( itoken++ );
273 report(
INFO,
"EvtGen" ) << pname.c_str() << endl;
275 double newMass = atof( parser.
getToken( itoken++ ).c_str() );
278 if ( parser.
getNToken() > 3 ) newWidth = atof( parser.
getToken( itoken++ ).c_str() );
284 report(
INFO,
"EvtGen" ) <<
"Changing particle properties of " << pname.c_str()
285 <<
" Mass=" << newMass <<
" Width=" << newWidth << endl;
287 else if ( token ==
"ChangeMassMin" )
290 pname = parser.
getToken( itoken++ );
291 double tmass = atof( parser.
getToken( itoken++ ).c_str() );
295 report(
DEBUG,
"EvtGen" ) <<
"Refined minimum mass for "
296 <<
EvtPDL::name( thisPart ).c_str() <<
" to be " << tmass
299 else if ( token ==
"ChangeMassMax" )
302 pname = parser.
getToken( itoken++ );
303 double tmass = atof( parser.
getToken( itoken++ ).c_str() );
306 report(
DEBUG,
"EvtGen" ) <<
"Refined maximum mass for "
307 <<
EvtPDL::name( thisPart ).c_str() <<
" to be " << tmass
310 else if ( token ==
"IncludeBirthFactor" )
313 pname = parser.
getToken( itoken++ );
315 if ( parser.
getToken( itoken++ ).c_str() ==
"yes" ) yesno =
true;
320 <<
"Include birth factor for " <<
EvtPDL::name( thisPart ).c_str() << endl;
322 report(
DEBUG,
"EvtGen" ) <<
"No longer include birth factor for "
325 else if ( token ==
"IncludeDecayFactor" )
328 pname = parser.
getToken( itoken++ );
330 if ( parser.
getToken( itoken++ ).c_str() ==
"yes" ) yesno =
true;
335 <<
"Include decay factor for " <<
EvtPDL::name( thisPart ).c_str() << endl;
337 report(
DEBUG,
"EvtGen" ) <<
"No longer include decay factor for "
340 else if ( token ==
"AddFactorPn" )
343 pname = parser.
getToken( itoken++ );
344 double factor = atof( parser.
getToken( itoken++ ).c_str() );
347 report(
DEBUG,
"EvtGen" ) <<
"Include momentum factor Pn= " << factor <<
" for "
350 else if ( token ==
"LSNONRELBW" )
353 pname = parser.
getToken( itoken++ );
355 std::string tstr =
"NONRELBW";
357 report(
DEBUG,
"EvtGen" ) <<
"Change lineshape to non-rel BW for "
360 else if ( token ==
"SP6LSFIX" )
363 pname = parser.
getToken( itoken++ );
366 report(
DEBUG,
"EvtGen" ) <<
"Fixed lineshape for SP6 --from M.Baak "
369 else if ( token ==
"LSFLAT" )
372 pname = parser.
getToken( itoken++ );
374 std::string tstr =
"FLAT";
376 report(
DEBUG,
"EvtGen" ) <<
"Change lineshape to flat for "
379 else if ( token ==
"LSMANYDELTAFUNC" )
382 pname = parser.
getToken( itoken++ );
384 std::string tstr =
"MANYDELTAFUNC";
386 report(
DEBUG,
"EvtGen" ) <<
"Change lineshape to spikes for "
389 else if ( token ==
"BlattWeisskopf" )
392 pname = parser.
getToken( itoken++ );
393 double tnum = atof( parser.
getToken( itoken++ ).c_str() );
396 report(
DEBUG,
"EvtGen" ) <<
"Redefined Blatt-Weisskopf factor "
397 <<
EvtPDL::name( thisPart ).c_str() <<
" to be " << tnum
400 else if ( token ==
"SetLineshapePW" )
403 pname = parser.
getToken( itoken++ );
405 std::string pnameD1 = parser.
getToken( itoken++ );
407 std::string pnameD2 = parser.
getToken( itoken++ );
409 int pw = atoi( parser.
getToken( itoken++ ).c_str() );
410 report(
DEBUG,
"EvtGen" ) <<
"Redefined Partial wave for " << pname.c_str() <<
" to "
411 << pnameD1.c_str() <<
" " << pnameD2.c_str() <<
" (" << pw
415 else if ( token ==
"Decay" )
418 std::string temp_fcn_new_model;
422 double brfrsum = 0.0;
424 parent = parser.
getToken( itoken++ );
427 if ( ipar ==
EvtId( -1, -1 ) )
429 report(
ERROR,
"EvtGen" ) <<
"Unknown particle name:" << parent.c_str() <<
" on line "
431 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
435 if ( decaytable[ipar.
getAlias()].getNMode() != 0 )
437 report(
DEBUG,
"EvtGen" ) <<
"Redefined decay of " << parent.c_str() << endl;
438 decaytable[ipar.
getAlias()].removeDecay();
443 token = parser.
getToken( itoken++ );
445 if ( token !=
"Enddecay" )
449 while ( token.c_str()[i++] != 0 )
451 if ( isalpha( token.c_str()[i] ) )
453 report(
ERROR,
"EvtGen" ) <<
"Expected to find a branching fraction or Enddecay "
454 <<
"but found:" << token.c_str() <<
" on line "
456 report(
ERROR,
"EvtGen" ) <<
"Possibly to few arguments to model "
457 <<
"on previous line!" << endl;
458 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
463 brfr = atof( token.c_str() );
468 if ( !( isname || ismodel ) )
472 for ( iAlias = 0; iAlias < modelAliasList.size(); iAlias++ )
474 if ( modelAliasList[iAlias].matchAlias( parser.
getToken( itoken ) ) )
482 if ( !( isname || ismodel ) )
486 << parser.
getToken( itoken ).c_str() <<
" is neither a particle name nor "
487 <<
"the name of a model. " << endl;
489 <<
"It was encountered on line " << parser.
getLineofToken( itoken )
490 <<
" of the decay file." << endl;
491 report(
INFO,
"EvtGen" ) <<
"Please fix it. Thank you." << endl;
492 report(
INFO,
"EvtGen" ) <<
"Be sure to check that the "
493 <<
"correct case has been used. \n";
494 report(
INFO,
"EvtGen" ) <<
"Terminating execution. \n";
504 sdaug = parser.
getToken( itoken++ );
506 if ( daught[n_daugh - 1] ==
EvtId( -1, -1 ) )
509 <<
"Unknown particle name:" << sdaug.c_str() <<
" on line "
511 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
516 model = parser.
getToken( itoken++ );
523 if ( model ==
"PHOTOS" )
526 model = parser.
getToken( itoken++ );
528 if ( model ==
"VERBOSE" )
531 model = parser.
getToken( itoken++ );
533 if ( model ==
"SUMMARY" )
536 model = parser.
getToken( itoken++ );
538 }
while ( model ==
"PHOTOS" || model ==
"VERBOSE" || model ==
"SUMMARY" );
542 int foundAnAlias = -1;
543 for ( iAlias = 0; iAlias < modelAliasList.size(); iAlias++ )
545 if ( modelAliasList[iAlias].matchAlias( model ) )
547 foundAnAlias = iAlias;
552 if ( foundAnAlias == -1 )
554 if ( !modelist.
isModel( model ) )
556 report(
ERROR,
"EvtGen" ) <<
"Expected to find a model name,"
557 <<
"found:" << model.c_str() <<
" on line "
559 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
563 else { model = modelAliasList[foundAnAlias].getName(); }
565 temp_fcn_new_model = model;
566 temp_fcn_new = modelist.
getFcn( model );
568 if ( photos ) { temp_fcn_new->
setPHOTOS(); }
569 if ( verbose ) { temp_fcn_new->
setVerbose(); }
570 if ( summary ) { temp_fcn_new->
setSummary(); }
572 std::vector<std::string> temp_fcn_new_args;
577 if ( foundAnAlias == -1 )
587 <<
"Reading arguments and found:" << name.c_str()
589 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
594 int ismodel = modelist.
isModel( name );
598 <<
"Expected ';' but found:" << name.c_str()
600 report(
ERROR,
"EvtGen" ) <<
"Most probable error is omitted ';'." << endl;
601 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
604 }
while ( name !=
";" );
608 std::vector<std::string> copyMe = modelAliasList[foundAnAlias].getArgList();
609 temp_fcn_new_args = copyMe;
616 temp_fcn_new->
saveDecayInfo( ipar, n_daugh, daught, temp_fcn_new_args.size(),
617 temp_fcn_new_args, temp_fcn_new_model, brfr );
619 double massmin = 0.0;
629 decaytable[ipar.
getAlias()].addMode( temp_fcn_new, brfrsum, massmin );
631 }
while ( token !=
"Enddecay" );
633 decaytable[ipar.
getAlias()].finalize();
637 else if ( token ==
"CopyDecay" )
642 newname = parser.
getToken( itoken++ );
643 oldname = parser.
getToken( itoken++ );
648 if ( oldipar ==
EvtId( -1, -1 ) )
650 report(
ERROR,
"EvtGen" ) <<
"Unknown particle name:" << oldname.c_str() <<
" on line "
652 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
655 if ( newipar ==
EvtId( -1, -1 ) )
657 report(
ERROR,
"EvtGen" ) <<
"Unknown particle name:" << newname.c_str() <<
" on line "
659 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
662 if ( decaytable[newipar.
getAlias()].getNMode() != 0 )
664 report(
DEBUG,
"EvtGen" ) <<
"Redefining decay of " << newname << endl;
665 decaytable[newipar.
getAlias()].removeDecay();
671 else if ( token ==
"RemoveDecay" )
673 parent = parser.
getToken( itoken++ );
676 if ( ipar ==
EvtId( -1, -1 ) )
678 report(
ERROR,
"EvtGen" ) <<
"Unknown particle name:" << parent.c_str() <<
" on line "
680 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
684 if ( decaytable[ipar.
getAlias()].getNMode() == 0 )
685 {
report(
DEBUG,
"EvtGen" ) <<
"No decays to delete for " << parent.c_str() << endl; }
688 report(
DEBUG,
"EvtGen" ) <<
"Deleting selected decays of " << parent.c_str() << endl;
694 if ( token !=
"Enddecay" )
699 sdaug = parser.
getToken( itoken++ );
701 if ( daught[n_daugh - 1] ==
EvtId( -1, -1 ) )
704 <<
"Unknown particle name:" << sdaug.c_str() <<
" on line "
706 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
714 <<
"Expected ';' but found:" << token
716 report(
ERROR,
"EvtGen" ) <<
"Most probable error is omitted ';'." << endl;
717 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
720 token = parser.
getToken( itoken++ );
722 std::vector<std::string> temp_fcn_new_args;
723 std::string temp_fcn_new_model(
"PHSP" );
724 temp_fcn_new->
saveDecayInfo( ipar, n_daugh, daught, 0, temp_fcn_new_args,
725 temp_fcn_new_model, 0. );
726 decaytable[ipar.
getAlias()].removeMode( temp_fcn_new );
728 }
while ( token !=
"Enddecay" );
731 else if ( token !=
"End" )
734 report(
ERROR,
"EvtGen" ) <<
"Found unknown command:'" << token.c_str() <<
"' on line "
736 report(
ERROR,
"EvtGen" ) <<
"Will terminate execution!" << endl;
740 }
while ( ( token !=
"End" ) && itoken != parser.
getNToken() );
747 EvtId temp( ii, ii );
750 if ( nModTot == 0 )
continue;
755 for ( jj = 0; jj < nModTot; jj++ )
757 double tmass = decaytable[ii].getDecay( jj ).getMassMin();
758 if ( tmass < minMass ) minMass = tmass;
763 report(
INFO,
"EvtGen" ) <<
"Given allowed decays, resetting minMass "
772 int narg, std::string* args ) {
775 EvtId daugs_scratch[50];
785 model == decaytable[parent.
getAlias()].getDecay( i ).getDecayModel()->getModelName();
788 ( ndaug == decaytable[parent.
getAlias()].
getDecay( i ).getDecayModel()->getNDaug() );
790 ( narg == decaytable[parent.
getAlias()].
getDecay( i ).getDecayModel()->getNArg() );
795 for ( j = 0; j < ndaug; j++ ) { daugs_scratch[j] = daugs[j]; }
799 for ( j = 0; j < decaytable[parent.
getAlias()].
getDecay( i ).getDecayModel()->getNDaug();
803 for ( k = 0; k < ndaug; k++ )
805 if ( daugs_scratch[k] ==
806 decaytable[parent.
getAlias()].getDecay( i ).getDecayModel()->getDaug( j ) )
808 daugs_scratch[k] =
EvtId( -1, -1 );
815 right = right && ( nmatch == ndaug );
817 for ( j = 0; j < decaytable[parent.
getAlias()].
getDecay( i ).getDecayModel()->getNArg();
823 decaytable[parent.
getAlias()].
getDecay( i ).getDecayModel()->getArgStr( j ) );
826 if ( right )
return i;