Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pybesq.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pybesq.f
1 
2 C*********************************************************************
3 
4 C...PYBESQ
5 C...Calculates the momentum shift in a system of two particles assuming
6 C...the relative momentum squared should be shifted to Q2NEW. NI is the
7 C...last position occupied in /PYJETS/.
8 
9  SUBROUTINE pybesq(I1,I2,NI,Q2OLD,Q2NEW)
10 
11 C...Double precision and integer declarations.
12  IMPLICIT DOUBLE PRECISION(a-h, o-z)
13  IMPLICIT INTEGER(i-n)
14  INTEGER pyk,pychge,pycomp
15 C...Parameter statement to help give large particle numbers.
16  parameter(ksusy1=1000000,ksusy2=2000000,ktechn=3000000,
17  &kexcit=4000000,kdimen=5000000)
18 C...Commonblocks.
19  common/pyjets/n,npad,k(4000,5),p(4000,5),v(4000,5)
20  common/pydat1/mstu(200),paru(200),mstj(200),parj(200)
21  SAVE /pyjets/,/pydat1/
22 C...Local arrays and data.
23  dimension dp(5)
24  SAVE hc1
25 
26  IF(mstj(55).EQ.0) THEN
27  dq2=q2new-q2old
28  dp2=(p(i1,1)-p(i2,1))**2+(p(i1,2)-p(i2,2))**2+
29  & (p(i1,3)-p(i2,3))**2
30  dp12=p(i1,1)**2+p(i1,2)**2+p(i1,3)**2
31  & -p(i2,1)**2-p(i2,2)**2-p(i2,3)**2
32  se=p(i1,4)+p(i2,4)
33  de=p(i1,4)-p(i2,4)
34  dq2se=dq2+se**2
35  da=se*de*dp12-dp2*dq2se
36  db=dp2*dq2se-dp12**2
37  ha=(da+sqrt(max(da**2+dq2*(dq2+se**2-de**2)*db,0d0)))/(2d0*db)
38  DO 100 j=1,3
39  pd=ha*(p(i1,j)-p(i2,j))
40  p(ni+1,j)=pd
41  p(ni+2,j)=-pd
42  100 CONTINUE
43  RETURN
44  ENDIF
45 
46  k(ni+1,1)=1
47  k(ni+2,1)=1
48  DO 110 j=1,5
49  p(ni+1,j)=p(i1,j)
50  p(ni+2,j)=p(i2,j)
51  dp(j)=p(i1,j)+p(i2,j)
52  110 CONTINUE
53 
54 C...Boost to cms and rotate first particle to z-axis
55  CALL pyrobo(ni+1,ni+2,0.0d0,0.0d0,
56  &-dp(1)/dp(4),-dp(2)/dp(4),-dp(3)/dp(4))
57  phi=pyangl(p(ni+1,1),p(ni+1,2))
58  the=pyangl(p(ni+1,3),sqrt(p(ni+1,1)**2+p(ni+1,2)**2))
59  s=q2new+(p(i1,5)+p(i2,5))**2
60  pz=0.5d0*sqrt(q2new*(s-(p(i1,5)-p(i2,5))**2)/s)
61  p(ni+1,1)=0.0d0
62  p(ni+1,2)=0.0d0
63  p(ni+1,3)=pz
64  p(ni+1,4)=sqrt(pz**2+p(i1,5)**2)
65  p(ni+2,1)=0.0d0
66  p(ni+2,2)=0.0d0
67  p(ni+2,3)=-pz
68  p(ni+2,4)=sqrt(pz**2+p(i2,5)**2)
69  dp(4)=sqrt(dp(1)**2+dp(2)**2+dp(3)**2+s)
70  CALL pyrobo(ni+1,ni+2,the,phi,
71  &dp(1)/dp(4),dp(2)/dp(4),dp(3)/dp(4))
72 
73  DO 120 j=1,3
74  p(ni+1,j)=p(ni+1,j)-p(i1,j)
75  p(ni+2,j)=p(ni+2,j)-p(i2,j)
76  120 CONTINUE
77 
78  RETURN
79  END