00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "EvtGenBase/EvtPatches.hh"
00023 #include <stdlib.h>
00024 #include "EvtGenBase/EvtParticle.hh"
00025 #include "EvtGenBase/EvtDecayTable.hh"
00026 #include "EvtGenBase/EvtDecayBase.hh"
00027 #include "EvtGenBase/EvtPDL.hh"
00028 #include "EvtGenModels/EvtPyGaGa.hh"
00029 #include "EvtGenModels/EvtPythia.hh"
00030 #include "EvtGenBase/EvtId.hh"
00031 #include "EvtGenBase/EvtReport.hh"
00032 #include <string.h>
00033 #include <iostream>
00034
00035 extern "C" {
00036 extern void pystat_(int &);
00037 }
00038
00039 extern "C" struct
00040 {
00041 int dc[18];
00042 } decaych_;
00043
00044 EvtPyGaGa::~EvtPyGaGa()
00045 {
00046 int i=1;
00047 pystat_(i);
00048 }
00049
00050 void EvtPyGaGa::getName(std::string& model_name)
00051 {
00052 model_name="PYGAGA";
00053 }
00054
00055 EvtDecayBase* EvtPyGaGa::clone()
00056 {
00057 return new EvtPyGaGa;
00058 }
00059
00060 void EvtPyGaGa::init()
00061 {
00062
00063 checkNArg(0);
00064 for( int i=0; i<18; i++)
00065 decaych_.dc[i]=0;
00066 }
00067
00068 void EvtPyGaGa::initProbMax()
00069 {
00070 noProbMax();
00071 }
00072
00073 void EvtPyGaGa::decay( EvtParticle *p)
00074 {
00075 EvtPythia::pythiaInit(1);
00076 EvtVector4R p4[100];
00077
00078 double energy=p->mass();
00079
00080 int i,more;
00081 int ndaugjs;
00082 int kf[100];
00083 EvtId id[100];
00084 int type[MAX_DAUG];
00085
00086 double px[100],py[100],pz[100],e[100];
00087
00088 if ( p->getNDaug() != 0 ) { return;}
00089 do{
00090 EvtPythia::pythiacont(&energy,&ndaugjs,kf,px,py,pz,e);
00091
00092 for(i=0;i<ndaugjs;i++)
00093 {
00094
00095 id[i]=EvtPDL::evtIdFromStdHep(kf[i]);
00096
00097 type[i]=EvtPDL::getSpinType(id[i]);
00098
00099
00100
00101
00102
00103 if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i])
00104 e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000000001;
00105
00106 p4[i].set(e[i],px[i],py[i],pz[i]);
00107
00108 }
00109
00110 int channel=EvtDecayTable::inChannelList(p->getId(),ndaugjs,id);
00111
00112 more=((channel!=-1)&&(channel!=p->getChannel()));
00113
00114 }while(more);
00115
00116 p->makeDaughters(ndaugjs,id);
00117
00118 for(i=0;i<ndaugjs;i++)
00119 p->getDaug(i)->init( id[i], p4[i] );
00120
00121 return ;
00122 }
00123