00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "EvtGenBase/EvtPatches.hh"
00022 #include <stdlib.h>
00023 #include "EvtGenBase/EvtParticle.hh"
00024 #include "EvtGenBase/EvtRandom.hh"
00025 #include "EvtGenBase/EvtPDL.hh"
00026 #include "EvtGenModels/EvtSingleParticle2.hh"
00027 #include "EvtGenBase/EvtReport.hh"
00028 #include <string>
00029 #include "EvtGenBase/EvtConst.hh"
00030 using std::endl;
00031
00032 EvtSingleParticle2::~EvtSingleParticle2() {}
00033
00034 void EvtSingleParticle2::getName(std::string& model_name){
00035
00036 model_name="SINGLE2";
00037
00038 }
00039
00040 EvtDecayBase* EvtSingleParticle2::clone(){
00041
00042 return new EvtSingleParticle2();
00043
00044 }
00045
00046 void EvtSingleParticle2::init(){
00047
00048
00049
00050 disableCheckQ();
00051
00052 if ((getNArg()==6)||(getNArg()==4)||(getNArg()==2)) {
00053
00054 if (getNArg()==6){
00055
00056
00057 pxymin=getArg(0);
00058 pxymax=getArg(1);
00059
00060 thetamin=getArg(2);
00061 thetamax=getArg(3);
00062
00063 phimin=getArg(4);
00064 phimax=getArg(5);
00065
00066 }
00067
00068 if (getNArg()==4){
00069
00070 pxymin=getArg(0);
00071 pxymax=getArg(1);
00072
00073 thetamin=getArg(2);
00074 thetamax=getArg(3);
00075
00076 phimin=0.0;
00077 phimax=EvtConst::twoPi;
00078
00079 }
00080
00081 if (getNArg()==2){
00082
00083 pxymin=getArg(0);
00084 pxymax=getArg(1);
00085
00086 thetamin=0.376383;
00087 thetamax=2.76521;
00088
00089 phimin=0.0;
00090 phimax=EvtConst::twoPi;
00091
00092 }
00093
00094
00095 }else{
00096
00097 report(ERROR,"EvtGen") << "EvtSingleParticle generator expected "
00098 << " 5, 3, or 1 arguments but found:"<<getNArg()<<endl;
00099 report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
00100 ::abort();
00101 }
00102
00103
00104 report(INFO,"EvtGen") << "The single particle generator has been configured:"
00105 <<endl;
00106 report(INFO,"EvtGen") << thetamax << " > theta > " << thetamin <<endl;
00107 report(INFO,"EvtGen") << phimax << " > phi > " << phimin <<endl;
00108
00109 }
00110
00111 void EvtSingleParticle2::decay( EvtParticle *p ){
00112
00113 EvtParticle *d;
00114 EvtVector4R p4;
00115
00116 double mass=EvtPDL::getMass(getDaug(0));
00117
00118 p->makeDaughters(getNDaug(),getDaugs());
00119 d=p->getDaug(0);
00120
00121
00122
00123
00124
00125 double theta;
00126 if(thetamax==thetamin) {theta=thetamax;} else
00127 theta=EvtRandom::Flat(thetamin,thetamax);
00128 double phi;
00129 if(phimin==phimax){phi=phimin;} else
00130 phi = EvtRandom::Flat(phimin,phimax);
00131 double pxy;
00132 if(pxymin==pxymax){pxy=pxymin;} else
00133 pxy = EvtRandom::Flat(pxymin,pxymax);
00134
00135 pmag=pxy/sin(theta);
00136 cthetamax=cos(thetamax);
00137 cthetamin=cos(thetamin);
00138 double cthetalab;
00139
00140
00141
00142
00143 p4.set(sqrt(mass*mass+pmag*pmag),pmag*cos(phi)*sin(theta),
00144 pmag*sin(phi)*sin(theta),pmag*cos(theta));
00145 d->init( getDaug(0),p4);
00146
00147 EvtVector4R p4lab=d->getP4Lab();
00148 cthetalab=p4lab.get(3)/p4lab.d3mag();
00149
00150
00151 return ;
00152 }
00153
00154
00155