1 //--------------------------------------------------------------------------
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.
8 // Copyright Information: See EvtGen/COPYRIGHT
9 // Copyright (C) 1998 Caltech, UCSB
11 // Module: EvtPycont.cc
13 // Description: Routine to generate e+e- --> q\barq via Jetset
15 // Modification history:
17 // PCK August 4, 1997 Module created
18 // RS October 28, 2002 copied from EvtJscont.cc
20 //------------------------------------------------------------------------
22 #include "EvtGenBase/EvtPatches.hh"
24 #include "EvtGenBase/EvtParticle.hh"
25 #include "EvtGenBase/EvtDecayTable.hh"
26 #include "EvtGenBase/EvtDecayBase.hh"
27 #include "EvtGenBase/EvtPDL.hh"
28 #include "EvtGenModels/EvtPyGaGa.hh"
29 #include "EvtGenModels/EvtPythia.hh"
30 #include "EvtGenBase/EvtId.hh"
31 #include "EvtGenBase/EvtReport.hh"
36 extern void pystat_(int &);
44 EvtPyGaGa::~EvtPyGaGa()
50 std::string EvtPyGaGa::getName()
55 EvtDecayBase* EvtPyGaGa::clone()
60 void EvtPyGaGa::init()
62 // check that there are 1 argument
64 for( int i=0; i<18; i++)
68 void EvtPyGaGa::initProbMax()
73 void EvtPyGaGa::decay( EvtParticle *p)
75 EvtPythia::pythiaInit(1);
78 double energy=p->mass();
86 double px[100],py[100],pz[100],e[100];
88 if ( p->getNDaug() != 0 ) { return;}
90 EvtPythia::pythiacont(&energy,&ndaugjs,kf,px,py,pz,e);
92 for(i=0;i<ndaugjs;i++)
95 id[i]=EvtPDL::evtIdFromStdHep(kf[i]);
97 type[i]=EvtPDL::getSpinType(id[i]);
99 // have to protect against negative mass^2 for massless particles
100 // i.e. neutrinos and photons.
101 // this is uggly but I need to fix it right now....
103 if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i])
104 e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000000001;
106 p4[i].set(e[i],px[i],py[i],pz[i]);
110 int channel=EvtDecayTable::inChannelList(p->getId(),ndaugjs,id);
112 more=((channel!=-1)&&(channel!=p->getChannel()));
116 p->makeDaughters(ndaugjs,id);
118 for(i=0;i<ndaugjs;i++)
119 p->getDaug(i)->init( id[i], p4[i] );