COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cmoliere.f
Go to the documentation of this file.
1  subroutine cmoliere(rhoin,
2  * z, mass, g1, g2, leng, teta, cond)
3  implicit none
4 ! Moliere theory of multiple scattering angle.
5 !
6  real*8 rhoin ! input. average media density in kg/m^3
7 
8  integer z ! input. charge of the particle is ze
9  real*8 mass ! input. mass of the particle in GeV
10  real*8 g1 ! input. gamma factor at the path head
11  real*8 g2 ! input. gamma factor at the path end
12  real*8 leng ! input. length the charged particle travelled in m.
13  real*8 teta ! output. sampled spatial angle in radain.
14  integer cond ! output. 0 ok. non-0. Moliere theory not applicable
15 
16  real*8 rho, gbeta2, beta2, massratio2
17  common /zcmedia/ rho, gbeta2, beta2,
18  * massratio2
19 
20 ! *********************
21  real*8 xc2, xa2, bp, b, u
22  real*8 a0, a1, a2, sum, ra2, ra2inv
23 
24  integer icon
25  real*8 rejf1, rejf21, rejf22
26  real*8 x
27 !
28 ! rejection function for redueced angle < 1.8
29 ! x is suqre of reduced angle better than 0.2 %
30  rejf1(x)= ((0.1217176d-01*x + 0.3054916d-01)*x -0.2524543d0)*x
31  * + 0.9990352d0
32 !
33 ! at 0 < x = 1/angle^2 < 0.15
34  rejf21(x) =(( -162.1568*x + 44.48334)*x + 0.3907116)*x
35  * + 0.4399338
36 
37 ! at x = 1/angle^2 > 0.15
38  rejf22(x) = (( 71.23819*x - 49.61906)*x + 10.77501)*x+ 0.2001145
39 !
40 ! ------------------------------------
41  rho = rhoin
42 ! bgeta2 (g-1/g) = g*beet^2 = g*(1-1/g^2)
43  gbeta2=(g1 - 1.d0/g1) * (g2 - 1.d0/g2)
44  beta2 = 1.d0 - 1.d0/g1/g2
45  massratio2= (0.511d-3/mass)**2 ! (me/m)^2
46 ! ............................
47 
48 ! get Xc^2
49  call ckaic2(z, leng, xc2)
50 ! get Xa^2
51  call ckaia2(z, xa2)
52 
53 ! b -log(b) = b'
54  bp = log(xc2/xa2/1.167)
55 
56  if(bp .lt. 3.395) then
57 ! Moliere theory cannot be appliled; use Gaussian later (almost no scattering)
58  cond = 1
59  else
60  cond = 0
61  call cblogb(bp, b, icon)
62  a0 = max(1.d0 - 5/b, 0.d0) ! use single scattering term if b<=5.
63  icon = 1 ! make 0 if no rejection
64 ! the sampling function decomposition is explained in Test/....tex
65  do while (icon .ne. 0)
66  a1 = 5.21062/b
67  a2 = 0.7128/b
68  sum = a0 + a1 + a2
69  call rndc(u)
70  if(a0/sum .gt. u) then
71 ! sample reduced angle from exp(-x) dx where x = reduced
72 ! angle^2.
73  call rndc(u)
74  ra2 = -log(u)
75  icon =0
76  elseif( (a0+a1)/sum .gt. u) then
77 ! sample reduced angle from exp(-x) dx (same as above but
78 ! in the region of ra < 1.8
79  call rndc(u)
80  ra2 = -log(1.-u/1.04076)
81 ! rejection function
82  call rndc(u)
83  if(u .lt. rejf1(ra2)) then
84  icon = 0
85  endif
86  else
87 ! sample reduced angle from 2xc2 x^-4dx
88  call rndc(u)
89  ra2 = 3.24/u
90 ! rejection function
91  call rndc(u)
92  ra2inv = 1./ra2
93  if(ra2inv .lt. 0.15) then
94  if(u .lt. rejf21(ra2inv)) then
95  icon = 0
96  endif
97  elseif(u .lt. rejf22(ra2inv)) then
98  icon = 0
99  endif
100  endif
101  enddo
102  teta =sqrt( ra2 * xc2 * b)
103  endif
104  end
105 ! ***************************
106  subroutine cblogb(c, b, cond)
107  implicit none
108 ! solve B - log(B) = c
109 !
110  real*8 c ! input. c>=1.
111  real*8 b ! output. solved b >=1. (b <1 is discarded)
112  integer cond ! output. 0 if ok.
113  ! 1 if c < 1.
114  if(c .lt .1) then
115  cond = 1
116  else
117 ! b = 0.7 + 1.32 *c - 0.01451* c*c
118  b =(((-0.3733404e-04*c + 0.1902303e-02)*c -0.3841290e-01 )*c
119  * + 1.431932)*c + 0.5200487
120  endif
121  end
122  subroutine ckaia2(z, xa2)
123  implicit none
124 #include "Zair.h"
125 ! compute Xa^2; assume the Xa^2 is weakly
126 ! dependent on Z, we use average Z=zave for
127 ! calculation.
128 !
129  integer z ! input. charge of the charged particle is ze
130  real*8 xa2 ! output. Xa^2.
131 
132  real*8 rho, gbeta2, beta2, massratio2
133  common /zcmedia/ rho, gbeta2, beta2,
134  * massratio2
135 
136  real*8 alpha, const, pi, large
137  parameter(alpha = 1./137., const = (1.13*alpha)**2 )
138  parameter(pi = 3.1415, large = (pi/2.)**2)
139 
140  if(gbeta2 .le. 0.) then
141  xa2 = large
142  else
143 ! since air Z is close N and O's Z, we
144 ! use simply average of Z here.
145  xa2 = const * targetz2_3rd * massratio2 *
146 ! * (1.13 * beta2 + 3.76*(alpha*z*zave)**2) /gbeta2
147  * (1.13 *beta2 + 3.76*(alpha*z*targetatomicn)**2)
148  * /gbeta2
149  endif
150  end
151 !
152  subroutine ckaic2(z, leng, xc2)
153  implicit none
154 #include "Zair.h"
155 !
156 ! note: we neglect atomic electron contribution because it is
157 ! considered in Moller or Bhabha scattering.
158 !
159 ! compute Xc^2 = 4Pi r_0^2 N0 z^2 rho Z^2/A * integral
160 ! 0 to leng of 1/beta**4/gamma**2 (radian^2)/massratio2
161 !
162  integer z ! input. charged particle charge is ze.
163  real*8 leng ! input. length traveled by the charge particle in m
164  real*8 xc2 ! output. Xc^2 in radian^2
165 
166  real*8 rho, gbeta2, beta2, massratio2
167  common /zcmedia/ rho, gbeta2, beta2,
168  * massratio2
169 
170  real*8 r0, avoganum, const, large, pi
171  parameter(r0=2.817d-15, avoganum=6.022d23, pi= 3.1415)
172  parameter(const = 4.*pi* r0**2 * avoganum*1.d3,
173  * large = (pi/2)**2)
174 !
175 !
176 ! integeral 0 to leng of 1/(beta**4 E**2)
177 ! is approximated as leng/(beta1**2 gamma1 beta2**2 gamma2)
178 ! Note: bata**2 *gamma = gamma - 1/gamma
179 !
180 
181  if(gbeta2 .le. 0.) then
182  xc2 = large
183  else
184 
185  xc2 = const* z* z * massratio2 *
186 ! < Z(Z+1)> /<A>
187  * (targetz2 + targetatomicn)/targetmassn
188  * * rho * leng/gbeta2
189  endif
190  end
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
subroutine cblogb(c, b, cond)
Definition: cmoliere.f:107
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
block data cblkIncident data *Za1ry *HeightOfInj d3
Definition: cblkIncident.h:7
subroutine ckaic2(z, leng, xc2)
Definition: cmoliere.f:153
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 cmoliere(rhoin, z, mass, g1, g2, leng, teta, cond)
Definition: cmoliere.f:3
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
subroutine ckaia2(z, xa2)
Definition: cmoliere.f:123