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

Go to the source code of this file.

Functions/Subroutines

subroutine csampprimary (p, fin)
 
subroutine cupdtprimc
 
subroutine csampprm0 (prm)
 
subroutine csampprm1 (each, p_or_e)
 
subroutine cconv_prim_e (comp, e_or_p, aPtcl)
 
subroutine cconv_prim_e2 (comp, E, e_or_p)
 
subroutine cqprime (p_or_e)
 
subroutine cqprime0 (prm, p_or_e)
 
subroutine cqprimlabel (label)
 
subroutine cqnoofprim (no)
 
subroutine cqprimlabel0 (prm, label)
 
subroutine cqprimary (prm)
 

Function/Subroutine Documentation

◆ cconv_prim_e()

subroutine cconv_prim_e ( type(component comp,
real*8  e_or_p,
type(ptcl aPtcl 
)

Definition at line 128 of file csampPrimary.f.

References cghvm(), cmkptc(), csetmuonpol(), d0, e, kalfa, kgnuc, khvymax, klight, and kmuon.

Referenced by cprimacceptance(), csampprimary(), funcazim(), and primdn().

128  implicit none
129 ! given energy or momentum as given in primary
130 ! specification is converted to total enregy.
131 
132 #include "Zptcl.h"
133 #include "Zcode.h"
134 #include "Zprimary.h"
135  type(component):: comp ! input. primary component
136  real*8 e_or_p ! input. energy or momentum as
137  ! specified in primary data file
138  type(ptcl)::aptcl ! output. 'partcle' of the primary
139  integer code, massn
140 !
141  real*8 ingev ! p_or_e in Gev
142  real(8),parameter::hbarc=197.0e6*1e-15/1.e-9 ! hbarc in eV nm
143  real(8),parameter::hc=hbarc*2*3.14159 ! hc/wl = eV
144 !
145  ingev= e_or_p * comp%togev
146  call cmkptc(comp%code,
147  * comp%subcode,
148  * comp%charge,
149  * aptcl)
150 
151  if(comp%code .eq. kmuon) then
152 ! give polarization for muon primary
153  call csetmuonpol(0.d0)
154  endif
155 
156  if(comp%etype .eq. 'e/p' .or.
157  * comp%etype .eq. 'e') then
158  aptcl%fm%p(4) = ingev
159  *
160  elseif(comp%etype .eq.'p/p' .or.
161  * comp%etype .eq. 'p')then
162  aptcl%fm%p(4) = sqrt(aptcl%mass**2 +
163  * ingev**2)
164  elseif(comp%etype .eq. 'ke/p' .or.
165  * comp%etype .eq. 'ke') then
166  aptcl%fm%p(4) = ingev + aptcl%mass
167  elseif(comp%etype .eq. 'e/n') then
168  code = comp%code
169  if(code .eq. kgnuc) then
170  aptcl%fm%p(4) = aptcl%subcode * ingev
171  elseif(code .ge. kalfa .and.
172  * code .le. khvymax) then
173  call cghvm(code, massn)
174  aptcl%fm%p(4) = massn * ingev
175  else
176  aptcl%fm%p(4) = ingev
177  endif
178  elseif(comp%etype .eq. 'ke/n') then
179  code = comp%code
180  if(code .eq. kgnuc) then
181  aptcl%fm%p(4) = aptcl%subcode * ingev +
182  * aptcl%mass
183  elseif(code .ge. kalfa .and.
184  * code .le. khvymax) then
185  call cghvm(code, massn)
186  aptcl%fm%p(4) = massn * ingev +
187  * aptcl%mass
188  else
189  aptcl%fm%p(4) = ingev +
190  * aptcl%mass
191  endif
192  elseif(comp%etype .eq. 'p/n') then
193  code = comp%code
194  if(code .eq. kgnuc) then
195  aptcl%fm%p(4) =
196  * sqrt( (aptcl%subcode * ingev) **2 +
197  * aptcl%mass **2)
198  elseif(code .ge. kalfa .and.
199  * code .le. khvymax) then
200  call cghvm(code, massn)
201  aptcl%fm%p(4) =
202  * sqrt( (massn * ingev) **2 +
203  * aptcl%mass **2)
204  else
205  aptcl%fm%p(4) = sqrt(ingev**2 +
206  * aptcl%mass**2)
207  endif
208  elseif(comp%etype .eq. 'rig') then
209  aptcl%fm%p(4) =sqrt(
210  * ( ingev*aptcl%charge)**2 + aptcl%mass**2 )
211  elseif(comp%etype == 'nm' ) then
212  if(comp%code /= klight ) then
213  write(0,*) ' nm unit can be used only for light'
214  stop
215  endif
216  aptcl%fm%p(4) = hc/e_or_p ! hc/wl --> eV
217  else
218  write(*, *) ' energy type=', comp%etype,
219  * ' invalid. label=', comp%label, ' symb =',
220  * comp%symb
221  stop 9999
222  endif
223  if(comp%code == klight .and. comp%etype /= 'nm' ) then
224  ! energy should be in eV so GeV to eV conversion
225  aptcl%fm%p(4) = aptcl%fm%p(4)*1.d9
226  endif
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
subroutine csetmuonpol(val)
Definition: cinteNuc.f:224
max ptcl codes in the kgnuc
Definition: Zcode.h:2
! common for std atmosphere real *AlmostVacH ! almost vacuum height real *AlmostVacT ! thickness there hc
Definition: Zstdatmos.h:7
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kalfa
Definition: cblkHeavy.h:7
*Zfirst p fm *Zfirst p Zfirst p code
Definition: ZavoidUnionMap.h:1
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
max ptcl codes in the klight
Definition: Zcode.h:2
subroutine cmkptc(code, subcode, charge, p)
Definition: cmkptc.f:15
max ptcl codes in the khvymax
Definition: Zcode.h:2
Definition: Zptcl.h:75
max ptcl codes in the kmuon
Definition: Zcode.h:2
subroutine cghvm(code, massn)
Definition: cmkptc.f:332
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cconv_prim_e2()

subroutine cconv_prim_e2 ( type(component comp,
real*8  E,
real*8  e_or_p 
)

Definition at line 230 of file csampPrimary.f.

References cghvm(), cmkptc(), kalfa, kgnuc, and khvymax.

Referenced by inteflux().

230  implicit none
231 ! inverse of cconv_prim_e
232 
233 #include "Zptcl.h"
234 #include "Zcode.h"
235 #include "Zprimary.h"
236  type(component):: comp ! input. primary component
237  real*8 e ! input. total energy of a particle
238  ! of 'comp' primary
239  real*8 e_or_p ! output. e or p (/n, etc) as given
240  ! in primary paticle file.
241  integer code, massn
242 !
243  real*8 ex ! e_or_p in GeV
244 
245  type(ptcl)::aptcl
246 
247  call cmkptc(comp%code,
248  * comp%subcode,
249  * comp%charge,
250  * aptcl)
251 
252 
253  if(comp%etype .eq. 'e/p' .or.
254  * comp%etype .eq. 'e') then
255  ex = e
256  elseif(comp%etype .eq.'p/p' .or.
257  * comp%etype .eq. 'p')then
258  ex = sqrt(e**2 - aptcl%mass**2)
259 
260  elseif(comp%etype .eq. 'ke/p' .or.
261  * comp%etype .eq. 'ke') then
262  ex = e - aptcl%mass
263 
264  elseif(comp%etype .eq. 'e/n') then
265  code = comp%code
266  if(code .eq. kgnuc) then
267  ex = e/aptcl%subcode
268  elseif(code .ge. kalfa .and.
269  * code .le. khvymax) then
270  call cghvm(code, massn)
271  ex = e/massn
272  else
273  ex = e
274  endif
275  elseif(comp%etype .eq. 'ke/n') then
276  code = comp%code
277  if( code .eq. kgnuc ) then
278  ex =( e - aptcl%mass)/aptcl%subcode
279  elseif(code .ge. kalfa .and.
280  * code .le. khvymax) then
281  call cghvm(code, massn)
282  ex =( e - aptcl%mass)/massn
283  else
284  ex = e - aptcl%mass
285  endif
286  elseif(comp%etype .eq. 'p/n') then
287  code = comp%code
288  if( code .eq. kgnuc) then
289  ex =sqrt( e**2 - aptcl%mass **2)/aptcl%subcode
290  elseif(code .ge. kalfa .and.
291  * code .le. khvymax) then
292  call cghvm(code, massn)
293  ex =sqrt( e**2 - aptcl%mass **2)/massn
294  else
295  ex = sqrt(e**2 - aptcl%mass**2)
296  endif
297  elseif(comp%etype .eq. 'rig') then
298  ex = sqrt( e**2 - aptcl%mass**2) /aptcl%charge
299  else
300  write(*, *) ' energy type=', comp%etype,
301  * ' invalid. label=', comp%label, ' symb =',
302  * comp%symb
303  stop 9999
304  endif
305  e_or_p = ex/ comp%togev
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
max ptcl codes in the kgnuc
Definition: Zcode.h:2
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kalfa
Definition: cblkHeavy.h:7
*Zfirst p fm *Zfirst p Zfirst p code
Definition: ZavoidUnionMap.h:1
subroutine cmkptc(code, subcode, charge, p)
Definition: cmkptc.f:15
max ptcl codes in the khvymax
Definition: Zcode.h:2
Definition: Zptcl.h:75
subroutine cghvm(code, massn)
Definition: cmkptc.f:332
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cqnoofprim()

subroutine cqnoofprim ( integer  no)

Definition at line 356 of file csampPrimary.f.

Referenced by chookbgevent().

356 ! ************************
357  implicit none
358 #include "Zmanagerp.h"
359  integer no ! output. no. of sampled primaries so far.
360  no = eventno
Here is the caller graph for this function:

◆ cqprimary()

subroutine cqprimary ( type(primaries prm)

Definition at line 378 of file csampPrimary.f.

378 ! prm /primaires/ output.
379 !
380  implicit none
381 #include "Zptcl.h"
382 #include "Zprimary.h"
383 #include "Zprimaryv.h"
384 
385  type(primaries):: prm
386  prm = prim

◆ cqprime()

subroutine cqprime ( real*8  p_or_e)

Definition at line 313 of file csampPrimary.f.

References cqprime0().

Referenced by __testsampprim.f__(), and chookbgevent().

313 !
314  implicit none
315 
316 #include "Zptcl.h"
317 #include "Zprimary.h"
318 #include "Zprimaryv.h"
319  real*8 p_or_e
320  call cqprime0(prim, p_or_e)
subroutine cqprime0(prm, p_or_e)
Definition: csampPrimary.f:328
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cqprime0()

subroutine cqprime0 ( type(primaries prm,
real*8  p_or_e 
)

Definition at line 328 of file csampPrimary.f.

Referenced by cqprime().

328 !
329  implicit none
330 
331 #include "Zptcl.h"
332 #include "Zprimary.h"
333  real*8 p_or_e
334  type(primaries):: prm
335 !
336  p_or_e = prm%sampled_e
337 !
Here is the caller graph for this function:

◆ cqprimlabel()

subroutine cqprimlabel ( integer  label)

Definition at line 345 of file csampPrimary.f.

References cqprimlabel0().

Referenced by __testsampprim.f__().

345 !
346  implicit none
347 
348 #include "Zptcl.h"
349 #include "Zprimary.h"
350 #include "Zprimaryv.h"
351  integer label
352  call cqprimlabel0(prim, label)
subroutine cqprimlabel0(prm, label)
Definition: csampPrimary.f:366
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cqprimlabel0()

subroutine cqprimlabel0 ( type(primaries prm,
integer  label 
)

Definition at line 366 of file csampPrimary.f.

Referenced by cqprimlabel().

366 !
367  implicit none
368 #include "Zptcl.h"
369 #include "Zprimary.h"
370  integer label
371  type(primaries):: prm
372 
373  label = prm%label
Here is the caller graph for this function:

◆ csampprimary()

subroutine csampprimary ( type(ptcl p,
integer  fin 
)

Definition at line 13 of file csampPrimary.f.

References cconv_prim_e(), and csampprm0().

Referenced by __testsampprim.f__(), and cmkincident().

13 ! p: /ptcl/ output. energy, particle code, subcode,
14 ! charge, mass are set.
15 !
16 
17  implicit none
18 #include "Zmanagerp.h"
19 #include "Zptcl.h"
20 #include "Zprimary.h"
21 #include "Zprimaryv.h"
22 
23  type(ptcl):: p
24  integer fin ! output. if no more sim. -->1 else 0
25 
26 
27  fin = 0
28  if( desteventno(2) .lt. 0) then
29  if(abs(desteventno(2)) .le. prim%NoOfSamplings) then
30  fin = 1
31  endif
32  endif
33  if(fin .eq. 0) then
34  call csampprm0(prim)
35 
36 
37 ! call cconv_prim_e(Prim) ! to total energy
38  call cconv_prim_e(prim%each(prim%label), prim%sampled_e,
39  * prim%particle)
40  p = prim%particle
41  prim%NoOfSamplings = prim%NoOfSamplings + 1 ! update counter.
42  prim%NoOfSampComp(prim%label, 1) =
43  * prim%NoOfSampComp(prim%label, 1) +1
44  endif
subroutine cconv_prim_e(comp, e_or_p, aPtcl)
Definition: csampPrimary.f:128
subroutine csampprm0(prm)
Definition: csampPrimary.f:59
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
Definition: Zptcl.h:75
Here is the call graph for this function:
Here is the caller graph for this function:

◆ csampprm0()

subroutine csampprm0 ( type(primaries prm)

Definition at line 59 of file csampPrimary.f.

References csampprm1(), and rndc().

Referenced by csampprimary().

59  implicit none
60 
61 #include "Zptcl.h"
62 #include "Zprimary.h"
63  type(primaries):: prm
64 
65  real*8 p_or_e
66 !
67  integer i
68  real*8 u
69 !
70 ! select one component
71  call rndc(u)
72 
73  i = 1
74  do while (u .gt. prm%cummInteFlux(i) )
75  i = i + 1
76  enddo
77  prm%label = prm%each(i)%label
78 !
79  call csampprm1(prm%each(prm%label), p_or_e)
80 
81 
82  prm%sampled_e = p_or_e
subroutine csampprm1(each, p_or_e)
Definition: csampPrimary.f:85
nodes i
subroutine rndc(u)
Definition: rnd.f:91
Here is the call graph for this function:
Here is the caller graph for this function:

◆ csampprm1()

subroutine csampprm1 ( type(component each,
real*8  p_or_e 
)

Definition at line 85 of file csampPrimary.f.

References d, d0, and rndc().

Referenced by csampprm0().

85  implicit none
86 
87 #include "Zptcl.h"
88 #include "Zprimary.h"
89  type(component):: each
90  real*8 p_or_e
91 !
92  real*8 e1temp, ombeta, u
93  integer i
94 !
95  if( each%no_of_seg .eq. 0) then
96  p_or_e = each%emin ! = emax
97  else
98  call rndc(u)
99  i = each%no_of_seg
100  do while (u .gt. each%norm_inte(i))
101  i = i - 1
102  enddo
103 ! use i-th segment
104  if(each%diff_or_inte .eq. 'd') then
105  ombeta = (1.d0 - each%beta(i))
106  call rndc(u)
107  if(abs(ombeta) .gt. 1.d-6) then
108  e1temp = each%energy(i)**ombeta
109  p_or_e =( u* (each%energy(i+1)**ombeta - e1temp) +
110  * e1temp )** (1.d0/ombeta)
111  else
112  p_or_e =( each%energy(i)/each%energy(i+1) )**u
113  * * each%energy(i+1)
114  endif
115  elseif(each%diff_or_inte .eq. 'i') then
116  call rndc(u)
117  p_or_e = each%energy(i)* (1.d0 -
118  * u*(1.d0 - each%norm_inte(i+1)/each%norm_inte(i)))
119  * **(-1.d0/each%beta(i))
120  else
121  write(*, *) ' invlid diff_or_inte=',each%diff_or_inte,
122  * ' for primary=',each%symb
123  stop 9999
124  endif
125  endif
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
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cupdtprimc()

subroutine cupdtprimc ( )

Definition at line 48 of file csampPrimary.f.

Referenced by cmkincident().

48  implicit none
49 #include "Zptcl.h"
50 #include "Zprimary.h"
51 #include "Zprimaryv.h"
52 
53  prim%NoOfSampComp(prim%label, 2) =
54  * prim%NoOfSampComp(prim%label, 2) +1
Here is the caller graph for this function: