BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtPythia.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of the EvtGen package developed jointly
5// for the BaBar and CLEO collaborations. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See BelEvtGen/COPYRIGHT
9// Copyright (C) 1998 Caltech, UCSB
10//
11// Module: EvtJetSet.cc
12//
13// Description: Routine to use JetSet for decaying particles.
14//
15// Modification history:
16//
17// RYD July 24, 1997 Module created
18// RS October 28, 2002 copied from JETSET module
19//------------------------------------------------------------------------
20//
26#include "EvtGenBase/EvtPDL.hh"
29#include "EvtGenBase/EvtId.hh"
30#include <iostream>
31#include <iomanip>
32#include <fstream>
33#include <string.h>
34#include <stdlib.h>
35#include <unistd.h>
36#include <stdio.h>
37using std::endl;
38using std::fstream;
39using std::ios;
40using std::ofstream;
41using std::resetiosflags;
42using std::setiosflags;
43using std::setw;
44
45using std::string;
46
47int EvtPythia::njetsetdecays=0;
48 EvtDecayBasePtr* EvtPythia::jetsetdecays=0;
49int EvtPythia::ntable=0;
50
51int EvtPythia::ncommand=0;
52int EvtPythia::lcommand=0;
53std::string* EvtPythia::commands=0;
54
55extern "C" {
56 extern void pycontinuum_(double *,int *, int *,
57 double *,double *,double *,double *);
58}
59
60extern "C" {
61 extern void evtpythiainit_(const char* fname, int len);
62}
63
64extern "C" {
65 extern void init_cont_();
66}
67
68extern "C" {
69 extern void pythiadec_(int *,double *,int *,int *,int *,
70 double *,double *,double *,double *);
71}
72
73extern "C" {
74 extern void initpythia_(int *);
75}
76
77extern "C" {
78 extern void pygive_(const char *cnfgstr,int length);
79}
80
81extern "C" {
82 extern int pycomp_(int* kf);
83}
84
85extern "C" {
86 extern void pylist_(int &);
87}
88
89//common/CBBEAM/MAXIMUM
90extern "C" struct {
91double maximum;
93
95
97
98
99 int i;
100
101
102 //the deletion of commands is really uggly!
103
104 if (njetsetdecays==0) {
105 delete [] commands;
106 commands=0;
107 return;
108 }
109
110 for(i=0;i<njetsetdecays;i++){
111 if (jetsetdecays[i]==this){
112 jetsetdecays[i]=jetsetdecays[njetsetdecays-1];
113 njetsetdecays--;
114 if (njetsetdecays==0) {
115 delete [] commands;
116 commands=0;
117 }
118 return;
119 }
120 }
121
122 report(ERROR,"EvtGen") << "Error in destroying Pythia model!"<<endl;
123
124}
125
126
127void EvtPythia::getName(std::string& model_name){
128
129 model_name="PYTHIA";
130
131}
132
134
135 return new EvtPythia;
136
137}
138
139
141
142 noProbMax();
143
144}
145
146
148
149 checkNArg(1);
150
151
152 if (getParentId().isAlias()){
153
154 report(ERROR,"EvtGen") << "EvtPythia finds that you are decaying the"<<endl
155 << " aliased particle "
156 << EvtPDL::name(getParentId()).c_str()
157 << " with the Pythia model"<<endl
158 << " this does not work, please modify decay table."
159 << endl;
160 report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
161 ::abort();
162
163 }
164
165 store(this);
166
167}
168
169
171
172 return std::string("JetSetPar");
173
174}
175
176
177void EvtPythia::command(std::string cmd){
178
179 if (ncommand==lcommand){
180
181 lcommand=10+2*lcommand;
182
183 std::string* newcommands=new std::string[lcommand];
184
185 int i;
186
187 for(i=0;i<ncommand;i++){
188 newcommands[i]=commands[i];
189 }
190
191 delete [] commands;
192
193 commands=newcommands;
194
195 }
196
197 commands[ncommand]=cmd;
198
199 ncommand++;
200
201}
202
203void EvtPythia::pythiacont(double *energy, int *ndaugjs, int *kf,
204 double *px, double *py, double *pz, double *e)
205{
206 pycontinuum_(energy,ndaugjs,kf,px,py,pz,e);
207}
208
209
210
212
213 //added by Lange Jan4,2000
214 static EvtId STRNG=EvtPDL::getId("string");
215
216 int istdheppar=EvtPDL::getStdHep(p->getId());
217
218 if (pycomp_(&istdheppar)==0){
219 report(ERROR,"EvtGen") << "Pythia can not decay:"
220 <<EvtPDL::name(p->getId()).c_str()<<endl;
221 return;
222 }
223
224
225 double mp=p->mass();
226
227 EvtVector4R p4[20];
228
229 int i,more;
230 int ip=EvtPDL::getStdHep(p->getId());
231
232 int ndaugjs;
233 int kf[100];
234 EvtId evtnumstable[100],evtnumparton[100];
235 int stableindex[100],partonindex[100];
236 int numstable;
237 int numparton;
238 int km[100];
239 EvtId type[MAX_DAUG];
240
241 cbbeam_.maximum = mp; //pingrg
242 if(mp==0){std::cout<<"Particle "<<EvtPDL::name(p->getId())<<" has zero mass"<<std::endl;abort();}
243 pythiaInit(0);
244
245 double px[100],py[100],pz[100],e[100];
246 if ( p->getNDaug() != 0 ) { p->deleteDaughters(true);}
247
248 int count=0;
249
250 do{
251
252 pythiadec_(&ip,&mp,&ndaugjs,kf,km,px,py,pz,e);
253
254
255 numstable=0;
256 numparton=0;
257
258 for(i=0;i<ndaugjs;i++){
259 // std::cout<<"EvtPDL::evtIdFromStdHep(kf[i]),i= "<<i<<" "<<EvtPDL::evtIdFromStdHep(kf[i])<<std::endl;
260 if (EvtPDL::evtIdFromStdHep(kf[i])==EvtId(-1,-1)) {
261 report(ERROR,"EvtGen") << "Pythia returned particle:"<<kf[i]<<endl;
262 report(ERROR,"EvtGen") << "This can not be translated to evt number"<<endl;
263 report(ERROR,"EvtGen") << "and the decay will be rejected!"<<endl;
264 report(ERROR,"EvtGen") << "The decay was of particle:"<<ip<<endl;
265 int i=1;
266 pylist_(i);
267 }
268
269 //sort out the partons
270 if (abs(kf[i])<=6||kf[i]==21){
271 partonindex[numparton]=i;
272 evtnumparton[numparton]=EvtPDL::evtIdFromStdHep(kf[i]);
273 numparton++;
274 }
275 else{
276 stableindex[numstable]=i;
277 evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(kf[i]);
278 numstable++;
279 }
280
281
282 // have to protect against negative mass^2 for massless particles
283 // i.e. neutrinos and photons.
284 // this is uggly but I need to fix it right now....
285
286 if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i]){
287
288 e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000000001;
289
290 }
291
292 p4[i].set(e[i],px[i],py[i],pz[i]);
293
294
295 }
296
297 int channel= EvtDecayTable::inChannelList(p->getId(),numstable,evtnumstable);
298
299 more=(channel!=-1);
300
301
302 count++;
303
304 }while( more && (count<10000) );
305
306
307 if (count>9999) {
308 report(INFO,"EvtGen") << "Too many loops in EvtPythia!!!"<<endl;
309 report(INFO,"EvtGen") << "Parent:"<<EvtPDL::name(getParentId()).c_str()<<endl;
310 for(i=0;i<numstable;i++){
311 report(INFO,"EvtGen") << "Daug("<<i<<")"<<EvtPDL::name(evtnumstable[i]).c_str()<<endl;
312 }
313
314 }
315
316
317
318 if (numparton==0){
319
320 p->makeDaughters(numstable,evtnumstable);
321
322 for(i=0;i<numstable;i++){
323 p->getDaug(i)->init(evtnumstable[i],p4[stableindex[i]]);
324 }
325
326 fixPolarizations(p);
327
328 return ;
329
330 }
331 else{
332
333 //have partons in JETSET
334
335 EvtVector4R p4string(0.0,0.0,0.0,0.0);
336
337 for(i=0;i<numparton;i++){
338 p4string+=p4[partonindex[i]];
339 }
340
341 int nprimary=1;
342 type[0]=STRNG;
343 for(i=0;i<numstable;i++){
344 if (km[stableindex[i]]==0){
345 type[nprimary++]=evtnumstable[i];
346 }
347 }
348
349 p->makeDaughters(nprimary,type);
350
351 p->getDaug(0)->init(STRNG,p4string);
352
353 EvtVector4R p4partons[10];
354
355 for(i=0;i<numparton;i++){
356 p4partons[i]=p4[partonindex[i]];
357 }
358
359 ((EvtStringParticle*)p->getDaug(0))->initPartons(numparton,p4partons,evtnumparton);
360
361
362
363 nprimary=1;
364
365 for(i=0;i<numstable;i++){
366
367 if (km[stableindex[i]]==0){
368 p->getDaug(nprimary++)->init(evtnumstable[i],p4[stableindex[i]]);
369 }
370 }
371
372
373 int nsecond=0;
374 for(i=0;i<numstable;i++){
375 if (km[stableindex[i]]!=0){
376 type[nsecond++]=evtnumstable[i];
377 }
378 }
379
380
381 p->getDaug(0)->makeDaughters(nsecond,type);
382
383 nsecond=0;
384 for(i=0;i<numstable;i++){
385 if (km[stableindex[i]]!=0){
386 p4[stableindex[i]]=boostTo(p4[stableindex[i]],p4string);
387 p->getDaug(0)->getDaug(nsecond)->init(evtnumstable[i],p4[stableindex[i]]);
388 p->getDaug(0)->getDaug(nsecond)->setDiagonalSpinDensity();
389 p->getDaug(0)->getDaug(nsecond)->decay();
390 nsecond++;
391 }
392 }
393
394 fixPolarizations(p);
395
396 return ;
397
398 }
399
400}
401
402void EvtPythia::fixPolarizations(EvtParticle *p){
403
404 //special case for now to handle the J/psi polarization
405
406 int ndaug=p->getNDaug();
407
408 int i;
409
410 static EvtId Jpsi=EvtPDL::getId("J/psi");
411
412 for(i=0;i<ndaug;i++){
413 if(p->getDaug(i)->getId()==Jpsi){
414
415 EvtSpinDensity rho;
416
417 rho.SetDim(3);
418 rho.Set(0,0,0.5);
419 rho.Set(0,1,0.0);
420 rho.Set(0,2,0.0);
421
422 rho.Set(1,0,0.0);
423 rho.Set(1,1,1.0);
424 rho.Set(1,2,0.0);
425
426 rho.Set(2,0,0.0);
427 rho.Set(2,1,0.0);
428 rho.Set(2,2,0.5);
429
430 EvtVector4R p4Psi=p->getDaug(i)->getP4();
431
432 double alpha=atan2(p4Psi.get(2),p4Psi.get(1));
433 double beta=acos(p4Psi.get(3)/p4Psi.d3mag());
434
435
438
439 }
440 }
441
442}
443
444void EvtPythia::store(EvtDecayBase* jsdecay){
445
446 if (njetsetdecays==ntable){
447
448 EvtDecayBasePtr* newjetsetdecays=new EvtDecayBasePtr[2*ntable+10];
449 int i;
450 for(i=0;i<ntable;i++){
451 newjetsetdecays[i]=jetsetdecays[i];
452 }
453 ntable=2*ntable+10;
454 delete [] jetsetdecays;
455 jetsetdecays=newjetsetdecays;
456 }
457
458 jetsetdecays[njetsetdecays++]=jsdecay;
459
460
461
462}
463
464
465void EvtPythia::WritePythiaEntryHeader(ofstream &outdec, int lundkc,
466 EvtId evtnum,std::string name,
467 int chg, int cchg, int spin2,double mass,
468 double width, double maxwidth,double ctau,
469 int stable,double rawbrfrsum){
470
471 char sname[100];
472 char ccsname[100];
473
474 // RS changed to 16, new PYTHIA standard
475 int namelength=16;
476
477 int i,j;
478 int temp;
479 temp = spin2;
480
481 if (ctau>1000000.0) ctau=0.0;
482
483 strcpy(sname,name.c_str());
484
485 i=0;
486
487 while (sname[i]!=0){
488 i++;
489 }
490
491 // strip up to two + or -
492
493 if(evtnum.getId()>=0) {
494 if (sname[i-1]=='+'||sname[i-1]=='-'){
495 sname[i-1]=0;
496 i--;
497 }
498 if (sname[i-1]=='+'||sname[i-1]=='-'){
499 sname[i-1]=0;
500 i--;
501 }
502 // strip 0 except for _0 and chi...0
503 if (sname[i-1]=='0' && sname[i-2]!='_' && !(sname[0]=='c' && sname[1]=='h')){
504 sname[i-1]=0;
505 i--;
506 }
507 }
508
509 if (i>namelength) {
510 for(j=1;j<namelength;j++){
511 sname[j]=sname[j+i-namelength];
512 }
513 sname[namelength]=0;
514 }
515
516 // RS: copy name for cc particle
517 for(j=0;j<=namelength;j++)
518 ccsname[j]=sname[j];
519 i=0;
520 while (ccsname[i]!=' '){
521 i++;
522 if(ccsname[i]==0) break;
523 }
524 if(i<namelength)
525 {
526 ccsname[i]='b';
527 ccsname[i+1]=0;
528 }
529
530 //cchg=0;
531
532 if(evtnum.getId()>=0) {
533 if (abs(EvtPDL::getStdHep(evtnum))==21) cchg=2;
534 if (abs(EvtPDL::getStdHep(evtnum))==90) cchg=-1;
535 if ((abs(EvtPDL::getStdHep(evtnum))<=8)&&
536 (abs(EvtPDL::getStdHep(evtnum))!=0)) cchg=1;
537
538 }
539
540 // RS output format changed to new PYTHIA style
541 outdec << " " << setw(9) << lundkc;
542 outdec << " ";
543 outdec.width(namelength);
544 outdec << setiosflags(ios::left)
545 << sname;
546 // RS: name for cc paricle
547 if ((evtnum.getId()>=0) && (EvtPDL::chargeConj(evtnum)!=evtnum))
548 {
549 outdec << " ";
550 outdec.width(namelength);
551 outdec << ccsname;
552 }else{
553 // 2+16 spaces
554 outdec << " ";
555 }
556
557 outdec << resetiosflags(ios::left);
558 outdec << setw(3) << chg;
559 outdec << setw(3) << cchg;
560 outdec.width(3);
561 if (evtnum.getId()>=0) {
562 if (EvtPDL::chargeConj(evtnum)==evtnum) {
563 outdec << 0;
564 }
565 else{
566 outdec << 1;
567 }
568 }
569 else{
570 outdec << 0;
571 }
572 outdec.setf(ios::fixed,ios::floatfield);
573 outdec.precision(5);
574 outdec << setw(12) << mass;
575 outdec.setf(ios::fixed,ios::floatfield);
576 outdec << setw(12) << width;
577 outdec.setf(ios::fixed,ios::floatfield);
578 outdec.width(12);
579 if (fabs(width)<0.0000000001) {
580 outdec << 0.0 ;
581 }
582 else{
583 outdec << maxwidth;
584 }
585 // scientific notation ... outdec << setw(14) << ctau;
586 outdec.setf(ios::scientific,ios::floatfield);
587 outdec << " ";
588 outdec << ctau;
589 outdec.width(3);
590 if (evtnum.getId()>=0) {
591 if (ctau>1.0 || rawbrfrsum<0.000001) {
592 stable=0;
593 }
594 }
595 //resonance width treatment
596 outdec.width(3);
597 outdec << 0;
598 outdec.width(3);
599 outdec << stable;
600 outdec << endl;
601 outdec.width(0);
602 //outdec.setf(0,0);
603
604}
605
606void EvtPythia::WritePythiaParticle(ofstream &outdec,EvtId ipar,
607 EvtId iparname,int &first){
608
609 int ijetset;
610
611 double br_sum=0.0;
612
613 for(ijetset=0;ijetset<njetsetdecays;ijetset++){
614
615 if (jetsetdecays[ijetset]->getParentId()==ipar){
616 br_sum+=jetsetdecays[ijetset]->getBranchingFraction();
617 }
618 if (jetsetdecays[ijetset]->getParentId()!=
619 EvtPDL::chargeConj(jetsetdecays[ijetset]->getParentId())&&
620 EvtPDL::chargeConj(jetsetdecays[ijetset]->getParentId())==ipar){
621 br_sum+=jetsetdecays[ijetset]->getBranchingFraction();
622 }
623
624
625 }
626
627 double br_sum_true=br_sum;
628
629 if (br_sum<0.000001) br_sum=1.0;
630
631 for(ijetset=0;ijetset<njetsetdecays;ijetset++){
632 if (jetsetdecays[ijetset]->getParentId()==ipar){
633
634 double br=jetsetdecays[ijetset]->getBranchingFraction();
635
636 int i,daugs[5];
637 EvtId cdaugs[5];
638
639 for(i=0;i<5;i++){
640
641 if(i<jetsetdecays[ijetset]->getNDaug()){
642 daugs[i]=EvtPDL::getStdHep(
643 jetsetdecays[ijetset]->getDaugs()[i]);
644 cdaugs[i]=EvtPDL::chargeConj(jetsetdecays[ijetset]->getDaugs()[i]);
645 }
646 else{
647 daugs[i]=0;
648 }
649 }
650
651 int channel;
652
654 jetsetdecays[ijetset]->getModelName(),
655 jetsetdecays[ijetset]->getNDaug(),
656 cdaugs,
657 jetsetdecays[ijetset]->getNArg(),
658 jetsetdecays[ijetset]->getArgsStr());
659
660 if (jetsetdecays[ijetset]->getModelName()=="PYTHIA"){
661
662 if (first) {
663 first=0;
664 WritePythiaEntryHeader(outdec,
665 //EvtPDL::getLundKC(iparname),
666 EvtPDL::getStdHep(iparname),
667 iparname,
668 EvtPDL::name(iparname),
669 EvtPDL::chg3(iparname),
670 0,0,EvtPDL::getMeanMass(ipar),
671 EvtPDL::getWidth(ipar),
673 EvtPDL::getctau(ipar),1,br_sum_true);
674 }
675
676 int dflag=2;
677
678 if (EvtPDL::getStdHep(ipar)<0) {
679 dflag=3;
680 for(i=0;i<jetsetdecays[ijetset]->getNDaug();i++){
681 daugs[i]=EvtPDL::getStdHep(cdaugs[i]);
682 }
683
684 }
685
686 /* RS
687 PYTHIA allows to introduce new particles via a call to PYUPDA
688 so no need for this check any more
689
690 //now lets check to make sure that jetset, lucomp, knows
691 //about all particles!
692 int unknown=0;
693 for(i=0;i<jetsetdecays[ijetset]->getNDaug();i++){
694 if (pycomp_(&daugs[i])==0) {
695 unknown=1;
696 report(ERROR,"EvtGen") << "Pythia (pycomp) does not "
697 << "know the particle:"<<
698 EvtPDL::name(jetsetdecays[ijetset]->getDaugs()[i])<<endl;
699 }
700 }
701
702 int istdheppar=EvtPDL::getStdHep(ipar);
703
704 if (pycomp_(&istdheppar)==0){
705 unknown=1;
706 report(ERROR,"EvtGen") << "Pythia (pycomp) does not "
707 << "know the particle:"<<
708 EvtPDL::name(ipar)<<endl;
709 }
710
711
712
713 if (unknown){
714 report(ERROR,"EvtGen") << "Therfore the decay:"<<endl;
715 report(ERROR,"EvtGen") << EvtPDL::name(jetsetdecays[ijetset]->getParentId())<<" -> ";
716 for(i=0;i<jetsetdecays[ijetset]->getNDaug();i++){
717 report(ERROR,"") << EvtPDL::name(jetsetdecays[ijetset]->getDaugs()[i])<<" ";
718 }
719 report(ERROR,"")<<endl;
720 report(ERROR,"EvtGen")<<"Will not be generated."<<endl;
721 return;
722 }
723 */
724
725 if (EvtPDL::chargeConj(ipar)==ipar) {
726 dflag=1;
727 //report(INFO,"EvtGen") << EvtPDL::name(iparname) << " dflag=1 because C(ipar)=ipar!"<<endl;
728 }
729
730
731 //if (channel>=0) {
732 // dflag=1;
733 //report(INFO,"EvtGen") << EvtPDL::name(iparname) << " dflag=1 because channel>=0"<<endl;
734 //}
735
736 // if (!(EvtPDL::getStdHep(ipar)<0&&channel>=0)){
737 if (1){
738
739 // RS changed format to new PYTHIA one
740 outdec << " ";
741 outdec.width(5);
742 outdec <<dflag;
743 outdec.width(5);
744 outdec <<(int)jetsetdecays[ijetset]->getArgs()[0];
745 outdec.width(12);
746 if (fabs(br)<0.000000001) {
747 outdec <<"0.00000";
748 }
749 else{
750 outdec <<br/br_sum;
751 }
752 outdec.width(10);
753 outdec <<daugs[0];
754 outdec.width(10);
755 outdec <<daugs[1];
756 outdec.width(10);
757 outdec <<daugs[2];
758 outdec.width(10);
759 outdec <<daugs[3];
760 outdec.width(10);
761 outdec <<daugs[4];
762 outdec<<endl;
763 outdec.width(0);
764 }
765 }
766 }
767 }
768}
769
770bool
771EvtPythia::diquark(int ID)
772{
773 switch(ID)
774 {
775 case 1103:
776 case 2101:
777 case 2103:
778 case 2203:
779 case 3101:
780 case 3103:
781 case 3201:
782 case 3203:
783 case 3303:
784 case 4101:
785 case 4103:
786 case 4201:
787 case 4203:
788 case 4301:
789 case 4303:
790 case 4403:
791 case 5101:
792 case 5103:
793 case 5201:
794 case 5203:
795 case 5301:
796 case 5303:
797 case 5401:
798 case 5403:
799 case 5503:
800 return true;
801 break;
802 default:
803 return false;
804 break;
805 }
806}
807
808double
809EvtPythia::NominalMass(int ID)
810{
811 // return default mass in PYTHIA
812 switch(ID)
813 {
814 case 1103:
815 return 0.77133;
816 case 2101:
817 return 0.57933;
818 case 2103:
819 return 0.77133;
820 case 2203:
821 return 0.77133;
822 case 3101:
823 return 0.80473;
824 case 3103:
825 return 0.92953;
826 case 3201:
827 return 0.80473;
828 case 3203:
829 return 0.92953;
830 case 3303:
831 return 1.09361;
832 case 4101:
833 return 1.96908;
834 case 4103:
835 return 2.00808;
836 case 4201:
837 return 1.96908;
838 case 4203:
839 return 2.00808;
840 case 4301:
841 return 2.15432;
842 case 4303:
843 return 2.17967;
844 case 4403:
845 return 3.27531;
846 case 5101:
847 return 5.38897;
848 case 5103:
849 return 5.40145;
850 case 5201:
851 return 5.38897;
852 case 5203:
853 return 5.40145;
854 case 5301:
855 return 5.56725;
856 case 5303:
857 return 5.57536;
858 case 5401:
859 return 6.67143;
860 case 5403:
861 return 6.67397;
862 case 5503:
863 return 10.07354;
864 break;
865 default:
866 return 0.0;
867 break;
868 }
869}
870
871int
873{
874 // return default mass in PYTHIA
875 switch(ID)
876 {
877 case 1103:
878 return -2;
879 case 2101:
880 return 1;
881 case 2103:
882 return 1;
883 case 2203:
884 return 4;
885 case 3101:
886 return -2;
887 case 3103:
888 return -2;
889 case 3201:
890 return 1;
891 case 3203:
892 return 1;
893 case 3303:
894 return -2;
895 case 4101:
896 return 1;
897 case 4103:
898 return 1;
899 case 4201:
900 return 4;
901 case 4203:
902 return 4;
903 case 4301:
904 return 1;
905 case 4303:
906 return 1;
907 case 4403:
908 return 4;
909 case 5101:
910 return -2;
911 case 5103:
912 return -2;
913 case 5201:
914 return 1;
915 case 5203:
916 return 1;
917 case 5301:
918 return -2;
919 case 5303:
920 return -2;
921 case 5401:
922 return 1;
923 case 5403:
924 return 1;
925 case 5503:
926 return -2;
927 break;
928 default:
929 return 0;
930 break;
931 }
932}
933
934void EvtPythia::MakePythiaFile(char* fname){
935
936 EvtId ipar;
937 int lundkc;
938
939 //int part_list[MAX_PART];
940
941 ofstream outdec;
942
943 outdec.open(fname);
944
945 //outdec << "ERROR;"<<endl;
946 //outdec << ";"<<endl;
947 //outdec << ";This decayfile has been automatically created by"<<endl;
948 //outdec << ";EvtGen from the DECAY.DEC file"<<endl;
949 //outdec << ";"<<endl;
950
951 int nokcentry;
952
953 for(lundkc=1;lundkc<500;lundkc++){
954
955 nokcentry=1;
956
957 int iipar;
958
959 for(iipar=0;iipar<EvtPDL::entries();iipar++){
960
961 ipar=EvtId(iipar,iipar);
962 //no aliased particles!
963 std::string tempStr = EvtPDL::name(ipar);
964 EvtId realId = EvtPDL::getId(tempStr);
965 if ( realId.isAlias() != 0 ) continue;
966
967 if(!(
968 EvtPDL::getStdHep(ipar)==21 ||
969 EvtPDL::getStdHep(ipar)==22 ||
970 EvtPDL::getStdHep(ipar)==23))
971 {
972
973 if (lundkc==EvtPDL::getLundKC(ipar)){
974
975 nokcentry=0;
976
977 int first=1;
978
979 WritePythiaParticle(outdec,ipar,ipar,first);
980
981
982 EvtId ipar2=EvtPDL::chargeConj(ipar);
983
984
985 if (ipar2!=ipar){
986 WritePythiaParticle(outdec,ipar2,ipar,first);
987 }
988
989 if (first){
990 WritePythiaEntryHeader(outdec,
991 //EvtPDL::getLundKC(ipar),
992 EvtPDL::getStdHep(ipar),
993 ipar,
994 EvtPDL::name(ipar),
995 EvtPDL::chg3(ipar),
996 0,0,EvtPDL::getMeanMass(ipar),
997 EvtPDL::getWidth(ipar),
999 EvtPDL::getctau(ipar),0,0.0);
1000
1001 }
1002 }
1003 }
1004 }
1005 if (lundkc==99999) // Write out diquarks after quarks, but only once
1006 for(iipar=0;iipar<EvtPDL::entries();iipar++){
1007
1008 ipar=EvtId(iipar,iipar);
1009
1010 if (diquark(EvtPDL::getStdHep(ipar))){
1011
1012 nokcentry=0;
1013
1014 int first=1;
1015
1016 WritePythiaParticle(outdec,ipar,ipar,first);
1017
1018
1019 EvtId ipar2=EvtPDL::chargeConj(ipar);
1020
1021
1022 if (ipar2!=ipar){
1023 WritePythiaParticle(outdec,ipar2,ipar,first);
1024 }
1025
1026 if (first){
1027 WritePythiaEntryHeader(outdec,
1028 EvtPDL::getStdHep(ipar),
1029 ipar,
1030 EvtPDL::name(ipar),
1032 -1,0,
1033 NominalMass(EvtPDL::getStdHep(ipar)),
1034 0, 0, 0, 0,0.0);
1035
1036 }
1037 }
1038 }
1039 /* if (nokcentry){
1040
1041 WritePythiaEntryHeader(outdec,
1042 lundkc,EvtId(-1,-1)," ",
1043 0,0,0,EvtPDL::getNominalMass(ipar),0.0,0.0,
1044 EvtPDL::getctau(ipar),0,0.0);
1045
1046 } */
1047 }
1048 outdec.close();
1049}
1050
1052
1053 static int first=1;
1054 if (first){
1055
1056 first=0;
1057
1058 report(INFO,"EvtGen") << "Will initialize Pythia."<<endl;
1059 for(int i=0;i<ncommand;i++)
1060 pygive_(commands[i].c_str(),strlen(commands[i].c_str()));
1061
1062 char fname[200];
1063
1064 char hostBuffer[100];
1065
1066 if ( gethostname( hostBuffer, 100 ) != 0 ){
1067 report(ERROR,"EvtGen") << " couldn't get hostname." << endl;
1068 strncpy( hostBuffer, "hostnameNotFound", 100 );
1069 }
1070
1071 char pid[100];
1072
1073 int thePid=getpid();
1074
1075 if ( sprintf( pid, "%d", thePid ) == 0 ){
1076 report(ERROR,"EvtGen") << " couldn't get process ID." << endl;
1077 strncpy( pid, "666", 100 );
1078 }
1079
1080 strcpy(fname,"jet.d-");
1081 strcat(fname,hostBuffer);
1082 strcat(fname,"-");
1083 strcat(fname,pid);
1084
1085 MakePythiaFile(fname);
1086 evtpythiainit_(fname,strlen(fname));
1087 initpythia_(&dummy);
1088
1089 if (0==getenv("EVTSAVEJETD")){
1090 char delcmd[300];
1091 strcpy(delcmd,"rm -f ");
1092 strcat(delcmd,fname);
1093 system(delcmd);
1094 }
1095
1096 report(INFO,"EvtGen") << "Done initializing Pythia."<<endl;
1097
1098 }
1099
1100}
double mass
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
const int MAX_DAUG
Definition: EvtParticle.hh:38
DOUBLE_PRECISION count[3]
struct @18 cbbeam_
void initpythia_(int *)
int NominalCharge(int ID)
Definition: EvtPythia.cc:872
double maximum
Definition: EvtPythia.cc:91
void init_cont_()
void pygive_(const char *cnfgstr, int length)
void pycontinuum_(double *, int *, int *, double *, double *, double *, double *)
void pylist_(int &)
void evtpythiainit_(const char *fname, int len)
struct @24 cbbeam_
void pythiadec_(int *, double *, int *, int *, int *, double *, double *, double *, double *)
void initpythia_(int *)
int pycomp_(int *kf)
ostream & report(Severity severity, const char *facility)
Definition: EvtReport.cc:36
@ ERROR
Definition: EvtReport.hh:49
@ INFO
Definition: EvtReport.hh:52
const double alpha
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition: KK2f.h:50
std::string * getArgsStr()
Definition: EvtDecayBase.hh:73
void noProbMax()
std::string getModelName()
Definition: EvtDecayBase.hh:76
EvtId getParentId()
Definition: EvtDecayBase.hh:60
double * getArgs()
double getBranchingFraction()
Definition: EvtDecayBase.hh:61
EvtId * getDaugs()
Definition: EvtDecayBase.hh:65
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
void setDaughterSpinDensity(int daughter)
static int findChannel(EvtId parent, std::string model, int ndaug, EvtId *daugs, int narg, std::string *args)
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
Definition: EvtId.hh:27
int getId() const
Definition: EvtId.hh:41
int isAlias() const
Definition: EvtId.hh:45
static double getWidth(EvtId i)
Definition: EvtPDL.hh:54
static int getStdHep(EvtId id)
Definition: EvtPDL.hh:56
static double getMeanMass(EvtId i)
Definition: EvtPDL.hh:45
static int entries()
Definition: EvtPDL.hh:67
static EvtId evtIdFromStdHep(int stdhep)
Definition: EvtPDL.cc:244
static std::string name(EvtId i)
Definition: EvtPDL.hh:64
static EvtId chargeConj(EvtId id)
Definition: EvtPDL.cc:208
static double getMinMass(EvtId i)
Definition: EvtPDL.hh:51
static int chg3(EvtId i)
Definition: EvtPDL.hh:60
static int getLundKC(EvtId id)
Definition: EvtPDL.hh:57
static EvtId getId(const std::string &name)
Definition: EvtPDL.cc:287
static double getctau(EvtId i)
Definition: EvtPDL.hh:55
void setSpinDensityForwardHelicityBasis(const EvtSpinDensity &rho)
Definition: EvtParticle.cc:178
void makeDaughters(int ndaug, EvtId *id)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
void decay()
Definition: EvtParticle.cc:404
EvtId getId() const
Definition: EvtParticle.cc:113
void setDiagonalSpinDensity()
Definition: EvtParticle.cc:133
const EvtVector4R & getP4() const
Definition: EvtParticle.cc:121
int getNDaug() const
Definition: EvtParticle.cc:125
EvtParticle * getDaug(int i)
Definition: EvtParticle.cc:85
void deleteDaughters(bool keepChannel=false)
Definition: EvtParticle.cc:540
double mass() const
Definition: EvtParticle.cc:127
static void pythiaInit(int f)
Definition: EvtPythia.cc:1051
virtual ~EvtPythia()
Definition: EvtPythia.cc:96
void initProbMax()
Definition: EvtPythia.cc:140
static void pythiacont(double *, int *, int *, double *, double *, double *, double *)
Definition: EvtPythia.cc:203
void command(std::string cmd)
Definition: EvtPythia.cc:177
void decay(EvtParticle *p)
Definition: EvtPythia.cc:211
void getName(std::string &name)
Definition: EvtPythia.cc:127
std::string commandName()
Definition: EvtPythia.cc:170
EvtDecayBase * clone()
Definition: EvtPythia.cc:133
void init()
Definition: EvtPythia.cc:147
void Set(int i, int j, const EvtComplex &rhoij)
void SetDim(int n)
double get(int i) const
Definition: EvtVector4R.hh:179
double d3mag() const
Definition: EvtVector4R.cc:186
void set(int i, double d)
Definition: EvtVector4R.hh:183
const double mp
Definition: incllambda.cxx:45
Index first(Pair i)
Definition: EvtCyclic3.cc:195