COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cmBremE1.f
Go to the documentation of this file.
1  subroutine cmbreme1(up, x)
2 !
3 ! Samples synchrotron gamma energy as the fraction
4 ! to the electron energy. Test for up = 10**-8 to 100.
5 ! This is for the first part of Eq.5 Brainerd and Petrosian
6 ! (APJ 320. 1987)
7  implicit none
8 !
9  real*8 up ! input. Upsilon value. = Ee/Me * B/Bcr
10 !
11  real*8 x ! output. sampled fractional gamma energy
12 
13 !
14 
15  integer n1, n2, n, i, nx
16  parameter(n1 = 4, n2=3, n=8)
17  real*8 c(n), p(n), xp(n+1)
18  real*8 fx, ft
19  real*8 x01(n1), x02(n2), c1(n1), c2(n2)
20  real*8 p1(n1), p2(n2)
21  real*8 xp1(n1+1), coef1(n1)
22  real*8 xp2(n2+1), coef2(n2)
23  real*8 z, u, cmBremF11
24  data c1/2.149, 0.918, .5119, 0.00877/
25  data p1/-0.3333333333d0, 0.0d0, 1.003, 5.54/
26  data x01/1., 1.0, 1.333d0, 5.9566/
27  data xp1/0.0, 7.795048057547918e-02, .7446141661381438,
28  * 3.3841299222059, 15.0/
29  data coef1/2.149, .918, .6829513524709896, 172.3816110479136/
30 
31 
32  data p2/1., 1.666666, 3./
33  data c2/1., 0., 0./
34  data x02 /1., 0., 1./
35 
36 ! --------------------------------------------------
37  c2(2) = up/3.
38  c2(3) = 1./9/up/up
39 
40  x02(2) = 1./3./up
41 
42 ! ******************* next is no more needed **********
43 ! since the result is put in the data statement.
44 !
45 ! call ksampPwX( c1, p1, x01, n1, xp1(2), coef1 )
46 ! xp1(1) = 0.
47 ! xp1(n1+1) = 15. ! exp(-15) is very small
48 !
49 ! write(*, *) ' xp1', xp1
50 ! write(*, *) ' coef1', coef1
51 !
52 
53  call ksamppwx(c2, p2, x02, n2, xp2(2), coef2)
54  xp2(1) = 0.
55  xp2(n2+1) =max( xp2(n2) * 1.5, xp1(n1+1))
56 !
57 ! write(*, *) ' xp2', xp2
58 ! write(*, *) ' coef2', coef2
59 !
60 ! merge two power functions
61  call ksamppwmrg(coef1, p1, xp1, n1,
62  * coef2, p2, xp2, n2,
63  * c, p, xp, nx)
64 !
65 ! write(*,*) ' merged n c=', nx, c
66 ! write(*, *) ' p=', p
67 ! write(*,*) ' xp=', xp
68 !
69 ! ----------------
70 
71  do i = 1, 1000
72  call ksamppw(i, c, p, xp, nx, z, fx)
73 ! compute correct function value at z
74  ft = cmbremf11(z) / z/(2. + 3.*up*z)**2
75  call rndc(u)
76  if(u .lt. ft/fx) then
77  goto 200
78  endif
79  enddo
80 
81 ! -------------------------------------------------------------------
82 ! This rejection efficiency is as follows:
83 ! average trials. standard dev. max in 10000 gene approx distribution
84 ! up = 10
85 ! 2.52 1.94 18 exp(-x/2.4)
86 ! up = 1.
87 ! 2.805 2.23 25 exp(-x/2.5)
88 ! up = 1.e-3
89 ! 4.26 3.75 43 exp(-x/4.0)
90 ! up = 1.e-6
91 ! almost no change from up = 1.e-3
92 !
93 ! -------------------------------------------------------------------
94 
95 
96 !
97  200 continue
98  x = 3.*up*z/2.
99  x = x/(1.+x)
100 !
101 ! write(*, *) i, sngl(x)
102 !
103  end
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
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 ksamppwx(c, p, x0, n, xp, c2)
Definition: ksampPw.f:240
subroutine cmbreme1(up, x)
Definition: cmBremE1.f:2
subroutine ksamppwmrg(c1, p1, x1, n1, c2, p2, x2, n2, c, p, x, n)
Definition: ksampPw.f:273
subroutine ksamppw(ini, coef, power, node, n, x, fx)
Definition: ksampPw.f:95