Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyrobo.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyrobo.f
1 
2 C*********************************************************************
3 
4 C...PYROBO
5 C...Performs rotations and boosts.
6 
7  SUBROUTINE pyrobo(IMI,IMA,THE,PHI,BEX,BEY,BEZ)
8 
9 C...Double precision and integer declarations.
10  IMPLICIT DOUBLE PRECISION(a-h, o-z)
11  IMPLICIT INTEGER(i-n)
12  INTEGER pyk,pychge,pycomp
13 C...Commonblocks.
14  common/pyjets/n,npad,k(4000,5),p(4000,5),v(4000,5)
15  common/pydat1/mstu(200),paru(200),mstj(200),parj(200)
16  SAVE /pyjets/,/pydat1/
17 C...Local arrays.
18  dimension rot(3,3),pr(3),vr(3),dp(4),dv(4)
19 
20 C...Find and check range of rotation/boost.
21  imin=imi
22  IF(imin.LE.0) imin=1
23  IF(mstu(1).GT.0) imin=mstu(1)
24  imax=ima
25  IF(imax.LE.0) imax=n
26  IF(mstu(2).GT.0) imax=mstu(2)
27  IF(imin.GT.mstu(4).OR.imax.GT.mstu(4)) THEN
28  CALL pyerrm(11,'(PYROBO:) range outside PYJETS memory')
29  RETURN
30  ENDIF
31 
32 C...Optional resetting of V (when not set before.)
33  IF(mstu(33).NE.0) THEN
34  DO 110 i=min(imin,mstu(4)),min(imax,mstu(4))
35  DO 100 j=1,5
36  v(i,j)=0d0
37  100 CONTINUE
38  110 CONTINUE
39  mstu(33)=0
40  ENDIF
41 
42 C...Rotate, typically from z axis to direction (theta,phi).
43  IF(the**2+phi**2.GT.1d-20) THEN
44  rot(1,1)=cos(the)*cos(phi)
45  rot(1,2)=-sin(phi)
46  rot(1,3)=sin(the)*cos(phi)
47  rot(2,1)=cos(the)*sin(phi)
48  rot(2,2)=cos(phi)
49  rot(2,3)=sin(the)*sin(phi)
50  rot(3,1)=-sin(the)
51  rot(3,2)=0d0
52  rot(3,3)=cos(the)
53  DO 140 i=imin,imax
54  IF(k(i,1).LE.0) goto 140
55  DO 120 j=1,3
56  pr(j)=p(i,j)
57  vr(j)=v(i,j)
58  120 CONTINUE
59  DO 130 j=1,3
60  p(i,j)=rot(j,1)*pr(1)+rot(j,2)*pr(2)+rot(j,3)*pr(3)
61  v(i,j)=rot(j,1)*vr(1)+rot(j,2)*vr(2)+rot(j,3)*vr(3)
62  130 CONTINUE
63  140 CONTINUE
64  ENDIF
65 
66 C...Boost, typically from rest to momentum/energy=beta.
67  IF(bex**2+bey**2+bez**2.GT.1d-20) THEN
68  dbx=bex
69  dby=bey
70  dbz=bez
71  db=sqrt(dbx**2+dby**2+dbz**2)
72  eps1=1d0-1d-12
73  IF(db.GT.eps1) THEN
74 C...Rescale boost vector if too close to unity.
75  CALL pyerrm(3,'(PYROBO:) boost vector too large')
76  dbx=dbx*(eps1/db)
77  dby=dby*(eps1/db)
78  dbz=dbz*(eps1/db)
79  db=eps1
80  ENDIF
81  dga=1d0/sqrt(1d0-db**2)
82  DO 160 i=imin,imax
83  IF(k(i,1).LE.0) goto 160
84  DO 150 j=1,4
85  dp(j)=p(i,j)
86  dv(j)=v(i,j)
87  150 CONTINUE
88  dbp=dbx*dp(1)+dby*dp(2)+dbz*dp(3)
89  dgabp=dga*(dga*dbp/(1d0+dga)+dp(4))
90  p(i,1)=dp(1)+dgabp*dbx
91  p(i,2)=dp(2)+dgabp*dby
92  p(i,3)=dp(3)+dgabp*dbz
93  p(i,4)=dga*(dp(4)+dbp)
94  dbv=dbx*dv(1)+dby*dv(2)+dbz*dv(3)
95  dgabv=dga*(dga*dbv/(1d0+dga)+dv(4))
96  v(i,1)=dv(1)+dgabv*dbx
97  v(i,2)=dv(2)+dgabv*dby
98  v(i,3)=dv(3)+dgabv*dbz
99  v(i,4)=dga*(dv(4)+dbv)
100  160 CONTINUE
101  ENDIF
102 
103  RETURN
104  END