COSMOS v7.655  COSMOSv7655
(AirShowerMC)
clorep.f
Go to the documentation of this file.
1 #include "ZsaveStruc.h"
2 !c to test clorep.
3 ! include 'cgetRotMat4.f'
4 ! include 'cmkptc.f'
5 ! include 'cpm2e.f'
6 ! include 'clorez.f'
7 !c ----------------------------
8 ! implicit none
9 ! include '../Zptcl.h'
10 ! include '../Zcode.h'
11 ! type(ptcl):: p, q, r
12 ! type(fmom):: gb, gbn
13 ! real*8 g, gba, bx, by, bz
14 ! integer i, j
15 ! g=1.d0
16 ! do j=1, 45
17 ! gba=g*sqrt(1.d0-1.d0/g/g)
18 ! bx=-sqrt(2.d0)/2.d0
19 ! by=sqrt(2.d0)/5.d0
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 ! do i=1, 3
26 ! gbn.p(i)=-gb.p(i)
27 ! enddo
28 ! gbn.t=g
29 ! p.fm.p(1)=10.d0
30 ! p.fm.p(2)=10.d0
31 ! p.fm.p(3)=10000.d0
32 ! call cmkptc(knuc, 0, 1, p)
33 ! call cpm2e(p, p)
34 ! do i=1, 1
35 ! call clorep(i, gb, p, q)
36 ! enddo
37 ! write(*,*) ' after clorep q=',q.fm.p
38 ! call clorep(1, gbn, q, r)
39 ! write(*,*) ' --------g=', g
40 ! write(*,*) ( (p.fm.p(i)-r.fm.p(i))/p.fm.p(i), i=1, 4)
41 ! g = g * 10.d0**.25
42 ! enddo
43 ! end
44 ! **************************************************************
45 ! *
46 ! * clorep: general Lorentz transformation
47 ! * (vector defining axes are paralell in both systems).
48 ! *
49 ! **************************************************************
50 !
51 ! /usage/ call clorep(j, gb, q, p)
52 !
53 ! suppose a system (K') moving with a velocity beta
54 ! (3-d vector) and gamma factor g relative to another
55 ! systeme (K). q is 4 momenta given in
56 ! the frame K' (of which x,y,z axies are parallel to
57 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58 ! those of the system K). This routine gives
59 ! ~~~~~~~~~~~~~~~~~~~~~
60 ! 4 momenta, p, seen from the K-system.
61 !
62 ! 4 moemnta are assumed to be in the order of (px, py,
63 ! pz, e)
64 !
65 ! j: input. integer*4 j=1--->gb are new
66 ! j^=1-->gb are the same as previous
67 ! values.
68 ! gb: /fmom/ input. (g*beta, g).
69 ! q: /ptcl/ input. 4 momenta and mass of a ptcl
70 ! p: /ptcl/ output. transformed 4 one.
71 ! (p may be the same one as q)
72 !
73 ! If we apply the formula directly for gb*q < 0 case at
74 ! very high energy,
75 ! subtraction mig.p(4) result in complete loss of accuracy.
76 ! To get rid of this, q is converted to a system whose z-axis
77 ! coinsides with beta and lorentz transformation is applied
78 ! for the z-direction. After that, the vector is ratoted
79 ! so that z axis be parallel to that of the K-system.
80 !
81 ! If beta is completely parallel to the z axis, use
82 ! clorez(;faster).
83 !
84 ! Accuracy is better than 7 dig.p(4)s in normal applicaltion
85 ! (g upto 10e12).
86 !
87  subroutine clorep(j, gb, q, p)
88  implicit none
89 !---- include '../Zptcl.h'
90 #include "Zptcl.h"
91 
92  type(fmom):: gb
93  type(ptcl):: q, p
94 !
95  real*8 rm(4, 4), rmy(4, 4), rmyi(4, 4), rmz(4, 4),
96  * rmzi(4, 4), rmi(4, 4), gmin/1.e4/, g
97  real*8 fai1, fai2, tmp, gbq, a
98  type(fmom):: agb
99  type(ptcl):: qt
100 
101 #ifdef USESAVE
102  save agb
103 #endif
104 
105  integer jsv/0/, i, j
106  save rm, rmi, jsv
107 !
108  p = q
109  gbq = 0.d0
110  do i=1, 3
111  gbq=gbq + gb%p(i)*q%fm%p(i)
112  enddo
113 !
114  g = gb%p(4)
115  a=1.d0/(1.d0+g)
116  if(gbq .ge. 0.d0 .or. g .lt. gmin) then
117 ! if(gbq .ge. 0.d0 ) then
118  do i=1, 3
119  p%fm%p(i) = q%fm%p(i) +
120  * gb%p(i)*(q%fm%p(4) + a*gbq)
121  enddo
122  p%fm%p(4) = g*q%fm%p(4) + gbq
123 ! j=1, but matrix is not computed
124  if(j .eq.1) jsv=0
125  else
126 ! rotate the axes by atan(beta(y)/beta(x)) around z,
127 ! then rotate the axes by atan(beta/beta(z))
128 ! around y, then the orignal z axis coincide with
129 ! beta. apply lorentz trans. there and re-rotate
130 ! matrix for z-axis
131  if(j .eq. 1 .or. jsv .eq. 0) then
132  if(gb%p(2) .eq. 0. .and. gb%p(1) .eq. 0.) then
133  fai1=0.
134  else
135  fai1= atan2(gb%p(2), gb%p(1))
136  endif
137  call cgetrotmat4(3, fai1, rmz)
138 ! matrix for y-axis
139  tmp=gb%p(1)**2 + gb%p(2)**2
140  agb%p(3)= sqrt(tmp + gb%p(3)**2)
141  agb%p(4)=g
142  if(tmp .eq. 0. and. gb%p(3) .eq. 0.) then
143  fai2 = 0.
144  else
145  fai2= atan2(sqrt(tmp), gb%p(3))
146  endif
147  call cgetrotmat4(2, fai2, rmy)
148 ! combined rotaion matrix
149  call cmultrotmat4(rmy, rmz, rm)
150  endif
151 ! do combined rotaion
152  qt = q
153  call capplyrot4(rm, q%fm, qt%fm)
154  qt%fm%p(4)=q%fm%p(4)
155 ! ////////////
156 ! call ctestOnShell('q before rot', q)
157 ! call ctestOnShell('qt after rot', qt)
158 ! ////////////////
159 
160 ! lorentz trans. along beta
161  call clorez(agb, qt, qt)
162 ! /////////
163 ! call ctestOnShell('after lorez', qt)
164 ! /////////////
165 ! re-rotate; get inverse rotation matrix
166  if(j .eq. 1 .or. jsv .eq. 0) then
167  call cinvrotmat4(rmz, rmzi)
168  call cinvrotmat4(rmy, rmyi)
169  call cmultrotmat4(rmzi, rmyi, rmi)
170  endif
171  call capplyrot4(rmi, qt%fm, p%fm)
172  p%fm%p(4) = qt%fm%p(4)
173 ! ////////////
174 ! call ctestOnShell('after rot', p)
175 ! ////////////////
176  jsv=1
177  endif
178  end
subroutine cmultrotmat4(a, b, c)
Definition: cgetRotMat4.f:131
subroutine cinvrotmat4(rm, rmn)
Definition: cgetRotMat4.f:110
subroutine cgetrotmat4(m, ang, rm)
Definition: cgetRotMat4.f:79
Definition: Zptcl.h:72
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
subroutine capplyrot4(a, v, vn)
Definition: cgetRotMat4.f:148
subroutine clorep(j, gb, q, p)
Definition: clorep.f:88
dE dx *! Nuc Int sampling table g
Definition: cblkMuInt.h:130
Definition: Zptcl.h:75