//-------------------------------------------------------------------------- // // Environment: // This software is part of the EvtGen package developed jointly // for the BaBar and CLEO collaborations. If you use all or part // of it, please give an appropriate acknowledgement. // // Copyright Information: See EvtGen/COPYRIGHT // Copyright (C) 1998 Caltech, UCSB // // Module: EvtGenKine.cc // // Description: Tools for generating distributions of four vectors in // phasespace // // Modification history: // // DJL/RYD September 25, 1996 Module created // //------------------------------------------------------------------------ // #include "EvtGenBase/EvtPatches.hh" #include #include "EvtGenBase/EvtGenKine.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtVector4R.hh" #include "EvtGenBase/EvtReport.hh" #include "EvtGenBase/EvtConst.hh" #include using std::endl; double EvtPawt(double a,double b,double c) { double temp=(a*a-(b+c)*(b+c))*(a*a-(b-c)*(b-c)); if (temp<=0) { return 0.0; } return sqrt(temp)/(2.0*a); } double EvtGenKine::PhaseSpace( int ndaug, double mass[30], EvtVector4R p4[30], double mp ) // N body phase space routine. Send parent with // daughters already defined ( Number and masses ) // Returns four vectors in parent frame. { double energy, p3, alpha, beta; if ( ndaug == 1 ) { p4[0].set(mass[0],0.0,0.0,0.0); return 1.0; } if ( ndaug == 2 ) { //Two body phase space energy = ( mp*mp + mass[0]*mass[0] - mass[1]*mass[1] ) / ( 2.0 * mp ); p3 = sqrt( energy*energy - mass[0]*mass[0] ); p4[0].set( energy, 0.0, 0.0, p3 ); energy = mp - energy; p3 = -1.0*p3; p4[1].set( energy, 0.0, 0.0, p3 ); //Now rotate four vectors. alpha = EvtRandom::Flat( EvtConst::twoPi ); beta = acos(EvtRandom::Flat( -1.0, 1.0 )); p4[0].applyRotateEuler( alpha, beta, -alpha ); p4[1].applyRotateEuler( alpha, beta, -alpha ); return 1.0; } if ( ndaug != 2 ) { double wtmax=0.0; double pm[5][30],to[4],pmin,pmax,psum,rnd[30]; double ran,wt,pa,costh,sinth,phi,p[4][30],be[4],bep,temp; int i,il,ilr,i1,il1u,il1,il2r,ilu; int il2=0; for(i=0;iwtmax) { report(ERROR,"EvtGen") << "wtmax to small in EvtPhaseSpace with " << ndaug <<" daughters"<EvtRandom::Flat()){ m12sq=EvtRandom::Flat(m12sqmin,m12sqmax); } else{ m12sq=1.0/(1.0/m12sqmin-EvtRandom::Flat()*(1.0/m12sqmin-1.0/m12sqmax)); } //kinematically allowed? double E3star=(M*M-m12sq-m3*m3)/sqrt(4*m12sq); double E1star=(m12sq+m1*m1-m2*m2)/sqrt(4*m12sq); double p3star=sqrt(E3star*E3star-m3*m3); double p1star=sqrt(E1star*E1star-m1*m1); m13max=(E3star+E1star)*(E3star+E1star)- (p3star-p1star)*(p3star-p1star); m13min=(E3star+E1star)*(E3star+E1star)- (p3star+p1star)*(p3star+p1star); }while(m13sqm13max); double E2=(M*M+m2*m2-m13sq)/(2.0*M); double E3=(M*M+m3*m3-m12sq)/(2.0*M); double E1=M-E2-E3; double p1mom=sqrt(E1*E1-m1*m1); double p3mom=sqrt(E3*E3-m3*m3); double cost13=(2.0*E1*E3+m1*m1+m3*m3-m13sq)/(2.0*p1mom*p3mom); //report(INFO,"EvtGen") << m13sq << endl; //report(INFO,"EvtGen") << m12sq << endl; //report(INFO,"EvtGen") << E1 << endl; //report(INFO,"EvtGen") << E2 << endl; //report(INFO,"EvtGen") << E3 << endl; //report(INFO,"EvtGen") << p1mom << endl; //report(INFO,"EvtGen") << p3mom << endl; //report(INFO,"EvtGen") << cost13 << endl; p4[2].set(E3,0.0,0.0,p3mom); p4[0].set(E1,p1mom*sqrt(1.0-cost13*cost13),0.0,p1mom*cost13); p4[1].set(E2,-p1mom*sqrt(1.0-cost13*cost13),0.0,-p1mom*cost13-p3mom); //report(INFO,"EvtGen") << "p4:"<