/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/BesEvtGen/BesEvtGen-00-03-58/src/EvtGen/EvtGenModels/EvtSingleParticle2.cc

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 //
00003 // Environment:
00004 //      This software is part of the EvtGen package developed jointly
00005 //      for the BaBar and CLEO collaborations.  If you use all or part
00006 //      of it, please give an appropriate acknowledgement.
00007 //
00008 // Copyright Information: See EvtGen/COPYRIGHT
00009 //      Copyright (C) 1998      Caltech, UCSB
00010 //
00011 // Module: EvtSingleParticle.cc
00012 //
00013 // Description: Special model to generate single particles.
00014 //
00015 // Modification history:
00016 //
00017 //    RYD       Febuary 17,1998       Module created
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   //turn off checks for charge conservation
00050   disableCheckQ();
00051 
00052   if ((getNArg()==6)||(getNArg()==4)||(getNArg()==2)) {
00053     
00054     if (getNArg()==6){
00055       //copy the arguments into eaiser to remember names!
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       //copy the arguments into eaiser to remember names!
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       //copy the arguments into eaiser to remember names!
00083       pxymin=getArg(0);
00084       pxymax=getArg(1);
00085       
00086       thetamin=0.376383;
00087       thetamax=2.76521;   //|cos(theta)|<0.93
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   //generate flat distribution in p 
00122   //we are now in the parents restframe! This means the 
00123   //restframe of the e+e- collison.
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   //  do{
00141     //generate flat distribution in costheta
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     //get 4 vector in the lab frame!
00147     EvtVector4R p4lab=d->getP4Lab();
00148     cthetalab=p4lab.get(3)/p4lab.d3mag();
00149     //  }while (cthetalab>cthetamax||cthetalab<cthetamin);
00150 
00151   return ;
00152 }
00153 
00154 
00155 

Generated on Tue Nov 29 23:12:22 2016 for BOSS_7.0.2 by  doxygen 1.4.7