COSMOS v7.655  COSMOSv7655
(AirShowerMC)
ctransVectZ.f
Go to the documentation of this file.
1 ! test ctransVectZ
2 ! implicit none
3 ! include 'Zcoord.h'
4 ! record /coord/ wa, dc, ans
5 ! real*8 cst, snt, fai
6 ! wa.r(1)=.50
7 ! wa.r(2)=0.5
8 ! wa.r(3)=sqrt(1. - (wa.r(1)**2+wa.r(2)**2))
9 ! cst=0.8
10 ! snt=sqrt(1.-cst**2)
11 ! do fai=0., 2*3.1415, .1
12 ! dc.r(1)=snt*cos(fai)
13 ! dc.r(2)=snt*sin(fai)
14 ! dc.r(3)=cst
15 ! call ctransVextZ(wa, dc, ans)
16 ! write(*,*) sngl(ans.r(1)), sngl(ans.r(2)),
17 ! * sngl(ans.r(3))
18 ! enddo
19 ! end
20  subroutine ctransvectz(zax, dir1, dir2)
21  implicit none
22 
23 #include "Zcoord.h"
24  type(coord)::zax
25  type(coord)::dir1
26  type(coord)::dir2
27  real*8 sml, epsx, av
28 
29  parameter(sml=0.001d0, epsx=1.d-8, av=.985d0)
30 
31 !
32 ! /usage/ call ctransVectZ(zax, dir1, dir2)
33 ! Directions cosines(dir1) are given in a system
34 ! (=R) whose z-axis has direction cosines (zax) in
35 ! a certain system(=B).
36 ! This subroutine transform the angles so that (dir1)
37 ! be the direction cosines in the B-system,
38 ! and put the result into dir2.
39 ! The x and y
40 ! axes of the R-system are chosen so that the transformation
41 ! becomes simplest. This does not guarantee that the dir2
42 ! have the same sing as the original one when xax(1) is
43 ! 1.0 or close to 1.0. If you have to avoid such,
44 ! use, ctransVectZ2. (For magnetic deflection, you need this).
45 ! dir2 can be the same one as dir1, or zax.
46 ! dir1 need not be the direction cosine, but can be momentum
47 ! or arbitrary vector. zax must be direction cos.
48 !
49  real*8 w1a, w2a, w3a, dc1, dc2, dc3, el2, em2, d, a, b, c
50  real*8 tmpa, tmpb, tmpc
51 ! real*8 norm
52  w1a=zax%r(1)
53  w2a=zax%r(2)
54  w3a=zax%r(3)
55  dc1=dir1%r(1)
56  dc2=dir1%r(2)
57  dc3=dir1%r(3)
58 !
59  el2=w1a**2
60  em2=w2a**2
61  d=1.+w3a
62  if(abs(d) .gt. epsx) then
63  a=el2/d - 1.
64  b=w1a*w2a/d
65  c=em2/d - 1.
66  tmpa=a*dc1 + b*dc2 + w1a*dc3
67  tmpb=b*dc1 + c*dc2 + w2a*dc3
68  else
69  tmpa= dc2
70  tmpb= dc1
71  endif
72  tmpc=w1a*dc1 + w2a*dc2 + w3a*dc3
73 ! check result
74 ! norm = tmpa**2 + tmpb**2 + tmpc**2
75 ! if(abs(norm-1.d0) .gt. 1.e-5) then
76 ! renormalize
77 ! norm = sqrt(norm)
78 ! tmpa=tmpa/norm
79 ! tmpb=tmpb/norm
80 ! tmpc=tmpc/norm
81 ! endif
82  dir2%r(1)=tmpa
83  dir2%r(2)=tmpb
84  dir2%r(3)=tmpc
85  end
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
subroutine ctransvectz(zax, dir1, dir2)
Definition: ctransVectZ.f:21
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
Definition: Zcoord.h:43