COSMOS v7.655  COSMOSv7655
(AirShowerMC)
clen2thick.f
Go to the documentation of this file.
1 ! clen2thick
2 !
3 ! Thickness of air corresponding to a given length along
4 ! a given direction from a given height.
5 !
6 ! test program
7 ! include 'catmosutil.f'
8 ! include 'cstdatmos0.f'
9 ! include '../../KKlib/k16pGaussLeg.f'
10 !
11 ! program testclen2thick
12 ! implicit none
13 ! real*8 z, cosz, len, thick, thicka
14 !
15 ! real*8 clen2thick
16 !
17 ! z = 6000.
18 ! cosz = 1.
19 ! len = 3000.
20 ! write(*, *) " enter z, cosz, len=",z, cosz, len
21 ! read(*,*) z, cosz, len
22 ! thick = clen2thick(z, cosz, len)
23 ! write(*, *) " thick = ", thick
24 ! end
25 ! ========================================
26  real*8 function clen2thick(z, cosz, leng)
27 !
28 ! z: real*8. input. vertical height in m.
29 ! cosz: real*8. input. cos of zenith angle at z.
30 ! leng: real*8. input. length along cosz direction.
31 ! function value. thickness of air in kg/m2.
32 !
33  implicit none
34 #include "Ztrack.h"
35 #include "Ztrackp.h"
36 #include "Ztrackv.h"
37 #include "Zatmos.h"
38 
39  real*8 z, cosz, leng, clen2thickEx, clen2thickAp
40  real*8 clen2thickTA
41 
42  if(usetbl .and. z .lt. htop) then
43  clen2thick = clen2thickta(z, leng)
44  elseif(exactthick) then
45  clen2thick = clen2thickex(z, cosz, leng, 10)
46  elseif(abs(cosz) .gt. 0.6) then
47  clen2thick = clen2thickap(z, cosz, leng)
48  else
49  clen2thick = clen2thickex(z, cosz, leng, 10)
50  endif
51  end
52 ! cLen2thickAp
53 !
54 ! Thickness of air corresponding to a given length along
55 ! a given direction from a given height.
56 !
57 ! test program
58 ! include 'catmosutil.f'
59 ! include 'cstdatmos0.f'
60 ! include '../../KKlib/k16pGaussLeg.f'
61 ! include 'clen2thickEx.f'
62 !
63 ! program testclen2thickAp
64 ! implicit none
65 ! real*8 z, cosz, leng, thick, thicka
66 !
67 ! real*8 clen2thickAp, clen2thickEx
68 !
69 ! z = 6000.
70 ! cosz = 1.
71 ! leng = 3000.
72 ! write(*, *) " enter z, cosz, leng=",z, cosz, leng
73 ! read(*,*) z, cosz, leng
74 ! thick = clen2thickEx(z, cosz, leng, 10)
75 ! thicka = clen2thickAp(z, cosz, leng)
76 ! write(*, *) ' thick exact =',thick, ' apprxo = ', thicka
77 ! end
78 ! ========================================
79  real*8 function clen2thickap(z, cosz, leng)
80 !
81 ! z: real*8. input. vertical height in m.
82 ! cosz: real*8. input. cos of zenith angle at z.
83 ! leng: real*8. input. length along cosz direction.
84 ! function value. thickness of air in kg/m2.
85 !
86  implicit none
87 !---- include 'Zearth.h'
88 #include "Zearth.h"
89 
90  real*8 z, cosz, leng
91 !
92 
93  real*8 cosm, rs, re, cvh2thick, cnewcos, ze, t1, t2,
94  * cnewh
95 
96 
97 
98  rs = z + eradius
99  re = cnewh(rs, cosz, leng)
100  ze = re - eradius
101  cosm = cnewcos(rs, cosz, leng/2)
102  t1 = cvh2thick(z)
103  t2 = cvh2thick(ze)
104  clen2thickap = (t2 - t1)/cosm
105  end
106 ! Exact thickness of air corresponding to a gine length along
107 ! a given direction from a given height.
108 ! This uses numerical integration.
109 !
110 ! test program
111 ! include '../../KKlib/k16pGaussLeg.f'
112 ! include 'catmosutil.f'
113 ! include 'cstdatmos0.f'
114 !
115 ! program testclen2thickEx
116 ! implicit none
117 ! real*8 z, cosz, leng, thick
118 !
119 ! real*8 clen2thickEx, cvh2thick
120 !
121 ! z = 6000.
122 ! cosz = 1.
123 ! leng = 3000.
124 ! thick = clen2thickEx(z, cosz, leng, 10)
125 ! write(*, *) ' cos=',cosz,' leng =',leng, ' thick=',thick
126 ! thick = cvh2thick(z-leng*cosz) - cvh2thick(z)
127 ! write(*, *) ' thick=', thick
128 ! end
129 ! ========================================
130  real*8 function clen2thickex(z, cosz, leng, n)
131 !
132 ! z: real*8. input. vertical height in m.
133 ! cosz: real*8. input. cos of zenith angle at z.
134 ! leng: real*8. input. length along cosz direction.
135 ! n: integer.input. how many points for Gauss-Legendre integ.
136 ! function value. thickness of air in kg/m2.
137 !
138  implicit none
139 !---- include 'Zearth.h'
140 #include "Zearth.h"
141 
142  real*8 z, cosz, leng
143  integer n
144 !
145  real*8 seg/1000./, ans, a, b, inte
146 !
147  external catmosrho
148  real*8 catmosrho
149 
150  common /ccatmosrho/ coss, rs
151  real*8 coss, rs
152 !/////
153  real(8),parameter::eps=1.d-5
154  real(8):: error
155  integer icon
156 !///////
157 
158  inte = 0.
159  b =0.
160  coss = cosz
161  rs = z + eradius
162  do while (.true.)
163  a = b
164  b = min(leng, a + seg)
165 ! call kdexpIntF(catmosrho, a, b, eps, ans, error, icon)
166  call k16pgaussleg(catmosrho, a, b, n, ans)
167  inte = inte + ans
168 ! write(*, *) 'a =', a, ' b=',b, ' ans=',ans
169  if(b .eq. leng) goto 10
170  enddo
171  10 continue
172  clen2thickex = inte
173  end
real *8 function catmosrho(x)
Definition: catmosrho.f:5
real *8 function clen2thickap(z, cosz, leng)
Definition: clen2thick.f:80
real *8 function clen2thick(z, cosz, leng)
Definition: clen2thick.f:27
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon true
Definition: cblkElemag.h:7
subroutine k16pgaussleg(func, a, b, n, ans)
Definition: k16pGaussLeg.f:20
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
real *8 function clen2thickex(z, cosz, leng, n)
Definition: clen2thick.f:131
real *8 function cnewh(H, cost, L)
Definition: catmosutil.f:98