COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cgrap.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine cgrap (w, ptav, ntp, a, icon)
 
subroutine cctrap (g, n, y, z)
 
subroutine cccrap (g, n, sume, sump)
 
subroutine cnprap (g, n, maxi, mini)
 
subroutine ccmrap (w, g, n, maxi, mini, y, z, icon)
 
subroutine cprap (ptav, pc, n)
 
subroutine cprap0 (a, y)
 

Function/Subroutine Documentation

◆ cccrap()

subroutine cccrap ( type(ptcl), dimension(n g,
integer  n,
real*8  sume,
real*8  sump 
)

Definition at line 58 of file cgrap.f.

References d0.

58 ! check conservation
59 ! *******************************************************
60  implicit none
61 !---- include '../../Zptcl.h'
62 #include "Zptcl.h"
63  integer n
64  type(ptcl):: g(n)
65  real*8 sume, sump
66 !
67  integer i
68  real*8 yr
69 !
70  sume=0.d0
71  sump=0.d0
72  do i=1, n
73 ! yr=g(i).fm.rap
74  yr=g(i)%fm%p(4)
75 ! sume=sume+ cosh(yr)*g(i).fm.tm
76 ! sump=sump+ sinh(yr)*g(i).fm.tm
77  sume=sume+ cosh(yr)*g(i)%fm%p(3)
78  sump=sump+ sinh(yr)*g(i)%fm%p(3)
79  enddo
nodes i
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
real * sume
Definition: Zprivate.h:1
dE dx *! Nuc Int sampling table g
Definition: cblkMuInt.h:130
Definition: Zptcl.h:75
integer n
Definition: Zcinippxc.h:1

◆ ccmrap()

subroutine ccmrap ( real*8  w,
type(ptcl), dimension(n g,
integer  n,
integer  maxi,
integer  mini,
real*8  y,
real*8  z,
integer  icon 
)

Definition at line 118 of file cgrap.f.

References true.

Referenced by cgrap().

118 ! get coefficients y and z to modify rapidities so that
119 ! the total energy and pz should be conserved.
120 !
121 !
122 ! w: real*8. input. available energy
123 ! g(n): /ptcl/ input. g(i).fm.tm and g(i).fm.rap are used.
124 ! n: integer. input. number of particles
125 ! maxi: integer. input. g(maxi).fm.rap is the max y
126 ! mini: integer. input. g(mini).fm.rap is the min y
127 ! y: real*8 output. coefficient in rap <- z + y* rap'
128 ! where rap is the true rapidity which
129 ! satisfy the energy-momentum conservation.
130 ! z: real*8 output. coefficient in rap <- z + y* rap'
131 ! icon: integer output. 0--> o.k
132 ! 1--> n.g. retry
133 ! see. cpc. vol9. (1975). 297 by Jadach.
134 !
135 ! function to be solved for y is symmetric around y=0
136 ! and has a form like f(y)= c - y**2 ( c> 0)
137 ! (y > 0 is obtained as a solution)
138 ! in some stragne input, c becomes <0 with no solution
139  implicit none
140 !---- include '../../Zptcl.h'
141 #include "Zptcl.h"
142  integer n, icon
143  type(ptcl):: g(n)
144 !
145  real*8 w, y, z
146  integer maxi, mini
147 !
148  real*8 eps1/0.0010d0/, w2, alw2, y1, epsx
149  real*8 sump, summ, sumgp, sumgm, tmp
150  real*8 expgyp, expgym, fy1, fy1p, dy, eps
151  integer lp, i
152 !
153  w2=w*w
154  alw2=log(w2)
155 ! y1=log(w2/g(maxi).fm.tm/g(mini).fm.tm)
156  y1=log(w2/g(maxi)%fm%p(3)/g(mini)%fm%p(3))
157  epsx=eps1/sqrt(dble(n))
158 !
159  lp=0
160 ! *** until loop***
161  do while (.true.)
162  lp=lp+1
163  y = y1
164  sump=0.
165  summ=0.
166  sumgp=0.
167  sumgm=0.
168  do i=1, n
169 ! tmp=g(i).fm.rap*y
170  tmp=g(i)%fm%p(4)*y
171  if(tmp .gt. 100.d0 .or.
172  * tmp .lt. -100.d0) then
173 ! no solution case: c < 0
174  lp=100
175  goto 100
176  else
177 
178  expgyp=exp(tmp)
179  expgym=1.d0/expgyp
180 ! sump = sump+ g(i).fm.tm*expgyp
181 ! summ = summ+ g(i).fm.tm*expgym
182  sump = sump+ g(i)%fm%p(3)*expgyp
183  summ = summ+ g(i)%fm%p(3)*expgym
184  sumgp = sumgp +
185 ! * g(i).fm.tm*g(i).fm.rap*expgyp
186  * g(i)%fm%p(3)*g(i)%fm%p(4)*expgyp
187  sumgm=sumgm +
188 ! * g(i).fm.tm*g(i).fm.rap*expgym
189  * g(i)%fm%p(3)*g(i)%fm%p(4)*expgym
190  endif
191  enddo
192 
193  fy1=alw2 -log(sump*summ)
194  fy1p= - sumgp/sump + sumgm/summ
195  dy =fy1/fy1p
196  y1=y- dy
197  eps=dy/y1
198  if(abs(eps) .lt. epsx .or. lp .gt. 10) goto 100
199  enddo
200  100 continue
201  if(lp .gt. 10) then
202  icon=1
203  else
204  icon=0
205  y=y1
206  z=log(w/sump)
207  endif
nodes z
nodes i
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
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
dE dx *! Nuc Int sampling table g
Definition: cblkMuInt.h:130
Definition: Zptcl.h:75
integer n
Definition: Zcinippxc.h:1
Here is the caller graph for this function:

◆ cctrap()

subroutine cctrap ( type(ptcl), dimension(n g,
integer  n,
real*8  y,
real*8  z 
)

Definition at line 39 of file cgrap.f.

Referenced by cgrap().

39 ! convert rapidity into true rapidity satisfing e-p
40 ! conservation.
41 ! *******************************************************
42  implicit none
43 !---- include '../../Zptcl.h'
44 #include "Zptcl.h"
45  integer n
46  type(ptcl):: g(n)
47  real*8 y, z
48 !
49  integer i
50 !
51  do i=1, n
52 ! g(i).fm.rap = g(i).fm.rap*y + z
53  g(i)%fm%p(4) = g(i)%fm%p(4)*y + z
54  enddo
nodes z
nodes i
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
dE dx *! Nuc Int sampling table g
Definition: cblkMuInt.h:130
Definition: Zptcl.h:75
integer n
Definition: Zcinippxc.h:1
Here is the caller graph for this function:

◆ cgrap()

subroutine cgrap ( real*8  w,
real*8  ptav,
integer  ntp,
type(ptcl), dimension(ntp)  a,
integer  icon 
)

Definition at line 3 of file cgrap.f.

References ccmrap(), cctrap(), cnprap(), and cprap().

Referenced by ccylps().

3 ! generation of rapidity for mass missing. mass
4 ! ******************************************************
5  implicit none
6 !---- include '../../Zptcl.h'
7 #include "Zptcl.h"
8  integer ntp, icon
9  type(ptcl):: a(ntp)
10  real*8 ptav, w ! w is missing mass
11 !
12  integer i, maxi, mini
13  real*8 y, z
14 ! sample proto-rapidity
15  call cprap(ptav, a, ntp)
16 ! normalize proto-rapidity to 0 to 1.
17  call cnprap(a, ntp, maxi, mini)
18 ! compute transverse mass.(note; save in pt pos.)
19  do i=1, ntp
20 ! a(i).fm.tm= sqrt(a(i).mass**2 + a(i).fm.p(3)**2)
21  a(i)%fm%p(3)= sqrt(a(i)%mass**2 + a(i)%fm%p(3)**2)
22  enddo
23 ! get coef. for y and z to modify rapidity
24 ! to conserve 4 momenta.
25  call ccmrap(w, a, ntp, maxi, mini, y, z, icon)
26  if(icon .eq. 0) then
27 ! convert to true rapidity satisfing 4 mom.
28 ! conservation.
29  call cctrap(a, ntp, y, z)
30 ! ____________________________________________________
31 ! check conservation
32 ! call cccrap(a, ntp, sume, sump)
33 ! write(*,*) ' sume=',sume,' m =',pj.mass, ' sump=',sump
34 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35  endif
subroutine ccmrap(w, g, n, maxi, mini, y, z, icon)
Definition: cgrap.f:118
nodes z
nodes i
subroutine cnprap(g, n, maxi, mini)
Definition: cgrap.f:83
subroutine cctrap(g, n, y, z)
Definition: cgrap.f:39
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
subroutine cprap(ptav, pc, n)
Definition: cgrap.f:211
real(4), save a
Definition: cNRLAtmos.f:20
Definition: Zptcl.h:75
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cnprap()

subroutine cnprap ( type(ptcl), dimension(n g,
integer  n,
integer  maxi,
integer  mini 
)

Definition at line 83 of file cgrap.f.

Referenced by cgrap().

83 ! normalize proto-rapidity in 0 to 1
84 ! *********************************************
85 ! g(n): /ptcl/ Input. g(i).fm.rap has y and
86 ! is normalized to have values in (0, 1.0).
87 ! the max value becomes 1.0 and the minimum one 0.0
88 ! n : integer Input. # of ptcls in g
89 ! maxi: integer. Output. g(maxi).fm.rap has max y(=1)
90 ! mini: integer. Output. g(mini).fm.rap has min y(=0)
91 !
92  implicit none
93 !---- include '../../Zptcl.h'
94 #include "Zptcl.h"
95  integer n, maxi, mini
96  type(ptcl):: g(n)
97 !
98  integer i
99  real*8 gmx, gmn
100  maxi=1
101  mini=1
102  do i=1, n
103 ! if(g(i).fm.rap .gt. g(maxi).fm.rap ) maxi=i
104  if(g(i)%fm%p(4) .gt. g(maxi)%fm%p(4) ) maxi=i
105 ! if(g(i).fm.rap .lt. g(mini).fm.rap ) mini=i
106  if(g(i)%fm%p(4) .lt. g(mini)%fm%p(4) ) mini=i
107  enddo
108 ! gmx=g(maxi).fm.rap
109 ! gmn=g(mini).fm.rap
110  gmx=g(maxi)%fm%p(4)
111  gmn=g(mini)%fm%p(4)
112  do i=1, n
113 ! g(i).fm.rap = (g(i).fm.rap - gmn )/(gmx-gmn)
114  g(i)%fm%p(4) = (g(i)%fm%p(4) - gmn )/(gmx-gmn)
115  enddo
nodes i
dE dx *! Nuc Int sampling table g
Definition: cblkMuInt.h:130
Definition: Zptcl.h:75
integer n
Definition: Zcinippxc.h:1
Here is the caller graph for this function:

◆ cprap()

subroutine cprap ( real*8  ptav,
type(ptcl), dimension(n pc,
integer  n 
)

Definition at line 211 of file cgrap.f.

References d0, and rndc().

Referenced by cgrap().

211 ! *************************************
212 ! generate n proto-rapidities
213 ! ptav: real*8. input. avarage pt of this event
214 ! pc(n): /ptcl/ input/output. pc(i).fm.rap is created.
215 ! n: input. # of particles
216 !
217 !
218 !
219  implicit none
220 !---- include '../../Zptcl.h'
221 #include "Zptcl.h"
222  integer n
223  type(ptcl):: pc(n)
224  real*8 ptav
225 !
226  integer i
227  real*8 y, b, u
228 !
229  do i=1, n
230 ! b=(pc(i).fm.p(3)/ptav)**(-0.1) * 1.5 ! goot at 900 GeV
231 
232 ! b=(pc(i).fm.p(3)/ptav)**(-0.2) * 1.5 ! goot at 900 GeV
233 ! b=(pc(i).fm.p(3)/0.3)**(-0.2) * 0.5 ! good at 200 GeV !
234 ! this simple one is best.!!!
235 ! b= 1. ! good at almost every where
236  b = 1.0
237 
238 ! call cprap0(b, y)
239 
240  call rndc(u)
241  y =min(u*(ptav/pc(i)%fm%p(3))**0.40d0, 2.5d0)
242  call rndc(u)
243  if(u .lt. 0.5) then
244  y = -y
245  endif
246 
247 ! pc(i).fm.rap = y
248  pc(i)%fm%p(4) = y
249  enddo
nodes i
subroutine rndc(u)
Definition: rnd.f:91
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
real(4), save b
Definition: cNRLAtmos.f:21
Definition: Zptcl.h:75
integer n
Definition: Zcinippxc.h:1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cprap0()

subroutine cprap0 ( real*8  a,
real*8  y 
)

Definition at line 253 of file cgrap.f.

References d0, and rndc().

253 ! proto rapidity sampling
254 ! ***************************
255  implicit none
256  real*8 a, y
257 !
258 ! !
259 ! 1 !*********!
260 ! ! ! *
261 ! ! ! *
262 ! ! ! *
263 ! ! ! *
264 ! ! ! *
265 ! 0~~~~~~~~~1~~~~~~~~~~a+1
266 !
267  real*8 s, u
268  s=1.+a/2
269  call rndc(u)
270  if(u .lt. 1.d0/s) then
271  call rndc(u)
272  y=2*u-1.d0
273  else
274  call rndc(u)
275  y=a*(1.d0 -sqrt(u)) + 1.d0
276  call rndc(u)
277  if(u .lt. 0.5d0) then
278  y=-y
279  endif
280  endif
subroutine rndc(u)
Definition: rnd.f:91
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
latitude latitude this system is used *****************************************************************! type coord sequence union map real y
Definition: Zcoord.h:25
real(4), save a
Definition: cNRLAtmos.f:20
Here is the call graph for this function: