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: EvtSingleParticle.cc
13 // Description: Special model to generate single particles.
15 // Modification history:
17 // RYD Febuary 17,1998 Module created
19 //------------------------------------------------------------------------
21 #include "EvtGenBase/EvtPatches.hh"
23 #include "EvtGenBase/EvtParticle.hh"
24 #include "EvtGenBase/EvtRandom.hh"
25 #include "EvtGenBase/EvtPDL.hh"
26 #include "EvtGenModels/EvtSingleParticle.hh"
27 #include "EvtGenBase/EvtReport.hh"
29 #include "EvtGenBase/EvtConst.hh"
32 EvtSingleParticle::~EvtSingleParticle() {}
34 std::string EvtSingleParticle::getName(){
40 EvtDecayBase* EvtSingleParticle::clone(){
42 return new EvtSingleParticle();
46 void EvtSingleParticle::init(){
49 //turn off checks for charge conservation
52 if ((getNArg()==6)||(getNArg()==4)||(getNArg()==2)) {
55 //copy the arguments into eaiser to remember names!
69 //copy the arguments into eaiser to remember names!
78 phimax=EvtConst::twoPi;
83 //copy the arguments into eaiser to remember names!
92 phimax=EvtConst::twoPi;
99 report(ERROR,"EvtGen") << "EvtSingleParticle generator expected "
100 << " 6, 4, or 2 arguments but found:"<<getNArg()<<endl;
101 report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
107 report(INFO,"EvtGen") << "The single particle generator has been configured:"
109 report(INFO,"EvtGen") << pmax << " > p > " << pmin <<endl;
110 report(INFO,"EvtGen") << cthetamax << " > costheta > " << cthetamin <<endl;
111 report(INFO,"EvtGen") << phimax << " > phi > " << phimin <<endl;
115 void EvtSingleParticle::decay( EvtParticle *p ){
120 double mass=EvtPDL::getMass(getDaug(0));
122 p->makeDaughters(getNDaug(),getDaugs());
125 //generate flat distribution in p
126 //we are now in the parents restframe! This means the
127 //restframe of the e+e- collison.
128 double pcm=EvtRandom::Flat(pmin,pmax);
129 //generate flat distribution in phi.
130 double phi=EvtRandom::Flat(phimin,phimax);
135 //generate flat distribution in costheta
136 double ctheta=EvtRandom::Flat(cthetamin,cthetamax);
137 double stheta=sqrt(1.0-ctheta*ctheta);
138 p4.set(sqrt(mass*mass+pcm*pcm),pcm*cos(phi)*stheta,
139 pcm*sin(phi)*stheta,pcm*ctheta);
141 d->init( getDaug(0),p4);
143 //get 4 vector in the lab frame!
144 EvtVector4R p4lab=d->getP4Lab();
145 cthetalab=p4lab.get(3)/p4lab.d3mag();
146 }while (cthetalab>cthetamax||cthetalab<cthetamin);