COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cmkptc.f
Go to the documentation of this file.
1 !----------------------------------------------------
2 ! cmkptc: make a particle
3 !
4 ! implicit none
5 ! include '../Zptcl.h'
6 ! include '../Zcode.h'
7 ! type(ptcl):: p
8 ! integer i
9 ! do i=1, klast
10 ! call cmkptc(i, 0, 0, p)
11 ! write(*, *) p.mass, p.charge
12 ! enddo
13 ! end
14  subroutine cmkptc(code, subcode, charge, p)
15 ! make a particle.
16 ! code: integer. Input. Particle code defined by the Cosmos convention.
17 ! subcode: integer. Input. Particle subcode defined //
18 ! It has meaning for k0. neutron, gamma.
19 ! charge: integer. Input. Charge of the particle.
20 ! In case of heavy (alpha, etd) this should be
21 ! 1 or -1, indepndently of the real charge.
22 ! -1 for anti-neucleus.
23 ! p: type ptcl. Output.
24 ! Template particle is set.
25 ! The attributes set are:
26 ! px=undef unchaged
27 ! py= //
28 ! pz= //
29 ! e= //
30 ! mass=ptcl mass
31 ! code=ptcl code (same as input)
32 ! subcode = ptcl sub code
33 ! This code is mainly used to identify
34 ! particle/antiparticle. If it is not
35 ! important, or it is to be determined
36 ! later, the user may give 0.
37 !
38 ! This has meaning for the following
39 ! particles. For other particles,
40 ! giving 0 is ok. It can be composed by
41 ! 'code' and 'charge'.
42 !----------------------------------------------------------------------
43 ! n n~ k0s k0l
44 ! subcode
45 ! defined kneutron kneutronb k0s k0l
46 ! in Zcode.h
47 !----------------------------------------------------------------------
48 ! neutrino(e) neutrino(mu) neutrino(e)~ neutrino(mu)~
49 !
50 ! subcode regptcl regptcl antip antip
51 !
52 !----------------------------------------------------------------------
53 ! direct gamma brems gamma d0 d0~
54 !
55 ! subcode kdirectg kcasg kd0 kdb
56 !
57 !----------------------------------------------------------------------
58 ! charge=charge (if not heavy neuclus)
59 ! (charge * Z) (charge = 1, 0, -1)
60 !
61 ! If subcode = 0 for neutral partilces, this
62 ! should be reset later, if they are
63 ! not symmetric particle (k0, n, d0)
64 !
65 !
66 !
67  implicit none
68 !---- include '../Zptcl.h'
69 #include "Zptcl.h"
70 !---- include '../Zcode.h'
71 #include "Zcode.h"
72 #include "Zheavyp.h"
73  type(ptcl):: p
74  integer code, charge, subcode
75 !
76  p%code = code
77 ! if(code .ge. kdeut .and. code .le. khvymax) then
78  if(code .ge. kalfa .and. code .le. khvymax) then
79  call cshvc(code, charge, p)
80  elseif(code .eq. kdeuteron ) then
81  p%code = kgnuc
82  call cshvc(code, charge, p)
83  elseif(code .eq. ktriton) then
84  p%code = kgnuc
85  call cshvc(code, charge, p)
86  else
87  p%charge = charge
88  endif
89  call csmass(code, subcode, charge, p)
90  call cssubc(code, subcode, charge, p)
91 ! for heavy, we use only kgnuc here after (from v6.0)
92  if(code .ge. kalfa .and. code .le. khvymax) then
93  p%subcode = code2massn(code)
94  p%code = kgnuc
95  endif
96  end
97 ! *******************************************************
98  subroutine csmass(code, subcode, charge, p)
99 ! set particle mass from ptcl code and charge.
100 ! code: Integer. Input. partcle code defined in COSMOS
101 ! charge:Integer. Input. partcle charge.
102 ! p:/ptcl/ Output. p.mass will get partcle mass in GeV.
103 ! For heavy neucleus, (massp + massn)/2*A
104 ! is used.
105  implicit none
106 !---- include '../Zptcl.h'
107 #include "Zptcl.h"
108 !---- include '../Zcode.h'
109 #include "Zcode.h"
110 !---- include '../Zmass.h'
111 #include "Zmass.h"
112 !
113  integer code, charge, subcode
114  type(ptcl):: p
115 !
116  real*8 x
117  parameter(x = 1.d50)
118  real*8 mass(0:klast, -1:1)
119  character*8 id
120  integer massn
121  character*70 msg
122  data
123  * mass(kphoton, :)/x, 0., x/,
124  * mass(kelec,:)/masele,x, masele/,
125  * mass(kmuon, :)/masmu,x,masmu/,
126  * mass(kpion, :)/maspic, maspi0, maspic/
127  data
128  * mass(kkaon, :)/maskc, mask0, maskc/,
129  * mass(knuc, :)/masp, masn, masp/,
130  * mass(kneue, :)/x, 0., x/,
131  * mass(kneumu,:)/x, 0., x/,
132  * mass(kneumu,:)/x, 0., x/,
133  * mass(knnb, :)/x, masnnb, x/
134  data
135  * mass(kddb, :)/x,masddb,x/,
136  * mass(kdmes,:)/masd, masd, masd/
137  * mass(krho, :)/masrho, masrho, masrho/,
138  * mass(komega,:)/x,masomg, x/
139  * mass(kphi,:)/x, masphi, x/
140  * mass(keta, :)/x, maseta, x/
141  * mass(ketap, :)/x, masetap, x/
142 
143  data
144  * mass(ksigma, :)/massigmam, massigma0, massigmap/,
145  * mass(kgzai, :)/masgzaim, masgzai0, masgzaim/,
146  * mass(klambda,:)/x, maslambda,x/,
147  * mass(klambdac,:)/maslambdac, x, maslambdac/,
148  * mass(krare, :)/0., 0., 0./,
149  * mass(kgnuc, :)/x, x, x/
150  data
151  * mass(kbomega, :)/masbomega, x, masbomega/,
152  * mass(kds,:) /masds, x, masds/,
153  * mass(kxic,:)/masxic, masxic0, masxic/,
154  * mass(ktau,:)/mastau, x, mastau/,
155  * mass(komec0,:)/x, masomc0, x/
156  * mass(kdelta,:)/masdelta,masdelta, masdelta/
157 ! if(code .ge. kdeut .and. code .le. khvymax) then
158  if(code .ge. kalfa .and. code .le. khvymax) then
159 ! get mass number
160  call cghvm(code, massn)
161  p%mass =( masn + masp) * massn /2
162  elseif(code .eq. kdeuteron) then
163  p%mass = 1.875613d0
164  elseif(code .eq. ktriton) then
165  p%mass = 2.80891
166  elseif(code .eq. kgnuc) then
167 ! general nucleaus (A>1). subcode is A. very rough
168 ! binding energy. (Weizsacker-Bethe)
169  p%mass = masn*(subcode-charge) + masp*charge
170  * -(15.68d-3*subcode-18.56d-3*(float(subcode))**0.6666
171  * -0.717d-3 * charge**2/(float(subcode))**0.33333)
172  elseif(code .ge. 0 .and. code .le. klast) then
173  p%mass = mass(code, charge)
174  if(p%mass .eq. x) then
175  call cgpid(code, id)
176  write(msg, *)
177  * ' charge=',charge,' invalid for csmass; code=',id
178  call cerrormsg(msg, 0)
179  endif
180  elseif( code .eq. klight ) then
181  p%mass = 0.
182  elseif( code .eq. kedepo .or. code .eq. kchgpath ) then
183 ! energy deposit or charged ptcl streight path for
184 ! light emission; nothing to do
185  else
186  write(msg, *) ' code=',code,' invalid to csmass'
187  call cerrormsg(msg, 0)
188  endif
189  end
190 ! *******************************************************
191  subroutine cssubc(code, subcode, charge, p)
192 ! set particle or anti particle subcode from
193 ! ptcl code and charge.
194 ! code: Integer. Input. particle code defined in COSMOS
195 ! subcode: Integer. Input. paricle sub code //
196 ! charge:Integer. Input. partcle charge.
197 ! p: /ptcl/. Output. for most of particles,
198 ! 'ptcl' or 'antip' is set according to
199 ! code and charge. For neutron, k0, gamma
200 ! they are treated specially.
201 ! for self conjugate particles, 0 is set.
202 !
203  implicit none
204 !---- include '../Zptcl.h'
205 #include "Zptcl.h"
206 !---- include '../Zcode.h'
207 #include "Zcode.h"
208 #include "Zheavyp.h"
209 !
210  integer code, subcode, charge
211  type(ptcl):: p
212  character*70 msg
213 !
214  if(code .ge. 1 .and. code .le. klast) then
215 ! this should be consistent with regptcl/antip
216 ! def. in Zcode.h
217  if(code .eq. kphoton) then
218  p%subcode = subcode
219  elseif(code .eq. kelec .or. code .eq. kmuon ) then
220  p%subcode = - charge * regptcl
221  elseif(code .eq. kpion .or. code .eq. kkaon
222  * .or. code .eq. knuc) then
223  p%subcode = charge * regptcl
224  if( code .eq. kkaon .and. charge .eq. 0 .and.
225  * subcode .ne. 0) then
226  if(abs(subcode) .eq. k0s .or.
227  * abs(subcode) .eq. k0l ) then
228  p%subcode = subcode
229  else
230  write(msg,*) '1 strange subcode=',
231  * subcode,' to cssubc. code=', code
232  p%mass = -1.0
233  p%mass = sqrt(p%mass)
234  call cerrormsg(msg, 0)
235  endif
236  elseif(code .eq. knuc .and. charge .eq. 0
237  * .and. subcode .ne. 0) then
238  if(subcode .eq. kneutron .or.
239  * subcode .eq. kneutronb) then
240  p%subcode = subcode
241  else
242  write(msg, *) '2 strange subcode=',
243  * subcode, ' to cssubc. code=', code
244  call cerrormsg(msg, 0)
245  endif
246  endif
247  elseif(code .eq. kdmes) then
248  if(subcode .ne. 0 .and. charge .eq. 0)then
249  if(subcode .eq. kd0 .or.
250  * subcode .eq. kd0b) then
251  p%subcode = subcode
252  endif
253  else
254  p%subcode = charge * regptcl
255  endif
256 ! elseif(code .ge. kdeut .and. code .le. khvymax) then
257  elseif(code .ge. kalfa .and. code .le. khvymax) then
258 ! p.subcode = isign(1, charge) *regptcl; set A
259  p%subcode = code2massn(code) ! mass #
260  elseif(code == kdeuteron ) then
261  p%subcode = 2
262  elseif(code .eq. ktriton ) then
263 ! p.subcode = isign(1, charge) *regptcl
264  p%subcode = 3 ! mass #
265  elseif(code .eq. kgnuc) then
266  p%subcode = subcode ! mass #
267  elseif(code .eq. kneumu .or. code .eq. kneue) then
268  if(subcode .eq. regptcl .or.
269  * subcode .eq. antip .or.
270  * subcode .eq. 0 ) then
271  p%subcode = subcode
272  else
273  write(msg, *) ' 3 strange subcode=',
274  * subcode, ' to cssubc. code=', code
275  call cerrormsg(msg, 0)
276  endif
277  elseif(code .ge. klambda .and.
278  * code .le. klast ) then
279  p%subcode = subcode
280  else
281  p%subcode = 0 ! should be fixed later
282  endif
283  elseif( code .eq. klight .or. code .eq. kedepo .or.
284  * code .eq. kchgpath ) then
285 ! not certain.
286  p%subcode = subcode
287  elseif(code .eq. krare) then
288  p%subcode = 0
289  else
290  write(msg, *) ' code=',code,' invalid to cssubc'
291  call cerrormsg(msg, 0)
292  endif
293  end
294 ! ****************************************************
295 ! set heavy neucleus charge
296  subroutine cshvc(code, charge, p)
297 ! code: Integer. Input. ptcl code
298 ! charge: Integer. Input. ptcl charge (1 or -1)
299 ! indicating only positive or
300 ! negative. True charge is
301 ! set here.
302 ! p: /ptcl/. Output. heavy neucleus charge
303 ! is set in p.charge
304 !
305  implicit none
306 !---- include '../Zptcl.h'
307 #include "Zptcl.h"
308 !---- include '../Zcode.h'
309 #include "Zcode.h"
310  integer code, charge
311  type(ptcl):: p
312  character*70 msg
313 !
314 ! integer zhvy(kdeut:khvymax)/1, 2, 4, 7, 12, 17, 26/
315  integer zhvy(kalfa:khvymax)/2, 4, 7, 12, 17, 26/
316 !
317 ! if(code .ge. kdeut .and. code .le. khvymax ) then
318  if(code .ge. kalfa .and. code .le. khvymax ) then
319  p%charge = zhvy(code) * isign(1, charge)
320  elseif(code .eq. kdeuteron) then
321  p%charge = 1
322  elseif(code .eq. ktriton) then
323  p%charge = 1
324  else
325  write(msg, *) 'error input code=',code,' to cshvc'
326  call cerrormsg(msg, 0)
327  endif
328  end
329 ! ***************************************************
330 ! get heavy neucleus mass number
331  subroutine cghvm(code, massn)
332 ! code: Integer input. ptcl code
333 ! massn: Integer output. mass number
334  implicit none
335 !---- include '../Zcode.h'
336 #include "Zcode.h"
337 #include "Zheavyp.h"
338  integer code, massn
339  character*70 msg
340 !
341 !
342 ! if(code .ge. kdeut .and. code .le. khvymax) then
343  if(code .ge. kalfa .and. code .le. khvymax) then
344  massn = code2massn(code)
345  else
346  write(msg, *) 'error input code=',code,' to cghvm'
347  call cerrormsg(msg, 0)
348  endif
349  end
350 ! ****************************************************
351 ! get particle id
352  subroutine cgpid(code, id)
353 ! get partilce id in character
354 ! code: Integer. Input. particle code defined in COSMOS
355 ! id: Character*8. Output. partcle id
356  implicit none
357 !---- include '../Zcode.h'
358 #include "Zcode.h"
359  integer code
360  character*8 id
361 !
362  character*70 msg
363  character*8 ida(klast)
364  data ida(kphoton)/'photon'/, ida(keta)/'Eta'/,
365  * ida(kelec)/'Electron'/, ida(kmuon)/'Muon'/,
366  * ida(kpion)/'Pion'/, ida(kkaon)/'Kaon'/,
367  * ida(knuc)/'Nucleon'/, ida(kneue)/'Nue_e'/,
368  * ida(kneumu)/'Nue_mu'/, ida(knnb)/'NN~'/,
369  * ida(kddb)/'DD~'/, ida(kdmes)/'D_meson'/,
370  * ida(krho)/'Rho'/, ida(komega)/'omega'/,
371  * ida(kphi)/'Phi'/, ida(kgnuc)/'Nucleus'/,
372  * ida(kdeuteron) /'d'/, ida(ktriton)/'t'/
373 ! * ida(kphi)/'Phi'/, ida(kdeut)/'deuteron'/
374 ! heavy neucleus
375  data ida(kalfa)/'Helium'/, ida(klibe)/'LiBeB'/,
376  * ida(kcno)/'CNO'/, ida(khvy)/'NaMgSi'/,
377  * ida(kvhvy)/'SClAr'/, ida(kiron)/'Fe'/,
378  * ida(keta+1)/'light'/, ida(keta+2)/'dE'/,
379  * ida(keta+2)/'cpath'/
380  data ida(ksigma)/'sigma'/, ida(klambda)/'lambda'/,
381  * ida(kgzai)/'gzai'/, ida(klambdac)/'lambdac'/,
382  * ida(kbomega)/'Omega'/
383  data ida(ktau)/'tau'/, ida(kneutau)/'neu_tau'/
384  data ida(kds)/'Ds'/, ida(kxic)/'Xic'/
385  data ida(komec0)/'OmegaC0'/
386  if(code .ge. 1 .and. code .le. klast)then
387  id = ida(code)
388  else
389  write(msg, *) ' code=',code,' invalid to cgpid'
390  call cerrormsg(msg, 0)
391  endif
392  end
393 ! ------------------------------------------
394  subroutine cprptc(p, n)
395 ! print /ptcl/ strucuture; debug purpose
396 !
397 !---- include '../Zptcl.h'
398 #include "Zptcl.h"
399  type(ptcl):: p(n)
400 !
401  integer i, j, code
402  character*8 id
403  character*80 msg
404 
405 !
406  do i=1, n
407  code = p(i)%code
408  call cgpid(code, id)
409  write(msg, *) ' ---------code=',p(i)%code, ' id=', id
410  call cerrormsg(msg, 1)
411  write(0, *) ' 4 momentum=',(p(i)%fm%p(j),j=1, 4), ' mass=',
412  * p(i)%mass
413 ! call cerrorMsg(msg, 1)
414  write(msg, *) ' charge=', p(i)%charge, ' subcode=',
415  * p(i)%subcode
416  call cerrormsg(msg, 1)
417  enddo
418  end
419 
420 
421 
422 
423 
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
subroutine cshvc(code, charge, p)
Definition: cmkptc.f:297
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
maslambda
Definition: Zmass.h:5
subroutine csmass(code, subcode, charge, p)
Definition: cmkptc.f:99
max ptcl codes in the kgzai
Definition: Zcode.h:2
max ptcl codes in the ketap
Definition: Zcode.h:2
masbomega
Definition: Zmass.h:5
max ptcl codes in the kseethru ! subcode integer k0l
Definition: Zcode.h:2
max ptcl codes in the kdmes
Definition: Zcode.h:2
masphi
Definition: Zmass.h:5
max ptcl codes in the kgnuc
Definition: Zcode.h:2
max ptcl codes in the kseethru ! subcode integer k0s
Definition: Zcode.h:2
max ptcl codes in the kphi
Definition: Zcode.h:2
masn
Definition: Zmass.h:5
const int kphoton
Definition: Zcode.h:6
max ptcl codes in the klambdac
Definition: Zcode.h:2
max ptcl codes in the kkaon
Definition: Zcode.h:2
mastau
Definition: Zmass.h:5
max ptcl codes in the kelec
Definition: Zcode.h:2
masgzai0
Definition: Zmass.h:5
max ptcl codes in the kneue
Definition: Zcode.h:2
max ptcl codes in the ktriton
Definition: Zcode.h:2
max ptcl codes in the kneutau
Definition: Zcode.h:2
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kalfa
Definition: cblkHeavy.h:7
massigmap
Definition: Zmass.h:5
max ptcl codes in the komega
Definition: Zcode.h:2
masmu
Definition: Zmass.h:5
max ptcl codes in the kseethru ! subcode integer regptcl
Definition: Zcode.h:2
max ptcl codes in the kseethru ! subcode integer kneutronb
Definition: Zcode.h:2
subroutine cgpid(code, id)
Definition: cmkptc.f:353
masomg
Definition: Zmass.h:5
max ptcl codes in the kseethru ! subcode integer kneutron
Definition: Zcode.h:2
masd
Definition: Zmass.h:5
maskc
Definition: Zmass.h:5
masddb
Definition: Zmass.h:5
max ptcl codes in the kiron
Definition: Zcode.h:2
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
masgzaim
Definition: Zmass.h:5
max ptcl codes in the klambda
Definition: Zcode.h:2
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code knuc
Definition: cblkHeavy.h:7
max ptcl codes in the krho
Definition: Zcode.h:2
max ptcl codes in the kneumu
Definition: Zcode.h:2
subroutine cssubc(code, subcode, charge, p)
Definition: cmkptc.f:192
masrho
Definition: Zmass.h:5
max ptcl codes in the klight
Definition: Zcode.h:2
mask0
Definition: Zmass.h:5
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kvhvy
Definition: cblkHeavy.h:7
max ptcl codes in the knnb
Definition: Zcode.h:2
subroutine cprptc(p, n)
Definition: cmkptc.f:395
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kcno
Definition: cblkHeavy.h:7
const double masele
Definition: Zmass.h:2
max ptcl codes in the kds
Definition: Zcode.h:2
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code klibe
Definition: cblkHeavy.h:7
maslambdac
Definition: Zmass.h:5
max ptcl codes in the ktau
Definition: Zcode.h:2
max ptcl codes in the kseethru ! subcode integer kd0
Definition: Zcode.h:2
subroutine cmkptc(code, subcode, charge, p)
Definition: cmkptc.f:15
masnnb
Definition: Zmass.h:5
max ptcl codes in the khvymax
Definition: Zcode.h:2
max ptcl codes in the keta
Definition: Zcode.h:2
massigma0
Definition: Zmass.h:5
masp
Definition: Zmass.h:5
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code khvy
Definition: cblkHeavy.h:7
max ptcl codes in the kseethru ! subcode integer kd0b
Definition: Zcode.h:2
max ptcl codes in the klast
Definition: Zcode.h:2
Definition: Zptcl.h:75
max ptcl codes in the kseethru ! subcode integer antip
Definition: Zcode.h:2
massigmam
Definition: Zmass.h:5
max ptcl codes in the kpion
Definition: Zcode.h:2
maspic
Definition: Zmass.h:5
maspi0
Definition: Zmass.h:5
masds
Definition: Zmass.h:5
max ptcl codes in the ksigma
Definition: Zcode.h:2
max ptcl codes in the kddb
Definition: Zcode.h:2
masetap
Definition: Zmass.h:5
max ptcl codes in the kdeuteron
Definition: Zcode.h:2
max ptcl codes in the kmuon
Definition: Zcode.h:2
integer n
Definition: Zcinippxc.h:1
maseta
Definition: Zmass.h:5
max ptcl codes in the kbomega
Definition: Zcode.h:2
max ptcl codes in the krare
Definition: Zcode.h:2
subroutine cghvm(code, massn)
Definition: cmkptc.f:332