35 double temp=(a*a-(b+c)*(b+c))*(a*a-(b-c)*(b-c));
46 return sqrt(temp)/(2.0*a);
96 double pm[5][30],to[4],pmin,pmax,psum,rnd[30];
97 double ran,wt,pa,costh,sinth,phi,p[4][30],be[4],bep,temp;
98 int i,il,ilr,i1,il1u,il1,il2r,ilu;
101 for(i=0;i<ndaug;i++){
118 for(i=1;i<ndaug+1;i++){
122 pm[4][ndaug-1]=
mass[ndaug-1];
172 report(
ERROR,
"EvtGen") <<
"too many daughters for phase space..." << ndaug <<
" "<<
mp <<endl;;
176 pmax=
mp-psum+
mass[ndaug-1];
180 for(ilr=2;ilr<ndaug+1;ilr++){
182 pmax=pmax+
mass[il-1];
183 pmin=pmin+
mass[il+1-1];
194 for (il1=2;il1<il1u+1;il1++){
196 for (il2r=2;il2r<il1+1;il2r++){
198 if (ran<=rnd[il2-1])
goto two39;
199 rnd[il2+1-1]=rnd[il2-1];
207 for(ilr=2;ilr<ndaug+1;ilr++){
209 pm[4][il-1]=pm[4][il+1-1]+
mass[il-1]+
210 (rnd[il-1]-rnd[il+1-1])*(
mp-psum);
211 wt=wt*
EvtPawt(pm[4][il-1],pm[4][il+1-1],
mass[il-1]);
214 report(
ERROR,
"EvtGen") <<
"wtmax to small in EvtPhaseSpace with "
215 << ndaug <<
" daughters"<<endl;;
221 for (il=1;il<ilu+1;il++){
224 sinth=sqrt(1.0-costh*costh);
226 p[1][il-1]=pa*sinth*
cos(phi);
227 p[2][il-1]=pa*sinth*
sin(phi);
229 pm[1][il+1-1]=-p[1][il-1];
230 pm[2][il+1-1]=-p[2][il-1];
231 pm[3][il+1-1]=-p[3][il-1];
232 p[0][il-1]=sqrt(pa*pa+
mass[il-1]*
mass[il-1]);
233 pm[0][il+1-1]=sqrt(pa*pa+pm[4][il+1-1]*pm[4][il+1-1]);
236 p[0][ndaug-1]=pm[0][ndaug-1];
237 p[1][ndaug-1]=pm[1][ndaug-1];
238 p[2][ndaug-1]=pm[2][ndaug-1];
239 p[3][ndaug-1]=pm[3][ndaug-1];
241 for (ilr=2;ilr<ndaug+1;ilr++){
243 be[0]=pm[0][il-1]/pm[4][il-1];
244 be[1]=pm[1][il-1]/pm[4][il-1];
245 be[2]=pm[2][il-1]/pm[4][il-1];
246 be[3]=pm[3][il-1]/pm[4][il-1];
248 for (i1=il;i1<ndaug+1;i1++){
249 bep=be[1]*p[1][i1-1]+be[2]*p[2][i1-1]+
250 be[3]*p[3][i1-1]+be[0]*p[0][i1-1];
251 temp=(p[0][i1-1]+bep)/(be[0]+1.0);
252 p[1][i1-1]=p[1][i1-1]+temp*be[1];
253 p[2][i1-1]=p[2][i1-1]+temp*be[2];
254 p[3][i1-1]=p[3][i1-1]+temp*be[3];
260 for (ilr=0;ilr<ndaug;ilr++){
261 p4[ilr].
set(p[0][ilr],p[1][ilr],p[2][ilr],p[3][ilr]);
282 double m12sqmax=(M-m3)*(M-m3);
283 double m12sqmin=(m1+m2)*(m1+m2);
285 double m13sqmax=(M-m2)*(M-m2);
286 double m13sqmin=(m1+m3)*(m1+m3);
288 double v1=(m12sqmax-m12sqmin)*(m13sqmax-m13sqmin);
289 double v2= a*(1.0/m12sqmin-1.0/m12sqmax)*(m13sqmax-m13sqmin);
297 double m13min,m13max;
307 m12sq=1.0/(1.0/m12sqmin-
EvtRandom::Flat()*(1.0/m12sqmin-1.0/m12sqmax));
311 double E3star=(M*M-m12sq-m3*m3)/sqrt(4*m12sq);
312 double E1star=(m12sq+m1*m1-m2*m2)/sqrt(4*m12sq);
313 double p3star=sqrt(E3star*E3star-m3*m3);
314 double p1star=sqrt(E1star*E1star-m1*m1);
315 m13max=(E3star+E1star)*(E3star+E1star)-
316 (p3star-p1star)*(p3star-p1star);
317 m13min=(E3star+E1star)*(E3star+E1star)-
318 (p3star+p1star)*(p3star+p1star);
320 }
while(m13sq<m13min||m13sq>m13max);
323 double E2=(M*M+m2*m2-m13sq)/(2.0*M);
324 double E3=(M*M+m3*m3-m12sq)/(2.0*M);
326 double p1mom=sqrt(E1*E1-m1*m1);
327 double p3mom=sqrt(E3*E3-m3*m3);
328 double cost13=(2.0*E1*E3+m1*m1+m3*m3-m13sq)/(2.0*p1mom*p3mom);
340 p4[2].
set(E3,0.0,0.0,p3mom);
341 p4[0].
set(E1,p1mom*sqrt(1.0-cost13*cost13),0.0,p1mom*cost13);
342 p4[1].
set(E2,-p1mom*sqrt(1.0-cost13*cost13),0.0,-p1mom*cost13-p3mom);
354 return 1.0+a/(m12sq*m12sq);
double sin(const BesAngle a)
double cos(const BesAngle a)
double EvtPawt(double a, double b, double c)
ostream & report(Severity severity, const char *facility)
************Class m_ypar INTEGER m_KeyWgt INTEGER m_nphot INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
static const double twoPi
static double PhaseSpacePole(double M, double m1, double m2, double m3, double a, EvtVector4R p4[10])
static double PhaseSpace(int ndaug, double mass[30], EvtVector4R p4[30], double mp)
void applyRotateEuler(double alpha, double beta, double gamma)
void set(int i, double d)