COSMOS v7.655  COSMOSv7655
(AirShowerMC)
ksampPEang.f
Go to the documentation of this file.
1 !c test ksampPEang
2 ! implicit none
3 ! real*8 a, cost
4 ! integer i
5 ! a = 4.
6 ! write(0,*) 'Enter a >1 '
7 ! read(*,*) a
8 !
9 ! do i = 1, 100000
10 ! call ksampPEang(a, cost)
11 ! write(*,*) cost
12 ! enddo
13 ! end
14 
15  subroutine ksamppeang(ain, cost)
16  implicit none
17 ! This program samples cost=x from the following distribution
18 ! (1-x**2)/(a-x)**4 dx
19 ! where a>1. This is related to the cosine angle of the
20 ! ejected photo-electron at the photo-electric effect.
21 ! (angle is relative to the incident photon).
22 ! This distribution is valid for few keV to *10 keV
23 ! photons.
24 ! a= ((alfa*Z)**2 +2Ee + Eg**2)/2Egsqrt(2Ee)
25 ! where alfa: fin structure const.
26 ! Z: effective atomic number
27 ! Ee: energy of electron /Me
28 ! Eg: // photon /Me
29 !
30  real*8 ain !input "a" value > 1
31  real*8 cost ! output. sampled cos angle
32 
33  real*8 x1, x2, x, eps, ans
34  integer icon
35  real*8 ksampPEangf
36  external ksamppeangf
37  real*8 norm, u, peakpos, am1
38 
39  real*8 a, a1, a2, a3, c1, un
40  common /cksamppeang/a, a1, a2, a3, c1, un
41 
42  a = ain
43  c1 = (1.0-a**2)/3.0
44  a1 = (a+1.0)
45  a2 = a1*a1
46  a3 = a2*a1
47  am1=(a-1.0)
48  norm = c1*(1.0/am1**3 - 1.0/a3) + a*(1./am1**2 -1.0/a2)
49  * - (1.0/am1 - 1.0/a1)
50  call rndc(u)
51  un = norm*u
52 ! peak pos. of the distribution
53  peakpos =(sqrt(a**2 + 8)-a)/2.0
54 
55  x = peakpos
56  x1=-1.
57  x2 =1.0
58  eps = 1.d-4
59  call kbinchop(ksamppeangf,
60  * x1, x2, x, eps, cost, icon)
61 ! write(0,*) ' icon=',icon, ' x=',ans
62  end
63 
64 
65  real*8 function ksamppeangf(x)
66  implicit none
67  real*8 x
68 
69  real*8 a, a1, a2, a3, c1, un
70  common /cksamppeang/a, a1, a2, a3, c1, un
71 
72  real*8 ax
73 
74  ax = a-x
75  ksamppeangf = c1*(a3-ax**3) +a*ax*a1*(a2-ax**2)
76  * - ax**2*a2*(a1-ax) - un*ax**3*a3
77 
78  end
79 
80 
subroutine kbinchop(f, x1, x2, x, eps, ans, icon)
Definition: kbinChop.f:20
subroutine rndc(u)
Definition: rnd.f:91
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
real *8 function ksamppeangf(x)
Definition: ksampPEang.f:66
subroutine ksamppeang(ain, cost)
Definition: ksampPEang.f:16