COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cKnock.f
Go to the documentation of this file.
1  subroutine cknockp(aPtcl, prob, path)
2  implicit none
3 #include "Zptcl.h"
4 #include "Zmass.h"
5 #include "ZdedxAir.h"
6 
7 
8  real*8 cnstm
9  parameter( cnstm = 2.74296d0 * 2.d0)
10 
11 ! compute prob/r.l for knock-on process of charged particles
12 ! other than e+/e-
13 !
14  type(ptcl)::aPtcl ! input. energy, charge and mass are used.
15  real*8 prob ! output prob. of knock-on per r%l
16  real*8 path ! output sampled path.
17 
18  real*8 g, temp, erg, mass, u
19 
20  if(jdef .eq. 0) then
21  call cerrormsg('cdedxEleci must be called beforehand',0)
22  endif
23 !
24  mass = aptcl%mass
25  erg = aptcl%fm%p(4)
26 
27 ! tcut = w0
28  g = erg/mass
29  betasq = 1.0d0 - 1.d0/g**2
30  tmax = 2*masele*(g**2-1.)/
31  * (1.0 + 2*g* (masele/mass)
32  * + (masele/mass)**2)
33 
34  if(w0 .ge. tmax) then
35  prob = 0.d0
36  path = 1.d50
37  else
38  norm = (1.0d0/w0 - 1.0d0/tmax)
39  temp = norm -
40  * betasq * log(tmax/w0)/tmax
41 ! assume spin 0 particle is only pi, K
42  if(mass .lt. 0.11d0 .or. mass .gt. 0.9d0) then
43 ! mu, p, etc. spin = 1/2
44  temp = temp + (tmax - w0)/erg/erg/2.d0
45  endif
46 ! constm = basearea*2
47  prob =
48  * temp * masele * cnstm *aptcl%charge**2 / betasq
49  call rndc(u)
50  path = -log(u)/prob
51  endif
52  end
53 ! ***********
54  subroutine cknockea(aPtcl, erg2, erge, cos1, cosr)
55 ! **************
56  implicit none
57 #include "Zptcl.h"
58 #include "Zmass.h"
59 #include "ZdedxAir.h"
60 !
61  type(ptcl)::aPtcl ! input
62 
63  real*8 erg2 ! output scattered total energy of the particle in GeV.
64  real*8 erge ! output recoiled total electron energy in GeV
65 !
66  real*8 cos1 ! output. cos angle of the scattered particle
67  real*8 cosr ! output. cos angle of the recoiled electron
68 
69 
70 
71 ! samples delta ray electron energy erge
72 ! and survival partcle energy and their angles
73 !
74 ! this erg is lower than ergsave due to
75 ! energy loss in the path
76 
77  real*8 mass, erg, u, temp, t
78  logical accept
79  real*8 p02, p12, pe2
80 
81  mass = aptcl%mass
82  erg = aptcl%fm%p(4)
83 
84  accept = .false.
85  do while(.not. accept)
86  call rndc(u)
87  t = 1.0d0/(1.0d0/w0 - norm*u)
88  call rndc(u)
89  temp =1.d0 - betasq*t/tmax
90  if(mass .lt. 0.11d0 .or. mass .gt. 0.9d0) then
91  temp = temp + t*t/erg**2/2.d0
92  endif
93  if(temp .gt. u) then
94  accept = .true.
95  endif
96  enddo
97  erge = t + masele
98 
99 ! erg2 = olderg - erge + masele
100 ! above will give larger energy than
101 ! current erg and energy eventually increase.
102 ! avoid it by using current erg
103 !
104  erg2 = max( erg - erge + masele, mass)
105 
106 !
107 ! from
108 ! p1cos1 + p2cos2 = p0
109 ! p1sin1 = p2sin2
110 ! E0+m = E1 + E2
111 ! we obtain
112 ! cos1 = (p0^2 + p1^2 - p2^2)/(2p0p1)
113 ! cos2 = (p0^2 + p2^2 - p1^2)/(2p0p2)
114 ! (p0^2 + p1^2 - p2^2)/2 = E0E1 -M^2 - m(E2-m)
115 ! (p0^2 + p2^2 - p1^2)/2 = E0E2 - mE1
116 !
117 ! p02 =abs(
118  p02 = erg**2 - mass**2
119  p12 = erg2**2 -mass**2
120  pe2 = erge**2 - masele**2
121  if(p12 .le. 0.d0 ) then
122  cos1 = -1.d0
123  cosr = 1.d0
124  else
125  cos1 = (erg*erg2 - mass**2 -masele*t)/
126  * sqrt(p02*p12)
127  if(cos1 .gt. 1.d0) then
128  cos1 = 1.d0
129  elseif(cos1 .lt. -1.d0) then
130  cos1 = -1.d0
131  endif
132  cosr = (erg*(t+masele) - masele*erg2)/
133  * sqrt(p02*pe2)
134  if(cosr .gt. 1.d0) then
135  cosr = 1.d0
136  elseif(cosr .lt. -1.d0) then
137  cosr = -1.d0
138  endif
139  endif
140  end
141 
142 
143 
144 
145 
146 
147 
148 
149 
150 
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
common ZdedxAir norm
Definition: ZdedxAir.h:2
common ZdedxAir tmax
Definition: ZdedxAir.h:2
common ZdedxAir w0
Definition: ZdedxAir.h:2
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
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
subroutine cknockea(aPtcl, erg2, erge, cos1, cosr)
Definition: cKnock.f:55
common ZdedxAir betasq
Definition: ZdedxAir.h:2
const double masele
Definition: Zmass.h:2
subroutine cknockp(aPtcl, prob, path)
Definition: cKnock.f:2
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 ! knockon is considered Obsolete *PhotoProd false
Definition: cblkElemag.h:7
Definition: Zptcl.h:75