COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cmaxMovLen.f
Go to the documentation of this file.
1 ! get max movable lenghth of a ptcl.
2  subroutine cmaxmovlen(leng, thick)
3 ! leng: real*8. output. max movable length in m.
4 ! thick: real*8. output. thickness corresponding to leng in kg/m2.
5 ! however, note;
6 ! AlmostVacT, if Reverse=0 and height >AlmostVacH
7 ! 0. if Reverse = 1.
8 ! 0. if Reverse = 2 and height > AlmostVacH
9 !
10 ! A) if a charged ptcl
11 ! A-1) compute (radius of gyro circle)/LamorDiv
12 ! where LamorDiv is 10 in default. Also compute length where
13 ! dB < 1%. Take minimum of both.
14 ! A-2) if not Reverse mode, compute maximum gramage where cascade
15 ! scatteing remains very small; For a high energy electron,
16 ! density change must be kept small so get minimum of
17 ! of the both gramage. Convert the gramage into length.
18 ! if A-1) is shorter than A-2, take A-1 length and compute
19 ! corresponding gramage. If A-2 is shorter, leng and thick
20 ! are already obtained.
21 ! A-3) if Reverse mode =1, take A-1) and make thick = 0
22 ! if Reverse mode =other, take A-1) and compute thick
23 ! corresponding to A-1)
24 ! elsse if
25 ! B) a neutral particle,
26 ! B-1) assume a large length; rmg
27 ! If not Revesr mode,
28 ! for neutrinos use such B-1) and corresponding thickness
29 ! (thickness is not used at all)
30 ! for photons,
31 ! if E> mag pair region, get length wherer dB<1 %
32 ! and take min of this and rmg. (gramage not yet computed)
33 !
34 ! if E > LPM region, get gramage where LPM xsection
35 ! remains const
36 ! else take gramage= X0*5
37 ! compute corresponding length
38 ! if its rmg< length, use rmg and compute corresponding
39 ! thickness else use already computed length and thick
40 ! if Reverse mode = 1, use leng=rmg and thick=0
41 ! if Reverse mode =other, use leng =rmg and corresponding thickness
42 !
43 !
44  use modefield
45  implicit none
46 #include "Zcode.h"
47 #include "Ztrack.h"
48 #include "Ztrackp.h"
49 #include "Ztrackv.h"
50 #include "Zelemagp.h"
51 #include "Zstdatmos.h"
52 
53  real*8 leng, thick
54 !
55  real*8 ztrunc, rmg, rmgmax, L
56  real*8 clen2thick, erg
57  integer jcut
58  integer ka
59 
60 
61  ka = trackbefmove%p%code
62  erg = trackbefmove%p%fm%p(4) - trackbefmove%p%mass
63  if( erg .le. 0.) then
64  leng = 0.
65  thick = 0.
66  return ! *****
67  endif
68 ! fix energy dependent truncation path
69  if(trackbefmove%p%charge .ne. 0) then
70 ! magnetic deflection
71  call cmagdefr(trackbefmove, mag, rmg) ! get radius approx.
72  rmg = rmg/lamordiv ! this is almost streight movable
73 ! get max length within which B is almost const (dB< 1 %)
74  call clengsmallbc(trackbefmove, rmgmax)
75  rmg = min(rmg, rmgmax)
76 ! E field effect. Length: momentum change < 1%.
77  if( howefield > 0 ) then
78  call cmaxefefflen(trackbefmove, l) ! L in m
79  rmg = max(min(l, rmg), 0.1d0)
80  endif
81 ! mul. scatt and lpm
82  if(reverse .eq. 0) then
83 ! scattering effect; streight and scattered line must be
84 ! not so much different ; path < ztrunc (kg/m2)
85 ! 1 kg/m2 = 1000g/10^4 cm2 = 0.1g/cm2
86  call cmaxcaslen(trackbefmove, ztrunc)
87  if(trackbefmove%p%code .eq. kelec .and.
88  * trackbefmove%p%fm%p(4) .gt. lpmbrememin
89  * .and. lpmeffect ) then
90  ztrunc =
91  * max( min(trackbefmove%pos%depth/10., ztrunc),
92  * 30.d0 )
93  endif
94 
95  if(ka .eq. kmuon .or. ka .eq. kpion .or.
96  * ka .eq. kkaon ) then
97 ! energy loss < erg's 1%-->5*erg g/cm2 = 50kg /m2
98  ztrunc =min(ztrunc, 50.d0*erg)
99  endif
100 
101  ztrunc = min(ztrunc, maxstep(trackbefmove%where))
102  call cthick2len(trackbefmove,
103  * ztrunc, leng, thick, jcut)
104  if(rmg .lt. leng) then
105  thick = clen2thick(trackbefmove%pos%height,
106  * trackbefmove%vec%coszenith, rmg)
107  leng = rmg
108  endif
109  elseif(reverse .eq. 1) then
110  leng = rmg
111  thick = 0.
112  else
113  leng = rmg
114  thick = clen2thick( trackbefmove%pos%height,
115  * trackbefmove%vec%coszenith, rmg)
116  endif
117  else
118 ! neutral
119  rmg = 1.d5
120  if(reverse .eq. 0) then
121  if(trackbefmove%p%code .eq. kneumu .or.
122  * trackbefmove%p%code .eq. kneue) then
123  leng = rmg ! means very large
124  thick = almostvact ! not used
125  else
126  if(trackbefmove%p%code .eq. kphoton) then
127  if(erg .gt. magpairemin .and. magpair .ne. 0) then
128  call clengsmallbc(trackbefmove, rmgmax)
129  rmg = min(rmg, rmgmax)
130  endif
131  endif
132 ! next one cannot be compliled by ifort at
133 ! opteron. reason unknown so it is modifed.
134 ! if(TrackBefMove.p.code .eq. kphoton .and.
135 ! * TrackBefMove.p.fm.p(4) .gt. LpmPairEmin .and.
136 ! * LpmEffect) then
137 
138  if(trackbefmove%p%code .eq. kphoton .and. lpmeffect
139  * .and. trackbefmove%p%fm%p(4) .gt. lpmpairemin ) then
140  if(trackbefmove%pos%height .lt. almostvach) then
141  ztrunc = trackbefmove%pos%depth/10.
142  else
143  ztrunc = almostvact
144  endif
145  else
146  ztrunc = x0*5
147  endif
148  call cthick2len(trackbefmove,
149  * ztrunc, leng, thick, jcut)
150 ! thick may have been changed to shorter one.
151  if(rmg .lt. leng) then
152  thick = clen2thick(trackbefmove%pos%height,
153  * trackbefmove%vec%coszenith, rmg)
154  leng = rmg
155  else
156 ! leng and thick are given
157 ! thick = AlmostVacT ! not used.
158 ! leng = rmg ! strange
159  endif
160  endif
161  elseif(reverse .eq. 1) then
162  leng = rmg
163  thick = 0.
164  else
165  leng = rmg
166 !c if(TrackBefMove.pos.height .gt. AlmostVacH) then
167 !c thick = 0.
168 !c else
169  thick = clen2thick(trackbefmove%pos%height,
170  * trackbefmove%vec%coszenith, rmg)
171 !c endif
172  endif
173  endif
174  end
175 ! **********************
176  subroutine cmaxcaslen(aTrack, kgpm2)
177  implicit none
178 ! get max. movable length for cascade so
179 ! that the scattering deflection can be
180 ! neglected
181 #include "Ztrack.h"
182 #include "Ztrackp.h"
183 !c #include "Ztrackv.h"
184 #include "Zelemagp.h"
185 
186  type(track)::aTrack ! input.
187  real*8 kgpm2 ! output. length kg/m2
188 
189 !
190  real*8 ek, ttrunc
191 
192 
193  ek = atrack%p%fm%p(4) - atrack%p%mass
194  if(ek .gt. 1.d-3) then
195 ! 1MeV -->5e-3 r.l --> 360*5e-3 kg/m2~ 1.8 kg/m2
196  ttrunc=min( ek*5.0d0, 1.d0)
197  else
198 ! 1e-3 r.l --> 365e-3 ~ 0.3 kg/m2
199  ttrunc = max(1.d-3, ek*2.d0)
200  endif
201  kgpm2= ttrunc*x0
202  end
203  subroutine cmaxefefflen(aTrack, L)
204 ! max movable length L in m
205 ! electric field exist. length for
206 ! momentum loss/gain is < 1%.
207 ! dp/dt = ZeE =Z*eval*Ef (GeV/c/s)
208 ! dp = Z* eval*Ef*dt = Z*eval*Ef*dt = Z*eval*Ef*L/c (GeV/c)
209 !
210 ! dp/p ~ Z*eval*Ef*L/c/p
211 ! L = dp/p /(Z*eval*Ef)*c*p
212 ! if Ef=1000 V/m, p=0.1GeV/c, dp/p~0.01, Z=1
213 ! L = 0.01 *3e8*0.1 /(0.3*1000) = 3e5/300 = 1000 m
214 ! p=1MeV==> 10 m
215 ! Ef=1.e5 50 MeV
216 ! L = 10 m
217  use modbefield
218  implicit none
219 #include "Ztrack.h"
220  type(track)::aTrack ! input current particle track
221  real(8),intent(out):: L ! length for dp/p < 1%
222 
223  real(8):: p, Ef
224  real(8),parameter:: dpbyp = 0.01d0
225  p = sqrt(dot_product(atrack%p%fm%p(1:3),atrack%p%fm%p(1:3)))
226 
227  call cgetefield(atrack) ! ans is in Efld
228 
229  ef = sqrt(dot_product( efld(1:3), efld(1:3)) )
230 ! dpbyp = aTrack.p.chare*eval*Ef*L/3e8/p
231  if(ef == 0. ) then
232  l = 1.e10
233  else
234  l =abs( dpbyp*p*3.0e8/(atrack%p%charge*eval*ef) )
235  endif
236  end
237 ! *************************************
238  subroutine cmagdefr(aTrack, mag, r)
239 ! get magnetic deflecton radius. This is
240 ! approximate one.
241  implicit none
242 
243 #include "Ztrack.h"
244 
245  type(track)::aTrack ! input. charged particle
246  type(magfield)::mag ! innput. magnetic field
247  real*8 r ! output. Radius of magnetic defletion. m
248 
249  real*8 maxb, EK
250 
251  if(atrack%p%charge .eq. 0) then
252  r = 1.e30
253  else
254  ! 2013.Aug
255  maxb = atrack%vec%w%r(1)*mag%x +
256  * atrack%vec%w%r(2)*mag%y +
257  * atrack%vec%w%r(3)*mag%z
258  maxb = abs(maxb)
259 
260 ! maxb = max (abs(mag.x), abs(mag.y), abs(mag.z)) ! old one
261 
262  if(maxb .ne. 0) then
263  ek = atrack%p%fm%p(4)-atrack%p%mass
264  if( ek < 3*atrack%p%mass ) then
265 ! r is smaller than true Lamor radius which
266 ! would be obtained with momentum
267 ! since K.E < P; so get p here
268  ek= sqrt( sum(atrack%p%fm%p(1:3)**2) ) ! momentum p
269  endif
270  r = 3.33d0*ek/maxb/abs(atrack%p%charge)
271 ! r= max(r, 1.d-2)
272  r= max(r, 0.1d0) ! 2013.Aug.
273  else
274  r = 1.e30
275  endif
276  endif
277  end
278 ! ***********************
279  subroutine clengsmallbc(aTrack, r)
280 ! get length where the change of magnetic
281 ! field can be regarded as small < 1 %
282  implicit none
283 
284 #include "Ztrack.h"
285 #include "Ztrackp.h"
286 #include "Zearth.h"
287 
288  type(track)::aTrack ! input. r is obtaiend at this ptcl is
289 ! located.
290  real*8 r ! output. within this length (m), geomag can be
291 ! regarged as constant.
292 
293 ! at the surface of Earth, it is about 20 km = MagChgDist
294 ! at larger radial distance, it becomes larger
295 !
296  r = atrack%pos%radiallen/eradius * magchgdist
297 
298  end
subroutine cgetefield(aTrack)
Definition: cdefByMagAndE.f:11
subroutine clengsmallbc(aTrack, r)
Definition: cmaxMovLen.f:280
subroutine cmaxmovlen(leng, thick)
Definition: cmaxMovLen.f:3
integer, save howefield
Definition: cEfield0.f:17
subroutine cthick2len(aTrack, tin, leng, t, jcut)
Definition: cthick2len.f:6
const int kphoton
Definition: Zcode.h:6
Definition: Ztrack.h:44
max ptcl codes in the kkaon
Definition: Zcode.h:2
max ptcl codes in the kelec
Definition: Zcode.h:2
subroutine cmaxcaslen(aTrack, kgpm2)
Definition: cmaxMovLen.f:177
max ptcl codes in the kneue
Definition: Zcode.h:2
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
max ptcl codes in the kneumu
Definition: Zcode.h:2
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
real(8), save eval
Definition: cdefByMagAndE.f:4
*************************block data cblkTracking *************************implicit none data *ExactThick *Freec *RatioToE0 *MagChgDist *TimeStructure *Truncn *Truncx data *IncMuonPolari *KEminObs *ThinSampling *EthinRatio *Generate *LpmEffect *MagPairEmin e10
Definition: cblkTracking.h:9
subroutine cmagdefr(aTrack, mag, r)
Definition: cmaxMovLen.f:239
real(8), dimension(3), save efld
Definition: cdefByMagAndE.f:3
max ptcl codes in the kpion
Definition: Zcode.h:2
max ptcl codes in the kmuon
Definition: Zcode.h:2
subroutine cmaxefefflen(aTrack, L)
Definition: cmaxMovLen.f:204