COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cheavyInt.f
Go to the documentation of this file.
1 ! *****************************************************************
2 ! * *
3 ! * cheavyInt: treats heavy particle interactions
4 ! * *
5 ! *****************************************************************
6 !
7 ! -- process --
8 ! 1) samples fragment ptcls using fragmentation parameters
9 ! and determines the no. of interacting nucleons.
10 ! 2) gives break-up angle for fragments other than interacting
11 ! nucleons
12 ! 3) for interacting nucleons, calls chAcol to make
13 ! multiple production.
14 !
15  subroutine cheavyint(pj, ia, iz, a, ntp)
16 #if !defined (MacIFC)
17  use modxsecmedia
18 #endif
19  implicit none
20 
21 #include "Zcode.h"
22 #include "Zptcl.h"
23 #include "Zcoord.h"
24 #include "Zheavyv.h"
25 #include "Zevhnp.h"
26 #include "Zevhnv.h"
27 #include "Zair.h"
28 
29 !///////////
30 ! logical deb
31 ! common/cdebug/ deb
32 !//////////
33 !
34  external cblkheavy
35 !
36 !
37 ! ia: mass no. of the target
38 ! iz: charge of the target
39 
40  integer ia, iz, ntp
41  type(ptcl):: pj, a(*)
42 !
43 ! type(coord):: dir
44 ! real*8 dummylen
45 !
46 ! to store heavy fragment nucleon
47  type(ptcl):: frga(maxheavymassn), nuc(maxheavymassn)
48 
49  type(ptcl):: fragA(maxheavymassn), intNucA(maxheavymassn),
50  * nonintnuca(maxheavymassn)
51 !
52 
53  integer noOfFragments, noOfNuc, noOfInteNuc
54  save nooffragments, noofnuc, noofintenuc
55 
56  integer noOfFrag, noOfIntN, noOfNonIntN
57 
58  integer i, n, j
59 !///////////////
60 ! integer cumev, cev
61 !////////////
62 ! /////
63 ! real*8 sumerg
64 
65 ! call ctestOnShell(' heavy bef frag', pj)
66 ! sumerg = 0.
67 ! ////
68 
69 !
70 ! MacIFC ld error ; also for TargetXs here and chAcol.f)
71 ! (No error when complile ephook.f but for
72 ! testCnf1.mk error occurs)
73 !//// integer:: dummy
74 !/// dummy = TargetNucleonNo
75 !Undefined symbols for architecture x86_64:
76 ! "_modxsecmedia_mp_targetnucleonno_", referenced from:
77 ! _cheavyint_ in libcosmos.a(cheavyInt.o)
78 ! "_modxsecmedia_mp_targetxs_", referenced from:
79 ! _cheavyint_ in libcosmos.a(cheavyInt.o)
80 ! _chacolx_ in libcosmos.a(chAcol.o)
81 !ld: symbol(s) not found for architecture x86_64
82 !c//////////////////
83 #if defined (MacIFC)
84 #include "Zworkaround.h"
85 #endif
86 
87  ntp=0
88 !
89 ! ** fragmentation with some nucleon interaction **
90 ! sample and set fragmentation ptcls
91 ! noOfFragments: heavy fragments
92 ! noOfNuc: all nucleons
93 ! noOfInteNuc: interacting nucleons.
94 !
95 !
96 ! if(IntModel .eq. 'int2' .and.
97 ! * ( pj.code .eq. ktriton .or. pj.code .eq. kdeut) ) then
98 
99  if( activemdl .eq. 'dpmjet3') then
100  if((pj%fm%p(4) - pj%mass)/pj%subcode .gt. 5.1) then
101  call cdpmjet(pj, ia, iz, a, ntp)
102  else
103 ! rescue
104  call cjamevent(pj, ia, iz, targetxs, a, ntp)
105  endif
106  elseif( activemdl .eq. 'jam') then
107  call cjamevent(pj, ia, iz, targetxs, a, ntp)
108  elseif( activemdl .eq. 'phits') then
109  call cphits(pj, ia, iz, targetxs, a, ntp)
110  elseif(activemdl .eq. 'qgsjet2') then
111  call cqgsjet(pj, ia, iz, a, ntp)
112  elseif(activemdl .eq. 'epos') then
113  call ceposgenoneevent(pj, ia, iz, a, ntp)
114  elseif(activemdl .eq. 'sibyll') then
115  call csibyllevent(pj, ia, iz,a, ntp)
116  elseif(activemdl .eq. 'gheisha' .and.
117  * pj%code .eq. kgnuc .and. (pj%subcode .eq. 2 .or.
118  * pj%subcode .eq. 3) ) then
119 ! Gheisha should be called directly
120  call chagheisha(pj, ia, iz, a, ntp)
121  nooffragments = 0
122  noofnuc = 0
123  noofintenuc = 0
124  else
125 ! resque
126  call cjamevent(pj, ia, iz, targetxs, a, ntp)
127 !! call csampFragments(pj, ia, frga, noOfFragments,
128 !! * nuc, noOfNuc, noOfInteNuc)
129 !! if(SkipPtclGen .eq. 0) then
130 !!c interaction of interating nuc.
131 !! do i = 1, noOfInteNuc
132 !! j=i + noOfNuc - noOfInteNuc
133 !! call chAcol(nuc(j), ia, iz, a(ntp+1), n)
134 !! ntp=ntp+n
135 !! enddo
136 !!c all business so far is done in the frame where
137 !!c z axis is the incident
138 !!c make rotation
139 !! call crot3mom( pj, a, ntp )
140 !! endif
141 !! call crot3mom( pj, nuc, noOfNuc) ! for all nucleons. see entry below
142 !!
143 !! call crot3mom( pj, frga, noOfFragments)
144 !!
145 !!
146 !!c move non-interacting nucleon and fragments
147 !! do i = 1, noOfNuc - noOfInteNuc
148 !! a(ntp+1) = nuc(i)
149 !! ntp = ntp +1
150 !! enddo
151 !! do i = 1, noOfFragments
152 !! a(ntp + 1) = frga(i)
153 !! ntp = ntp + 1
154 !! enddo
155  endif
156  return
157 ! ****************** inquire the fragments at heavy interation
158  entry cqhvyintf(fraga, nooffrag)
159 ! *******************
160 ! note if MovedTrack.p.code is not heavy, this gives wrong result
161 
162  nooffrag = nooffragments
163 ! move fragments
164  do i = 1, nooffrag
165  fraga(i) = frga(i)
166  enddo
167  return
168 ! ******************** inquire the interacting nuc.
169  entry cqhvyintin(intnuca, noofintn)
170 ! *******************
171  noofintn = noofintenuc
172 ! move interacting nucleons
173  do i = 1, noofintn
174  intnuca(i) = nuc(i+noofnuc - noofintenuc)
175  enddo
176  return
177 ! ******************inquire non interacting nuc.
178  entry cqhvyintnin(nonintnuca, noofnonintn)
179 ! ******************
180  noofnonintn = noofnuc - noofintenuc
181 ! move non-interacting nucleons
182  do i = 1, noofnonintn
183  nonintnuca(i) = nuc(i)
184  enddo
185  end
186 ! *****************************************************************
187 ! * *
188 ! * csampFragments: sample and set fragmentation ptcls *
189 ! * *
190 ! *****************************************************************
191 !
192 ! /usage/ call csampFragments(pj, ia, fra, noOfFragments,
193 ! * nuc, noOfNuc, noOfInteNuc)
194 !
195 ! 1) samples fragment ptcl one by one by referring cfptbl
196 ! until sum of fragment mass no. exceeds incident mass no.
197 ! - 3 so that no heavy ptcl can emerg more. then the
198 ! remaining ones
199 ! are assigned to nucleons, if any. If the sum exceeds
200 ! incident mass no. during sampling, retrial is made from the
201 ! first. For each sampled fragment, energy is given pro-
202 ! potionally to its mass. charge, mass and kind are also
203 ! given according to cosmos convention.
204 !
205 ! 2) fra is to store heavy fragments
206 ! nuc is to store all nucleons
207 ! 3) charge of the nucleons is reset because process 1) assigns
208 ! only proton
209 ! 4) samples no. of interacting nucleons
210 ! 5) samples pt of fragments other than interacting nucleons
211 ! and convert it to ptx, pty
212 !
213 ! noOfFragments: # of heavy fragments stored in fra
214 ! noOfNuc: # of nucleons stored in nuc.
215 ! noOfInteNuc: # of interacting nucleons among them
216 !
217 !
218  subroutine csampfragments(pj, ia,
219  * fra, noOfFragments, nuc, noOfNuc, noOfInteNuc)
220  implicit none
221 
222 #include "Zptcl.h"
223 #include "Zcode.h"
224 #include "Zheavyp.h"
225 #include "Zheavyc.h"
226 
227 
228  integer noOfFragments, noOfNuc, noOfInteNuc, ia
229 ! ia: # of target nucleons
230  type(ptcl):: pj, fra(*), nuc(*)
231  integer ihg, mno, mx, mn, msumf, ihgf, jcon,
232  * hchg
233  real*8 epn, u
234  logical first/.true./
235  integer i, zfrag
236 !
237  if(first) then
238  call cmakefragtbl
239  first = .false.
240  endif
241 
242  if( (pj%fm%p(4)-pj%mass)/pj%subcode .lt. 0.1) then
243  fra(1) = pj
244  nooffragments = 1
245  noofnuc = 0
246  noofintenuc = 0
247  return ! ********
248  endif
249 !
250 ! get heavy group index from the incident charge
251  ihg=charge2heavyg(pj%charge)
252 
253 ! # of nucleons
254 ! mno=HeavyG2massN(ihg)
255  mno = pj%subcode
256 ! z
257 ! hchg=HeavyG2charge(ihg)
258 
259  hchg=pj%charge
260 
261 ! t.e energy per nucleon
262  epn=pj%fm%p(4)/mno
263 ! margin for mass no. conservation (for first trial)
264  mx = mno
265  mn = mno - 3
266 
267 !
268 ! retry if final sum of mass exceeds incident one
269 ! *** until loop***
270  do while (.true.)
271 ! sum of mass of fragments
272  msumf = 0
273 ! no. of heavy fragments
274  nooffragments = 0
275 ! no. of all nucleons
276  noofnuc = 0
277 ! repeat until sum of mass becomes >= amn
278 ! *** until loop***
279  do while (.true.)
280  if( mno .ge. 10 .and. nooffragments .eq. 0) then
281 ! for A >= 10, first sampled fragment must be
282 ! non-nucleon to avoid too many nucleons.
283  call rndc(u)
284  u=(1.-cfragmentationtbl(ihg,2))*u +
285  * cfragmentationtbl(ihg,2)
286 ! find CfragmentationTbl >= u to sample fragrment
287  call kfrge(cfragmentationtbl(ihg,1), maxheavyg,
288  * ihg, u, ihgf, jcon)
289 ! sampled group index
290  else
291  call rndc(u)
292 ! find FragmentaionTbl >= u to sample fragrment
293  call kfrge(cfragmentationtbl(ihg,1), maxheavyg,
294  * ihg, u, ihgf, jcon)
295  endif
296 !
297  if(ihgf .eq. 1)then
298 ! count nucleon
299  noofnuc = noofnuc + 1
300 ! make ptcl; nucleon charge is reset later
301  call cmkptc(knuc, regptcl,
302  * 1, nuc(noofnuc))
303  nuc(noofnuc)%fm%p(4) = epn
304  else
305 ! count fragment
306  nooffragments=nooffragments+1
307 ! make ptcl;
308  call cmkptc(heavyg2code(ihgf), regptcl,
309  * 1, fra(nooffragments))
310 ! set energy
311  fra(nooffragments)%fm%p(4) = heavyg2massn(ihgf) * epn
312  endif
313 ! count mass no.
314  msumf=msumf+heavyg2massn(ihgf)
315  if (msumf .ge. mn)
316  * goto 50
317  enddo
318  50 continue
319  if(msumf .le. mx) then
320 ! remaining ptcls should be nucleons
321  do i = 1, mno - msumf
322  noofnuc = noofnuc + 1
323  call cmkptc(knuc, regptcl, 1, nuc(noofnuc) )
324 ! set energy
325  nuc(noofnuc)%fm%p(4) = epn
326  enddo
327 ! get sum of fragment charge
328  zfrag = 0
329  do i = 1, nooffragments
330  zfrag = zfrag + fra(i)%charge
331  enddo
332  if(zfrag .le. pj%charge) goto 100
333  endif
334  enddo
335  100 continue
336 ! reset nucleon charge
337  call cresetnucchg(nuc, noofnuc, hchg - zfrag)
338 !
339 ! sample interacting nucleon no.
340  call csampintenuc(pj, ia, noofnuc, noofintenuc)
341 
342 ! sample fragment mom. all frag.
343  call csampfragmom(fra, nooffragments)
344 ! sample non-interacting nuc. mom.
345  call csampfragmom(nuc, noofnuc - noofintenuc)
346 ! set interacting nuc. mom
347  do i=noofnuc, noofnuc - noofintenuc + 1, -1
348  nuc(i)%fm%p(1) = 0.
349  nuc(i)%fm%p(2) = 0.
350  nuc(i)%fm%p(3) = sqrt(
351  * max( nuc(i)%fm%p(4)**2 - nuc(i)%mass**2, 0.d0) )
352  enddo
353  end
354 ! *****************************************************************
355 ! * *
356 ! * cresetNucChg: reset charge of nucleons emerging from heavy *
357 ! * *
358 ! *****************************************************************
359 !
360  subroutine cresetnucchg(nuc, noOfNuc, z)
361 !
362  implicit none
363 !---- include '../../Zptcl.h'
364 #include "Zptcl.h"
365  integer z, noOfNuc
366  type(ptcl):: nuc(noofnuc)
367 !
368  integer i
369 !
370  do i = 1, z
371  nuc(i)%charge = 1
372  enddo
373  do i = z+1, noofnuc
374  nuc(i)%charge = 0
375  enddo
376  end
377 ! *****************************************************************
378 ! * *
379 ! * csampInteNuc: sample interacting nucleon number *
380 ! * *
381 ! *****************************************************************
382 !
383 ! 1) gets average no. of interacting nucleons
384 ! 2) gets average no. of nucleons from heavy
385 ! 3) using the ratio of 1)/2) and binomial distribution,
386 ! samples no. of interacting nucleons.
387 
388 !
389 ! = = = =
390 !
391  subroutine csampintenuc(pj, ia, noOfNuc, noOfInteNuc)
393  implicit none
394 
395 #include "Zcode.h"
396 #include "Zptcl.h"
397 #include "Zheavyp.h"
398 
399  integer noOfNuc, noOfInteNuc, ia ! ia: # of target nuc.
400  type(ptcl):: pj ! projectile heavy
401  integer ihg
402  real*8 avintn, avnn
403 !
404 
405 ! heavy group index
406  ihg=charge2heavyg(pj%charge)
407 ! get average no. of interacting nucleons
408  call caveintenuc(pj, ia, avintn)
409 ! average no. of nucleons in fragments
410  avnn = fragmenttbl(ihg, 1)
411 ! sample interacting nucleon number by binormial distribution
412 ! with prob. avintn/avnn
413  call kbinom( avintn/avnn, noofnuc, noofintenuc)
414  end
415 ! *****************************************************************
416 ! * *
417 ! * csampFragMom: sample px, py, pz of fragments
418 ! * *
419 ! *****************************************************************
420 !
421 ! /usage/ call csampFragMom(a, nf)
422 !
423 ! pt is sampled by gaussian type distribution and stored in
424 ! 'a'. ptx,pty are also stored.
425 !
426  subroutine csampfragmom( a, nf )
427  implicit none
428 
429 #include "Zptcl.h"
430  integer nf
431  type(ptcl):: a(nf)
432 
433  integer i, nc
434  real*8 pt, p, cs, sn
435 
436  do i=1, nf
437 ! sample fragment pt
438  nc=0
439  p=sqrt( a(i)%fm%p(4)**2- a(i)%mass**2 )
440 ! *** until loop***
441  do while (.true.)
442  call csampfragpt(a(i), pt)
443  nc=nc+1
444  if (pt .lt. p .or. nc .eq. 10)
445  * goto 10
446  enddo
447  10 continue
448  if(nc .ge. 10) then
449  pt=min(1.d-10, p)
450  endif
451 ! set pt and pz
452  a(i)%fm%p(3) = sqrt(p**2-pt**2)
453  call kcossn(cs, sn)
454  a(i)%fm%p(1) = pt*cs
455  a(i)%fm%p(2) = pt*sn
456  enddo
457  end
458 ! *****************************************************************
459 ! * *
460 ! * csampFragPt: sample fragment pt
461 ! * *
462 ! *****************************************************************
463 !
464 ! -- process --
465 ! pt is sampled by gaussian type distribution:
466 ! exp(- x**2) dx**2 where x= 2pt/sqrt(pi)
467 !
468  subroutine csampfragpt(aPtcl, pt)
469  implicit none
470 
471 #include "Zptcl.h"
472 #include "Zcode.h"
473 #include "Zheavyp.h"
474  real*8 pt ! sampled pt in GeV/c
475 
476  type(ptcl):: aPtcl
477 !
478 !
479  real*8 avpt, u
480 !
481  if(aptcl%code .eq. knuc) then
482  avpt= ptavnonintenuc
483  else
484  avpt= ptavfrag
485  endif
486 !
487  call rndc(u)
488 ! note avpt is not <pt> but <pt>/sqrt(pi/2)
489  pt = avpt *sqrt(- log(u)* 2 )
490  end
491 ! *****************************************************************
492 ! * *
493 ! * cmakeFragTbl: makes fragmentation parameter table for
494 ! * heavy ptcl frgmentation sampling
495 ! * *
496 ! *****************************************************************
497 !
498 ! FragmentaionTbl(i,j) is assumed to have <no. of heavy of group
499 ! j> when heavy of group i fragments. For each group i,
500 ! FragmentTbl is normalized so that the sum of them
501 ! becomes 1 and then made to be cumulative table such that
502 ! CfragmentaionTbl(i,j) <= CragmentaionTbl(i,j+).
503 !
504 !
505 
506  subroutine cmakefragtbl
507  implicit none
508 
509 #include "Zcode.h"
510 #include "Zheavyp.h"
511 #include "Zheavyc.h"
512 !
513  integer i, j
514 !
515 ! do below for nucleus group 1 to maxHeavyG
516 !
517  do i=1, maxheavyg
518 ! FragmentaionTbl(i,j) containes
519 ! <no. of nucleus of group j> when
520 ! nucleus of group i fragments (j<=i)
521 ! make cumulative table
522  cfragmentationtbl(i, 1) = fragmenttbl(i, 1)
523  do j=1,i-1
524  cfragmentationtbl(i,j+1)=fragmenttbl(i,j+1)
525  * +cfragmentationtbl(i,j)
526  enddo
527 ! normalzie
528  do j=1, i
529  cfragmentationtbl(i, j) = cfragmentationtbl(i,j)/
530  * cfragmentationtbl(i,i)
531  enddo
532  enddo
533  end
534  subroutine chg2massn(hg, massnum)
535  implicit none
536 #include "Zcode.h"
537 #include "Zheavyp.h"
538  integer massnum, hg
539  massnum = heavyg2massn(hg)
540  end
541  subroutine chg2charge(hg, charge)
542  implicit none
543 #include "Zcode.h"
544 #include "Zheavyp.h"
545  integer charge, hg
546  charge = heavyg2charge(hg)
547  end
548  subroutine ccode2hvgrp(code, hg)
549  implicit none
550 #include "Zcode.h"
551 #include "Zheavyp.h"
552  integer code, hg
553  if(code .ge. kalfa .and. code .le. kiron) then
554  hg = code2heavyg(code)
555  else
556  call cerrormsg(
557  * 'ccode2hvgrp should not be used for code # He ~Fe',0)
558  endif
559  end
560  subroutine ccode2mass(code, mass)
561  implicit none
562 #include "Zcode.h"
563 #include "Zheavyp.h"
564 #include "Zmass.h"
565  integer code, hg
566  real*8 mass
567  if(code .ge. kalfa .and. code .le. kiron) then
568  hg = code2heavyg(code)
569  mass = heavyg2massn(hg) * (masp+masn)/2
570  else
571  call cerrormsg(
572  * 'ccode2mass should not be used for code # He ~Fe',0)
573  endif
574  end
575 
576 
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
subroutine chg2charge(hg, charge)
Definition: cheavyInt.f:542
subroutine chg2massn(hg, massnum)
Definition: cheavyInt.f:535
subroutine csampfragpt(aPtcl, pt)
Definition: cheavyInt.f:469
subroutine kfrge(x, intvx, n, c, m, icon)
Definition: kfrge.f:33
max ptcl codes in the kgnuc
Definition: Zcode.h:2
subroutine kbinom(p, n, nb)
Definition: kbinom.f:26
masn
Definition: Zmass.h:5
subroutine cheavyint(pj, ia, iz, a, ntp)
Definition: cheavyInt.f:16
subroutine csampfragments(pj, ia,
Definition: cheavyInt.f:219
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 cmakefragtbl
Definition: cheavyInt.f:507
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kalfa
Definition: cblkHeavy.h:7
subroutine rndc(u)
Definition: rnd.f:91
max ptcl codes in the kseethru ! subcode integer regptcl
Definition: Zcode.h:2
subroutine ccode2hvgrp(code, hg)
Definition: cheavyInt.f:549
subroutine caveintenuc(pj, tgtMassN, avn)
Definition: caveInteNuc.f:13
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
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code knuc
Definition: cblkHeavy.h:7
subroutine ccode2mass(code, mass)
Definition: cheavyInt.f:561
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
subroutine kcossn(cs, sn)
Definition: kcossn.f:13
const int maxheavyg
Definition: Zcode.h:62
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
subroutine cmkptc(code, subcode, charge, p)
Definition: cmkptc.f:15
masp
Definition: Zmass.h:5
const int maxheavymassn
Definition: Zcode.h:60
subroutine csampfragmom(a, nf)
Definition: cheavyInt.f:427
Definition: Zptcl.h:75
subroutine cresetnucchg(nuc, noOfNuc, z)
Definition: cheavyInt.f:361
subroutine csampintenuc(pj, ia, noOfNuc, noOfInteNuc)
Definition: cheavyInt.f:392