COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cvec2dcos.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine cvec2dcos (vx, vy, dircos)
 
subroutine cdispvec2dcos (dx, dy, len, dircos)
 

Function/Subroutine Documentation

◆ cdispvec2dcos()

subroutine cdispvec2dcos ( real*8  dx,
real*8  dy,
real*8  len,
type(coord dircos 
)

Definition at line 41 of file cvec2dcos.f.

41 ! len: output
42 ! dircos: output
43 !
44  implicit none
45 !---- include 'Zcoord.h'
46 #include "Zcoord.h"
47  real*8 dx, dy, len
48  type(coord)::dircos
49 !
50  if(dx .eq. 0. .and. dy .eq. 0.) then
51  len = 0.
52  dircos%r(1) = 0.
53  dircos%r(2) = 0
54  dircos%r(3) = 1.
55  else
56  len = sqrt(dx**2 + dy**2)
57  dircos%r(1) = dx/len
58  dircos%r(2) = dy/len
59  dircos%r(3) = 0.
60  endif
integer npitbl real *nx dx real dx
Definition: Zcinippxc.h:10
Definition: Zcoord.h:43

◆ cvec2dcos()

subroutine cvec2dcos ( real*8  vx,
real*8  vy,
type(coord dircos 
)

Definition at line 5 of file cvec2dcos.f.

References d0.

5 ! small vector( vx, vy ) is converted into direction cos.
6 ! valid only for samll vec, which is alw.r(2)s assumed.
7  implicit none
8 
9 #include "Zcoord.h"
10  real*8 vx, vy
11  type(coord)::dircos
12 !
13  real*8 sum
14 !
15  if(vx .eq. 0 .and. vy .eq. 0.) then
16  dircos%r(1) = 0.
17  dircos%r(2) = 0.
18  dircos%r(3) = 1.
19  else
20  if(abs(vx) .lt. 1.) then
21  dircos%r(1) = vx
22  else
23  dircos%r(1) = 1.
24  endif
25  if(abs(vy) .lt. 1.) then
26  dircos%r(2) = vy
27  else
28  dircos%r(2) = 1.
29  endif
30  dircos%r(3) = max(0.d0, 1.d0 - (vx**2 + vy**2)/2)
31 ! make consistent as direction cos
32  sum = sqrt(dircos%r(1)**2 + dircos%r(2)**2 + dircos%r(3)**2)
33  dircos%r(1) = dircos%r(1)/sum
34  dircos%r(2) = dircos%r(2)/sum
35  dircos%r(3) = dircos%r(3)/sum
36  endif
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
Definition: Zcoord.h:43