83 {
84
87 int i;
88
89 report(
INFO,
"EvtGen") <<
"In readDecayFile, reading:"<<dec_name.c_str()<<endl;
90
92
93 fin.open(dec_name.c_str());
94 if (!fin) {
95 report(
ERROR,
"EvtGen") <<
"Could not open "<<dec_name.c_str()<<endl;
96 }
97 fin.close();
98
100 parser.
Read(dec_name);
101
102 int itok;
103
104 int hasend=0;
105
106 std::string token;
107
108 for(itok=0;itok<parser.
getNToken();itok++){
109
111
112 if (token=="End") hasend=1;
113
114 }
115
116 if (!hasend){
117 report(
ERROR,
"EvtGen") <<
"Could not find an 'End' in "<<dec_name.c_str()<<endl;
118 report(
ERROR,
"EvtGen") <<
"Will terminate execution."<<endl;
119 ::abort();
120 }
121
122
123
124 std::string model,parent,sdaug;
125
127
128 int n_daugh;
130 double brfr;
131
132 int itoken=0;
133
134 std::vector<EvtModelAlias> modelAliasList;
135
136
137 do{
138
140
141
142 if (token=="noPhotos"){
145 << "As requested, PHOTOS will be turned off."<<endl;
146 }
147 else if (token=="yesPhotos"){
150 << "As requested, PHOTOS will be turned on."<<endl;
151 }
152 else if (token=="normalPhotos"){
155 << "As requested, PHOTOS will be turned on only when requested."<<endl;
156 }
157 else if (token=="Alias"){
158
159 std::string newname;
160 std::string oldname;
161
164
166
167 if (
id==
EvtId(-1,-1)) {
168 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<oldname.c_str()
170 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
171 ::abort();
172 }
173
176
177 } else if (token=="ModelAlias"){
178 std::vector<std::string> modelArgList;
179
180 std::string aliasName=parser.
getToken(itoken++);
181 std::string modelName=parser.
getToken(itoken++);
182
183 std::string nameTemp;
184 do{
186 if (nameTemp!=";") {
187 modelArgList.push_back(nameTemp);
188 }
189 }while(nameTemp!=";");
191 modelAliasList.push_back(newAlias);
192 } else if (token=="ChargeConj"){
193
194 std::string aname;
195 std::string abarname;
196
199
202
203 if (a==
EvtId(-1,-1)) {
204 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<aname.c_str()
206 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
207 ::abort();
208 }
209
210 if (abar==
EvtId(-1,-1)) {
211 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<abarname.c_str()
213 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
214 ::abort();
215 }
216
217
219
221
222 std::string cnfgstr;
223
225
227
228 } else if (token=="CDecay"){
229
230 std::string name;
231
234
235 if (ipar==
EvtId(-1,-1)) {
236 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<name.c_str()
237 <<" on line "
239 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
240 ::abort();
241 }
242
244
245 if (decaytable[ipar.
getAlias()].getNMode()!=0) {
246
248 "Redefined decay of "<<name.c_str()<<" in CDecay"<<endl;
249
250 decaytable[ipar.
getAlias()].removeDecay();
251 }
252
253
255
256 } else if (token=="Define"){
257
258 std::string name;
259
261
262
264
265
266
267
268 } else if (token=="Particle"){
269
270 std::string pname;
272 report(
INFO,
"EvtGen") << pname.c_str() << endl;
273
274 double newMass=atof(parser.
getToken(itoken++).c_str());
278
279
282
283 report(
INFO,
"EvtGen") <<
"Changing particle properties of " <<
284 pname.c_str() << " Mass=" << newMass << " Width="<<newWidth<<endl;
285
286 } else if ( token=="ChangeMassMin") {
287 std::string pname;
289 double tmass=atof(parser.
getToken(itoken++).c_str());
290
293 report(
DEBUG,
"EvtGen") <<
"Refined minimum mass for " <<
EvtPDL::name(thisPart).c_str() <<
" to be " << tmass << endl;
294
295 } else if ( token=="ChangeMassMax") {
296 std::string pname;
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;
302
303 } else if ( token=="IncludeBirthFactor") {
304 std::string pname;
306 bool yesno=false;
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;
312
313
314 } else if ( token=="IncludeDecayFactor") {
315 std::string pname;
317 bool yesno=false;
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;
323
324 }else if ( token=="AddFactorPn") {
325 std::string pname;
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") {
332 std::string pname;
335 std::string tstr="NONRELBW";
338 } else if ( token=="SP6LSFIX") {
339 std::string pname;
344
345 } else if ( token=="LSFLAT") {
346 std::string pname;
349 std::string tstr="FLAT";
352 } else if ( token=="LSMANYDELTAFUNC") {
353 std::string pname;
356 std::string tstr="MANYDELTAFUNC";
359
360 } else if ( token=="BlattWeisskopf") {
361 std::string pname;
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") {
368 std::string pname;
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;
378
379 } else if (token=="Decay") {
380
381 std::string temp_fcn_new_model;
382
384
385 double brfrsum=0.0;
386
387
388
391
392 if (ipar==
EvtId(-1,-1)) {
393 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<parent.c_str()
394 <<" on line "
396 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
397 ::abort();
398 }
399
400 if (decaytable[ipar.
getAlias()].getNMode()!=0) {
402 <<parent.c_str()<<endl;
403 decaytable[ipar.
getAlias()].removeDecay();
404 }
405
406
407 do{
408
410
411 if (token!="Enddecay"){
412
413 i=0;
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;
423 ::abort();
424 }
425 }
426
427 brfr=atof(token.c_str());
428
431
432 if (!(isname||ismodel)){
433
434 int iAlias;
435 for(iAlias=0;iAlias<modelAliasList.size();iAlias++){
436 if ( modelAliasList[iAlias].matchAlias(parser.
getToken(itoken)) ) {
437 ismodel=2;
438 break;
439 }
440 }
441 }
442
443 if (!(isname||ismodel)){
444
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";
454 ::abort();
455
456 itoken++;
457 }
458
459 n_daugh=0;
460
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;
468 ::abort();
469 }
470 }
471
472
474
475
476 int photos=0;
477 int verbose=0;
478 int summary=0;
479
480 do{
481 if (model=="PHOTOS"){
482 photos=1;
484 }
485 if (model=="VERBOSE"){
486 verbose=1;
488 }
489 if (model=="SUMMARY"){
490 summary=1;
492 }
493 }while(model=="PHOTOS"||
494 model=="VERBOSE"||
495 model=="SUMMARY");
496
497
498 int iAlias;
499 int foundAnAlias=-1;
500 for(iAlias=0;iAlias<modelAliasList.size();iAlias++){
501 if ( modelAliasList[iAlias].matchAlias(model) ) {
502 foundAnAlias=iAlias;
503 break;
504 }
505 }
506
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;
514 ::abort();
515 }
516 }
517 else{
518 model=modelAliasList[foundAnAlias].getName();
519 }
520
521 temp_fcn_new_model=model;
522 temp_fcn_new=modelist.
getFcn(model);
523
524
525 if (photos){
527 }
528 if (verbose){
530 }
531 if (summary){
533 }
534
535
536 std::vector<std::string> temp_fcn_new_args;
537
538 std::string name;
539 int ierr;
540
541 if ( foundAnAlias==-1 ) {
542 do{
544 if (name!=";") {
546 if (ierr) {
548 <<"Reading arguments and found:"<<
549 name.c_str()<<" on line:"<<
552 << "Will terminate execution!"<<endl;
553 ::abort();
554 }
555 }
556
557 int ismodel=modelist.
isModel(name);
558 if (ismodel) {
560 <<"Expected ';' but found:"<<
561 name.c_str()<<" on line:"<<
564 << "Most probable error is omitted ';'."<<endl;
566 << "Will terminate execution!"<<endl;
567 ::abort();
568 }
569 }while(name!=";");
570 }
571 else{
572 std::vector<std::string> copyMe=modelAliasList[foundAnAlias].getArgList();
573 temp_fcn_new_args=copyMe;
574 itoken++;
575 }
576
577
578 brfrsum+=brfr;
579
581 daught,
582 temp_fcn_new_args.size(),
583 temp_fcn_new_args,
584 temp_fcn_new_model,
585 brfr);
586
587 double massmin=0.0;
588
589
593 } else {
595 }
596 }
597
598 decaytable[ipar.
getAlias()].addMode(temp_fcn_new,brfrsum,massmin);
599
600
601 }
602 } while(token!="Enddecay");
603
604 decaytable[ipar.
getAlias()].finalize();
605
606 }
607
608
609 else if (token=="CopyDecay") {
610 std::string newname;
611 std::string oldname;
612
615
618
619 if (oldipar==
EvtId(-1,-1)) {
620 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<oldname.c_str()
622 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
623 ::abort();
624 }
625 if (newipar==
EvtId(-1,-1)) {
626 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<newname.c_str()
628 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
629 ::abort();
630 }
631 if (decaytable[newipar.
getAlias()].getNMode()!=0) {
633 <<newname<<endl;
634 decaytable[newipar.
getAlias()].removeDecay();
635 }
637 }
638
639
640 else if (token=="RemoveDecay") {
643
644 if (ipar==
EvtId(-1,-1)) {
645 report(
ERROR,
"EvtGen") <<
"Unknown particle name:"<<parent.c_str()
646 <<" on line "
648 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
649 ::abort();
650 }
651
652 if (decaytable[ipar.
getAlias()].getNMode()==0) {
653 report(
DEBUG,
"EvtGen") <<
"No decays to delete for "
654 << parent.c_str() << endl;
655 } else {
656 report(
DEBUG,
"EvtGen") <<
"Deleting selected decays of "
657 <<parent.c_str()<<endl;
658 }
659
660 do {
662
663 if (token != "Enddecay") {
664 n_daugh = 0;
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;
672 ::abort();
673 }
674 }
676 if (token != ";") {
678 <<"Expected ';' but found:"<<
679 token <<" on line:"<<
682 << "Most probable error is omitted ';'."<<endl;
684 << "Will terminate execution!"<<endl;
685 ::abort();
686 }
689 std::vector<std::string> temp_fcn_new_args;
690 std::string temp_fcn_new_model("PHSP");
692 daught,
693 0,
694 temp_fcn_new_args,
695 temp_fcn_new_model,
696 0.);
697 decaytable[ipar.
getAlias()].removeMode(temp_fcn_new);
698 }
699 } while (token != "Enddecay");
700 itoken++;
701 }
702 else if (token!="End"){
703
704 report(
ERROR,
"EvtGen") <<
"Found unknown command:'"<<token.c_str()<<
"' on line "
706 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
707 ::abort();
708
709 }
710
711 }
while ((token!=
"End")&&itoken!=parser.
getNToken());
712
713
714
715 int ii;
719
720 if ( nModTot == 0 ) continue;
721
723 int jj;
725 for (jj=0; jj<nModTot; jj++) {
726 double tmass=decaytable[ii].getDecay(jj).getMassMin();
727 if ( tmass< minMass) minMass=tmass;
728 }
730
734 }
735 }
736
737
738}
ostream & report(Severity severity, const char *facility)
void saveDecayInfo(EvtId ipar, int ndaug, EvtId *daug, int narg, std::vector< std::string > &args, std::string name, double brfr)
virtual int nRealDaughters()
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)