COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cloreb.f
Go to the documentation of this file.
1 #include "ZsaveStruc.h"
2 !c to test cloreb
3 ! include 'clorez.f'
4 ! include 'cgetRotMat4.f'
5 ! include 'clorep.f'
6 ! -----------------------------
7 ! implicit none
8 ! include '../Zptcl.h'
9 ! type(fmom):: p, q, r, s, gb, gbn
10 ! real*8 rm(4,4), rmz(4,4), rmy(4,4), g, bx, by, bz
11 ! real*8 fai1, fai2, tmp, pabs, gba
12 ! real*8 am/.938/
13 ! integer i, j
14 !
15 ! g=1.1
16 ! do j=1, 45
17 ! gba=g*sqrt(1.d0-1.d0/g/g)
18 ! bx=-sqrt(2.d0)/2.
19 ! by=sqrt(2.d0)/5.
20 ! bz=sqrt(1.d0 - bx**2 - by**2)
21 ! gb.p(1) = bx*gba
22 ! gb.p(2) = by*gba
23 ! gb.p(3) = - bz*gba
24 ! gb.p(4) = g
25 ! gbn.x = - gb.p(1)
26 ! gbn.y = - gb.p(2)
27 ! gbn.z = - gb.p(3)
28 ! gbn.t= gb.p(4)
29 !c matrix for z-axis
30 ! fai1=atan2(gb.p(2), gb.p(1))
31 ! call cgetRotMat4(3, fai1, rmz)
32 ! tmp=gb.p(1)**2 + gb.p(2)**2
33 !c matrix for y-axis
34 ! fai2=atan2(sqrt(tmp), gb.p(3))
35 ! call cgetRotMat4(2, fai2, rmy)
36 !c combined rotaion matrix
37 ! call cmultRotMat4(rmy, rmz, rm)
38 ! p.px=1.
39 ! p.py=10.
40 ! p.pz=10000.
41 ! call cpxyzp(p, pabs)
42 ! p.e=sqrt( pabs**2 + am**2)
43 ! call cloreb(1, gb, p, q)
44 !c
45 ! call clorep(1, gbn, q, r)
46 !c do rotaion
47 ! call capplyRot4(rm, r.p, s.p)
48 ! s.e = r.e
49 ! write(*, *) " ------ gamma=", g
50 ! write(*,*) ( (p.p(i)-s.p(i))/p.p(i), i=1, 4)
51 !c write(*,*) (p.p(i),s.p(i), i=1, 4)
52 ! g = g * 10.d0**.25
53 ! enddo
54 ! end
55 ! **************************************************************
56 ! *
57 ! * cloreb: General Lorentz transformation.
58 ! * The z axis is on the beta direction.
59 ! *
60 ! **************************************************************
61 !
62 ! /usage/ call cloreb(i, gb, q, p)
63 !
64 ! suppose a system (K') moving with a velocity beta
65 ! (3-d vector) and gamma factor g relative to another
66 ! system (K). q is 4 momentum given in
67 ! K' (of which the z axis is parallel to beta.)
68 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 ! This routine converts q into p seen from K.
70 !
71 ! 4 moemnta are assumed to be in the order of (px, py,
72 ! pz, e)
73 !
74 ! i: input. integer*4. if 1, gb is assumed to be new
75 ! else they are the same as previous call.
76 ! gb: input. type fmom (g*beta, g)
77 ! q: input. type ptcl. 4 momentum and mass of a particle.
78 ! p: output. type ptcl transformed one ( p may be q)
79 !
80 !
81  subroutine cloreb(i, gb, q, p)
82  implicit none
83 #include "Zptcl.h"
84  type(fmom):: gb
85  type(ptcl):: q, p
86  integer i
87 
88  type(ptcl):: qq
89  type(fmom):: a, b, beta
90  real*8 betanorm, anorm
91 
92 #ifdef USESAVE
93  save a, b, beta, betanorm
94 #endif
95 
96  if(i .eq. 1) then
97 #ifdef NEXT486
98  betanorm = gb%x**2 + gb%y**2 + gb%z**2
99  if(betanorm .ne. 0.) then
100  betanorm = sqrt(betanorm)
101  beta%x = gb%x/betanorm
102  beta%y = gb%y/betanorm
103  beta%z = gb%z/betanorm
104  a%x= beta%y
105  a%y = -beta%x
106  a%z= 0
107  anorm = a%x**2 + a%y**2
108  if(anorm .eq. 0.) then
109  a%x = 1.
110  a%y = 0.
111  a%z = 0.
112  else
113  anorm = sqrt(anorm)
114  a%x = a%x/anorm
115  a%y = a%y/anorm
116  endif
117 !
118  b%x = beta%y*a%z - beta%z * a%y
119  b%y = beta%z*a%x - beta%x* a%z
120  b%z = beta%x*a%y - beta%y* a%x
121  endif
122  endif
123  if(betanorm .eq. 0.) then
124  p = q
125  if(gb%z .lt. 0.) then
126  p%fm%z = - p%fm%z
127  p%fm%y = - p%fm%y
128  p%fm%x = - p%fm%x
129  endif
130  else
131 ! assume that qx is a-direction and qy is b direction
132 
133  qq = q
134  qq%fm%x = q%fm%x*a%x + q%fm%y*b%x +
135  * q%fm%z*beta%x
136  qq%fm%y = q%fm%x*a%y + q%fm%y*b%y +
137  * q%fm%z*beta%y
138  qq%fm%z = q%fm%x*a%z + q%fm%y*b%z +
139  * q%fm%z*beta%z
140  qq%fm%e = q%fm%e
141 ! Lorentz boost by gb
142  call clorep(i, gb, qq, p)
143  endif
144 #else
145  betanorm = gb%p(1)**2 + gb%p(2)**2 + gb%p(3)**2
146  if(betanorm .ne. 0.) then
147  betanorm = sqrt(betanorm)
148  beta%p(1) = gb%p(1)/betanorm
149  beta%p(2) = gb%p(2)/betanorm
150  beta%p(3) = gb%p(3)/betanorm
151  a%p(1)= beta%p(2)
152  a%p(2) = -beta%p(1)
153  a%p(3)= 0
154  anorm = a%p(1)**2 + a%p(2)**2
155  if(anorm .eq. 0.) then
156  a%p(1) = 1.
157  a%p(2) = 0.
158  a%p(3) = 0.
159  else
160  anorm = sqrt(anorm)
161  a%p(1) = a%p(1)/anorm
162  a%p(2) = a%p(2)/anorm
163  endif
164 !
165  b%p(1) = beta%p(2)*a%p(3) - beta%p(3) * a%p(2)
166  b%p(2) = beta%p(3)*a%p(1) - beta%p(1)* a%p(3)
167  b%p(3) = beta%p(1)*a%p(2) - beta%p(2)* a%p(1)
168  endif
169  endif
170  if(betanorm .eq. 0.) then
171  p = q
172  if(gb%p(3) .lt. 0.) then
173  p%fm%p(3) = - p%fm%p(3)
174  p%fm%p(2) = - p%fm%p(2)
175  p%fm%p(1) = - p%fm%p(1)
176  endif
177  else
178 ! assume that qx is a-direction and qy is b direction
179 !
180  qq = q
181  qq%fm%p(1) = q%fm%p(1)*a%p(1) + q%fm%p(2)*b%p(1) +
182  * q%fm%p(3)*beta%p(1)
183  qq%fm%p(2) = q%fm%p(1)*a%p(2) + q%fm%p(2)*b%p(2) +
184  * q%fm%p(3)*beta%p(2)
185  qq%fm%p(3) = q%fm%p(1)*a%p(3) + q%fm%p(2)*b%p(3) +
186  * q%fm%p(3)*beta%p(3)
187  qq%fm%p(4) = q%fm%p(4)
188 ! Lorentz boost by gb
189  call clorep(i, gb, qq, p)
190  endif
191 #endif
192  end
193 
194 
195 
196 
197 
subroutine cloreb(i, gb, q, p)
Definition: cloreb.f:82
Definition: Zptcl.h:72
subroutine clorep(j, gb, q, p)
Definition: clorep.f:88
Definition: Zptcl.h:75