COSMOS v7.655  COSMOSv7655
(AirShowerMC)
ksampRSA.f
Go to the documentation of this file.
1 ! real*8 x
2 ! do i = 1, 1000000
3 ! call ksampRSA(x)
4 ! write(*,*) x
5 ! enddo
6 ! end
7  subroutine ksamprsa(costheta)
8  implicit none
9 ! sample cos from (1+cos^2)dcos
10  real*8 costheta ! output cos ofsampled angle
11  real*8 u1, u2, u3
12 
13  call rndc(u1)
14  if(u1 .lt. 0.75d0) then
15  call rndc(u2)
16  costheta = 2.0*u2 -1.
17  else
18 ! second term. take max of 3 u's.
19  call rndc(u1)
20  call rndc(u2)
21  call rndc(u3)
22  costheta = max(u1, u2, u3)
23  call rndc(u1)
24  if(u1 .lt. 0.5) then
25  costheta = -costheta
26  endif
27  endif
28  end
29 
30 
subroutine rndc(u)
Definition: rnd.f:91
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
subroutine ksamprsa(costheta)
Definition: ksampRSA.f:8