COSMOS v7.655  COSMOSv7655
(AirShowerMC)
c3DV2DDCos.f
Go to the documentation of this file.
1 ! 3 D vector's direction is obtained
2  subroutine c3dv2ddcos(a, b, len)
3  implicit none
4 #include "Zcoord.h"
5  type(coord)::a ! input coord (only 3 vect is used)
6  type(coord)::b ! output coord. in direction cos. b can be a.
7  real*8 len ! output. length of a.
8 
9  len = sqrt( a%r(1)**2 + a%r(2)**2 + a%r(3)**2)
10  if(len .eq. 0.) then
11  b%r(1) = 0.
12  b%r(2) = 0.
13  b%r(3) = 1.
14  else
15  b%r(1) = a%r(1)/len
16  b%r(2) = a%r(2)/len
17  b%r(3) = a%r(3)/len
18  endif
19  end
subroutine c3dv2ddcos(a, b, len)
Definition: c3DV2DDCos.f:3
Definition: Zcoord.h:43