COSMOS v7.655  COSMOSv7655
(AirShowerMC)
canihiPath.f
Go to the documentation of this file.
1 ! ****************************************************************
2 ! *
3 ! * canihiPath: e+ annihilaion prob. per r.l
4 ! * capanihiea: samples energy of 2 gammas and angles
5 ! *
6 !
7 !
8 ! **** note ***
9 ! before calling canihiea, canihip must be called and
10 !
11 
12 !
13  subroutine canihipath(ein, prob, path)
14  implicit none
15 #include "Zmass.h"
16  real*8 ein ! input. positron energy in Gev
17  real*8 prob ! output. prob. per r%l
18  real*8 path ! output. sampled path in r%l
19 !
20 
21  real*8 g, csc, g2m, srg2m
22 !
23  real*8 u
24 ! constm=.3*z/a*x0ing = media.basearea*2
25 ! constm=.03*z/a*x0inkgpm2
26 !
27 ! in $elmag must have been fixed beforehand.
28 
29  real*8 constm/5.475/
30  real*8 geqv1/1.00000001d0/
31  save geqv1, constm
32 !
33  g=ein/masele
34  if( g .ge. geqv1) then
35  if(g .gt. 2.5 .and. g .lt. 25.) then
36 ! approx within 1%
37  csc=(((((0.9382535e-07*g-.8791180e-05)*g+0.3338919e-03)*g
38  * -.6609205e-02)*g
39  * +0.7308900e-01)*g-.4516664)*g+ 1.534200
40  elseif(g .lt. 2.5) then
41  g2m=g**2-1.
42  srg2m=sqrt(g2m)
43  csc=( ((g+4.)*g+1.)/g2m * log(g+srg2m) - (g+3.)/srg2m)
44  * /(g+1.)
45  else
46  csc=1.6* g**(-7./9.)
47  endif
48 ! prob = csc * media.basearea
49  prob = csc * constm
50  call rndc(u)
51  path = - log(u)/prob
52  else
53  prob = 1.d10
54  path = 0.
55  endif
56  end
57 !
58 ! ************
59  subroutine canihiea(ein, eg1, eg2, cos1, cos2)
60 ! ************
61  implicit none
62 #include "Zmass.h"
63  real*8 ein
64  real*8 eg1 ! produced gamma energy of higher one.
65  real*8 eg2 ! lower one.
66  real*8 cos1 ! cos angle of eg1
67  real*8 cos2 ! cos angle of eg2
68 
69  real*8 g, gc, bc, sints, sint2
70 !
71  real*8 u, egs, x, x1, x2, a, aq, c2, a22
72  real*8 geqv1/1.00000001d0/
73  integer count
74  save geqv1
75 
76  count=0
77  g=ein/masele
78  if(g .le. geqv1) then
79  x = 0.5d0
80  else
81  a = g + 1.0
82  c2 = a + 2.7182*g/a
83  x1 =1./(a + sqrt(g**2 -1.))
84  x2 = 0.5d0
85  a22 = a**2-2.
86  aq = a22 + 2*a
87  do while(.true.)
88  call rndc(u)
89  x = x1 * exp(log( (1.0d0-x1)/x1 )*u)
90  call rndc(u)
91  count = count +1
92  if( count .gt. 100 ) then
93  write(0,*) '****** loop in canihiea'
94  write(0,*) '****** ein=',ein
95  write(0,*) ' ein=Me forced '
96  x=0.5
97  ein = masele
98  g = 1.
99  goto 100
100  endif
101  if(u .le. (aq -a**2*x -1./x)/a22) goto 100
102  enddo
103  100 continue
104  endif
105  eg2 = x * ( ein + masele )
106  eg1 = ein - eg2 + masele
107 !
108  eg1 = max(eg1, eg2)
109  eg2 = ein - eg1 + masele
110  gc=sqrt( (g+1.)/2 )
111  bc=sqrt((g-1.)/(g+1.))
112  egs=masele*gc
113  if(g .gt. geqv1) then
114 ! cms cos of gammma 1
115  u =max(min( (eg1/gc/egs -1.0)/bc, 1.0d0), 0.d0)
116  else
117  call rndc(u)
118  endif
119 ! cms sin^2
120  sints=1.d0-u**2
121 ! lab sin^2 of gamma1
122  sint2= (egs/eg1)**2 *sints
123  if(sint2 .gt. 1.d0) then
124  cos1 = 0.
125  else
126  cos1 = sqrt(1.d0 - sint2)
127  endif
128 ! lab sin^2 of gamma2
129  sint2= (egs/eg2)**2 * sints
130  if( sint2 .gt. 1.d0) then
131  cos2 = 0.
132  else
133  cos2=sqrt(1.d0 - sint2)
134  endif
135 !
136 ! pcos = gcE*(bc + cos*)
137 ! cos*= -u so cos< 0 if bc+cos* < 0
138 !
139  if(bc-u .lt. 0.) then
140  cos2=-cos2
141  endif
142  end
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
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 rndc(u)
Definition: rnd.f:91
const double masele
Definition: Zmass.h:2
subroutine canihiea(ein, eg1, eg2, cos1, cos2)
Definition: canihiPath.f:60
subroutine canihipath(ein, prob, path)
Definition: canihiPath.f:14