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

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 //
00003 // Environment:
00004 //      This software is part of models developed at BES collaboration
00005 //      based on the EvtGen framework.  If you use all or part
00006 //      of it, please give an appropriate acknowledgement.
00007 //
00008 // Copyright Information: See EvtGen/BesCopyright
00009 //      Copyright (A) 2006      Ping Rong-Gang @IHEP
00010 //
00011 // Module: EvtAngSam3.cc
00012 //
00013 // Description: Routine to decay a particle to two bodies by sampling angular distribution in Lab
00014 //              system.
00015 //      
00016 // Modification history:
00017 //
00018 //    Ping R.-G.       December, 2006       Module created
00019 //
00020 //------------------------------------------------------------------------
00021 //
00022 #include "EvtGenBase/EvtPatches.hh"
00023 #include <stdlib.h>
00024 #include "EvtGenBase/EvtParticle.hh"
00025 #include "EvtGenBase/EvtGenKine.hh"
00026 #include "EvtGenBase/EvtPDL.hh"
00027 #include "EvtGenBase/EvtVector4C.hh"
00028 #include "EvtGenBase/EvtVector4R.hh"
00029 #include "EvtGenBase/EvtTensor4C.hh"
00030 #include "EvtGenBase/EvtDiracParticle.hh"
00031 #include "EvtGenBase/EvtScalarParticle.hh"
00032 #include "EvtGenBase/EvtVectorParticle.hh"
00033 #include "EvtGenBase/EvtTensorParticle.hh"
00034 #include "EvtGenBase/EvtPhotonParticle.hh" 
00035 #include "EvtGenBase/EvtNeutrinoParticle.hh"
00036 #include "EvtGenBase/EvtStringParticle.hh"
00037 #include "EvtGenBase/EvtRaritaSchwingerParticle.hh"
00038 #include "EvtGenBase/EvtHighSpinParticle.hh"
00039 #include "EvtGenBase/EvtReport.hh"
00040 #include "EvtGenBase/EvtHelSys.hh"
00041 #include "EvtGenModels/EvtAngSam3.hh"
00042 #include "EvtGenBase/EvtRandom.hh"
00043 #include <string>
00044 using std::cout;
00045 using std::endl;
00046 
00047 EvtAngSam3::~EvtAngSam3() {}
00048 
00049 void EvtAngSam3::getName(std::string& model_name){
00050 
00051   model_name="AngSam3";     
00052 
00053 }
00054 
00055 EvtDecayBase* EvtAngSam3::clone(){
00056 
00057   return new EvtAngSam3;
00058 
00059 }
00060 
00061 
00062 void EvtAngSam3::init(){
00063 
00064   // check angular distribution parameters  
00065   checkNDaug(3);
00066   EvtSpinType::spintype parenttype = EvtPDL::getSpinType(getParentId());
00067 
00068   if(getNArg()>6 || getNArg()<2 ) {
00069     report(ERROR,"EvtGen")<<"  2<= expected parameters <=6, but it is "<< getNArg()<<endl;
00070   ::abort();
00071   }
00072 } 
00073      
00074 void EvtAngSam3::initProbMax(){
00075 
00076   noProbMax();
00077 
00078 }
00079 
00080 void EvtAngSam3::decay( EvtParticle *p ){
00081 
00082 loop:
00083   p->initializePhaseSpace(getNDaug(),getDaugs());
00084 
00085   EvtParticle *v,*s1,*s2;
00086   EvtVector4R pv,ps;
00087   EvtVector4R Lpt,xp;
00088  
00089   v =p->getDaug(0); 
00090   s1=p->getDaug(1); 
00091   s2=p->getDaug(2);
00092   pv=v->getP4();
00093   ps=s1->getP4();
00094   Lpt=p->getP4();
00095   xp=pv.cross(ps);
00096 
00097   // calculate the cos (theta) between xp and Lpt
00098   double costheta;
00099   if(Lpt.d3mag()<0.0001){
00100     costheta = xp.get(3)/xp.d3mag();
00101   } else{
00102     costheta = (xp.get(1)*Lpt.get(1) + xp.get(2)*Lpt.get(2) + xp.get(3)*Lpt.get(3))/xp.d3mag()/Lpt.d3mag();
00103   }
00104   int narg=getNArg();
00105   double c0,c2,c4,c6,c8,c10;
00106   c0=0;c2=0;c4=0;c6=0;c8=0;c10=0;
00107   if(narg==2) {
00108    c0=getArg(0);
00109    c2=getArg(1);
00110   } else if (narg==3){
00111    c0=getArg(0);
00112    c2=getArg(1);
00113    c4=getArg(2);
00114   } else if (narg==4){
00115    c0=getArg(0);
00116    c2=getArg(1);
00117    c4=getArg(2);
00118    c6=getArg(3);
00119   } else if (narg==5){
00120    c0=getArg(0);
00121    c2=getArg(1);
00122    c4=getArg(2);
00123    c6=getArg(3);
00124    c8=getArg(4);
00125   } else if (narg==6){
00126    c0=getArg(0);
00127    c2=getArg(1);
00128    c4=getArg(2);
00129    c6=getArg(3);
00130    c8=getArg(4);
00131    c10=getArg(5);
00132   }
00133 
00134   double costheta2= costheta*costheta;
00135   double costheta4= costheta2*costheta2;
00136   double costheta6= costheta4*costheta2;
00137   double costheta8= costheta6*costheta2;
00138   double costheta10= costheta8*costheta2;
00139 
00140   double amp1=(c0+c2*costheta2+c4*costheta4+c6*costheta6+c8*costheta8+c10*costheta10);
00141   double a0,a2,a4,a6,a8,a10;
00142   double ampflag;
00143   if(c0<0) {a0=0;}else{a0=c0;}
00144   if(c2<0) {a2=0;}else{a2=c2;}
00145   if(c4<0) {a4=0;}else{a4=c4;}
00146   if(c6<0) {a6=0;}else{a6=c6;}
00147   if(c8<0) {a8=0;}else{a8=c8;}
00148   if(c10<0) {a10=0;}else{a10=c10;}
00149   ampflag=a0+a2+a4+a6+a8+a10;
00150   if( ampflag<=0 ) {
00151     report(ERROR,"EvtGen")<<" The maxium value of amplitude square should be positive, but it is "<< ampflag<<endl;
00152   ::abort();
00153   }
00154   ampflag = amp1/ampflag;
00155   double rd1=EvtRandom::Flat(0.0, 1.0);
00156   if(rd1>=ampflag) goto loop;
00157   return ;
00158 }
00159 
00160 

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