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: EvtJscontCDF.cc
13 // Description: Routine to generate e+e- --> q\barq via Jetset
15 // Modification history:
17 // PCK August 4, 1997 Module created
19 //------------------------------------------------------------------------
21 #include "EvtGenBase/EvtPatches.hh"
24 #include "EvtGenBase/EvtParticle.hh"
25 #include "EvtGenBase/EvtDecayTable.hh"
26 #include "EvtGenBase/EvtPDL.hh"
27 #include "EvtGenModels/EvtJscontCDF.hh"
28 #include "EvtGenModels/EvtJetSetCDF.hh"
29 #include "EvtGenBase/EvtId.hh"
30 #include "EvtGenBase/EvtReport.hh"
35 extern void continuumcdf_(double *,int *,int *,int *,
36 double *,double *,double *,double *);
40 extern void lygive_(const char *cnfgstr,int length);
44 EvtJscontCDF::~EvtJscontCDF() {}
46 std::string EvtJscontCDF::getName(){
52 EvtDecayBase* EvtJscontCDF::clone(){
54 return new EvtJscontCDF;
58 void EvtJscontCDF::init(){
60 // check that there are 1 argument
67 void EvtJscontCDF::initProbMax(){
74 void EvtJscontCDF::decay( EvtParticle *p){
76 EvtJetSetCDF::jetSetInit();
87 sprintf(vak,"PARJ(13)=%f",val);
88 std::string temp(vak);
89 lygive_(temp.c_str(),strlen(temp.c_str()));
93 double energy=p->mass();
103 flavor=(int)getArg(0);
105 double px[100],py[100],pz[100],e[100];
107 if ( p->getNDaug() != 0 ) { return;}
110 continuumcdf_(&energy,&flavor,&ndaugjs,kf,px,py,pz,e);
112 for(i=0;i<ndaugjs;i++){
114 id[i]=EvtPDL::evtIdFromStdHep(kf[i]);
116 type[i]=EvtPDL::getSpinType(id[i]);
118 // have to protect against negative mass^2 for massless particles
119 // i.e. neutrinos and photons.
120 // this is uggly but I need to fix it right now....
122 if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i]){
124 e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000000001;
128 p4[i].set(e[i],px[i],py[i],pz[i]);
132 int channel=EvtDecayTable::inChannelList(p->getId(),ndaugjs,id);
134 more=((channel!=-1)&&(channel!=p->getChannel()));
139 p->makeDaughters(ndaugjs,id);
141 for(i=0;i<ndaugjs;i++){
142 p->getDaug(i)->init( id[i], p4[i] );