COSMOS v7.655  COSMOSv7655
(AirShowerMC)
Gencol4.f
Go to the documentation of this file.
1 #include "Zintmodel.h"
2 #include "ZcosmosBD.h"
3  implicit none
4 #include "Zcode.h"
5 #include "Zptcl.h"
6 #include "Ztrackp.h"
7  include "Zprivate.h"
8 
9  integer i, nev, j, ntp, eof, ntpout
10  type(ptcl):: w(maxn)
11 ! write(*,*) ' this is dummy'
12  integer,save:: Jdecay(klast)
13 !///////////
14 ! real(8),save:: tau=0.3e-10 ! ATLAS standard
15 ! real(8),save:: tau=0.95e-10 ! k0s decay
16  real(8),save:: tau=0.
17  jdecay(:) = 0
18 ! make Jdecay non zero to see if it is needed to decay,if
19 ! the life is < tau.
20 ! data jcode/kbomega, kdmes, keta, kgzai, klambda, klambdac,
21 ! * kpion, ksigma, kkaon/
22 ! kpion--> pi0 (pi+/- is never decayed)
23 ! kkaon--> k0s (only k0s is examined)
24  jdecay(kbomega) = 1
25  jdecay(kdmes) = 1
26  jdecay(kgzai) = 1
27  jdecay(klambda) = 1
28  jdecay(klambdac) = 1
29  jdecay(ksigma) = 1
30  jdecay(kkaon) = 1
31  jdecay(keta) = 1
32  jdecay(krho) = 1
33  jdecay(kphi) = 1
34  jdecay(komega) = 1
35  jdecay(kpion) = 1
36 !////////////
37  call init
38  do j = 1, nevent
39  if(inpfileno .gt. 0) then
40  call readinpfile(eof)
41  if(eof .eq. 1) then
42  write(0,*)
43  * ' number of events generated is ',j-1
44  goto 100
45  endif
46  call formpjtg(0)
47  endif
48  call gencol(w, ntp)
49 !//////////
50  ntpout = 0
51  do while ( ntp /= ntpout)
52  call cmydecay(jdecay, tau, w, ntp, ntpout)
53  ntp = ntpout
54  enddo
55 !////////////
56  call cutbyangle(w, ntp, ntp)
57  call sortbyke(w, ntp) ! sort by kinetic energy
58  if(trace .gt. 0) then
59  call outtrace(j, w, ntp)
60  endif
61  call outresul(w, ntp)
62  enddo
63  write(0,*)
64  * ' number of events generated is ',nevent
65  100 continue
66  end
67 
68  subroutine init
69  implicit none
70 #include "Zptcl.h"
71 #include "Zcode.h"
72 #include "Zevhnp.h"
73 #include "Zevhnv.h"
74 #include "Zmass.h"
75 #include "Zmanager.h"
76 #include "Zmanagerp.h"
77 #include "Ztrackp.h"
78 
79  include "Zprivate.h"
80  character*200 input, file
81  character*20 uid
82  integer klena, icon, eof
83 
84  external cblkmanager
85  external cblkevhnp
86 
87  call creadparam(5)
88  if(tracedir .eq. ' ') then
89  call cgetloginn(uid)
90  tracedir = '/tmp/'//uid(1:klena(uid))
91  endif
92 
93  if(desteventno(2) .eq. 0) then
94  nevent =abs( desteventno(1) )
95  else
96  nevent = abs( desteventno(2) )
97  endif
98  call cmkseed(initrn(1), initrn)
99  call rnd1i(initrn) ! random number init.
100  call cquhookr(1, wzmin)
101  call cquhookr(2, wzmax)
102  call cquhookr(3, trackl)
103  call cquhooki(1, outzero)
104 !
105 ! make projectile going +z
106  call cquhookc(1, input)
107 
108  if(input(1:4) .eq. "file") then
109  read(input(5:10), *) inpfileno
110  xyz=index(input, "xyz")
111  call cquhookc(2, input)
112 
113  file = ' '
114  file=input(1:klena(input))
115 
116  call copenfw2(inpfileno, file, 1, icon)
117  if(icon .ne. 1) then
118  write(0,*)
119  * ' file=', file, ' cannot be opened in Gencol'
120  stop 9999
121  endif
122  call readinpfile(eof)
123 ! once rewind to read successively for event generation
124  rewind inpfileno
125  else
126  inpfileno=0
127  read(input, *)
128  * pjcode, pjsub, pjchg, pjpx, pjpy, pjpz
129  call cquhookc(2, input)
130  read(input, *)
131  * tgcode, tgsub, tgchg, tgpx, tgpy, tgpz
132  call cquhookc(3, input)
133  if(input .ne. ' ') then
134  read(input, *) xpos, ypos, zpos
135  xyz = 1
136  else
137  xyz = 0
138  endif
139  endif
140 
141  call formpjtg(1)
142 
143  call cfixprefix('configDummy')
144  call csetcosorepi('epics')
145  if( index( intmodel,'qgsjet1') .ne. 0 ) then
146 #ifdef QGSJET1
147  call qgs01init
148  activemdl = 'qgsjet1'
149 #else
150  write(0,*) 'to use qgsjet1, define it in Zintmodel%h'
151 #endif
152  elseif(index(intmodel, 'sibyll') .ne. 0 ) then
153 #ifdef SIBYLL
154  call sibyllinit
155  activemdl = 'sibyll'
156 #else
157  write(0,*) 'to use sibyll, define it in Zintmodel%h'
158 #endif
159  else
160  call cintmodels('epics')
161  call cfixmodel( plab )
162  endif
163 
164  write(0, *) 'Active int. model=',activemdl
165  write(0, *) ' equiv. lab E=', plab%fm%p(4)
166  if(xyz .eq. 0) then
167 ! write(*, '(a)') '# mulsubKEdir user '
168  else
169 ! write(*, '(a)') '# mulsubKExyzdir user '
170  endif
171 ! write(*, '(a)') '#--------------------------------'
172  end
173  subroutine readinpfile(eof)
174  implicit none
175 #include "Zptcl.h"
176  include "Zprivate.h"
177 
178  integer eof ! output . data read--> 0
179  ! eof reached --> 1
180  read(inpfileno,*, end=100)
181  * pjcode, pjsub, pjchg, pjpx, pjpy, pjpz
182  read(inpfileno,*, end=100)
183  * tgcode, tgsub, tgchg, tgpx, tgpy, tgpz
184  if(xyz .gt. 0 ) then
185  read(inpfileno,*, end=100) xpos, ypos, zpos
186  endif
187  eof = 0
188  return
189  100 continue
190  eof = 1
191  end
192 ! *******************
193  subroutine formpjtg(confirm)
194 ! ******************
195  implicit none
196 #include "Zptcl.h"
197 #include "Zcode.h"
198 #include "Zevhnp.h"
199 #include "Zevhnv.h"
200 #include "Zmass.h"
201 #include "Zmanager.h"
202 #include "Zmanagerp.h"
203 #include "Ztrackp.h"
204 
205  include "Zprivate.h"
206 
207  integer confirm ! input. if 0, root s is not printed.
208  ! else printed
209  real*8 roots, s
210 ! form projectile and target
211 
212  call cmkptc(pjcode, pjsub, pjchg, pj)
213 
214  if(pjcode .ne. kgnuc) then
215  pjmnum = 1
216  else
217  pjmnum = pjsub
218  endif
219  pj%fm%p(1) = pjpx*pjmnum
220  pj%fm%p(2) = pjpy*pjmnum
221  pj%fm%p(3) = pjpz*pjmnum
222  pj%fm%p(4) =
223  * sqrt(pj%fm%p(1)**2 + pj%fm%p(2)**2 + pj%fm%p(3)**2
224  * + pj%mass**2)
225 
226 ! make taget (rest of moving -z)
227  call cmkptc(tgcode, tgsub, tgchg, tg)
228  if(tgcode .ne. kgnuc) then
229  tgmnum = 1
230  else
231  tgmnum = tgsub
232  endif
233  tg%fm%p(1) = tgpx*tgmnum
234  tg%fm%p(2) = tgpy*tgmnum
235  tg%fm%p(3) = tgpz*tgmnum
236  tg%fm%p(4) =
237  * sqrt(tg%fm%p(1)**2 + tg%fm%p(2)**2 + tg%fm%p(3)**2
238  * + tg%mass**2)
239 !
240  if(tgpx .eq. 0. .and. tgpy .eq. 0. .and.
241  * tgpz .eq. 0.) then
242 ! target is at rest;
243  s= 2*pj%fm%p(4)*tg%mass +tg%mass**2 + pj%mass**2
244  else
245 ! by general formula
246  s = (pj%fm%p(4)+tg%fm%p(4))**2 -
247  * (pjpx+tgpx)**2 + (pjpy+tgpy)**2+(pjpz+tgpz)**2
248  endif
249  roots = sqrt(s)
250  if(confirm .ne. 0) then
251  write(0, *) ' roots/2=', roots/2
252  endif
253 !c boost to target rest system
254  call cbst1(1, tg, pj, plab)
255  end
256 ! ************************
257  subroutine outresul(a, ntp)
258  implicit none
259 #include "Zptcl.h"
260 #include "Zcode.h"
261 #include "Zevhnp.h"
262 #include "Zevhnv.h"
263 #include "Zmass.h"
264 #include "Zmanagerp.h"
265 #include "Zmanager.h"
266 #include "Ztrackp.h"
267  include "Zprivate.h"
268 ! general process information; only for dpmjet3
269  INTEGER IPROCE,IDNODF,IDIFR1,IDIFR2,IDDPOM,IPRON
270  COMMON /poprcs/ iproce,idnodf,idifr1,idifr2,iddpom,ipron(15,4)
271 ! IPROCE
272 ! 1 non-diffractive inelastic
273 ! 2 elestic
274 ! 3 quasi elestic vector meson prod. (photon)
275 ! 4 central diffraction
276 ! 5 single diff. ptcl 1
277 ! 6 // ptcl 2
278 ! 7 double diff.
279 ! 8 direct photo-hadron
280 ! For moore detail, see manual in Documents/CosmicRays/phojetShort.pdf
281 ! say, IDIFR1 classifies IPROCE=5
282 
283  integer ntp
284  type(ptcl):: a(ntp)
285  integer i, j
286 
287  real*8 p, wx, wy, wz, pt, y, eta
288  integer npzm, npzp, Ncht, Nchpzm, Nchpzp
289  integer nw, diffcode(20)
290 !//////////////
291  integer icon
292  type(ptcl):: pcms, pl
293  type(fmom):: gc
294  real(8),save:: dist=141.2e2
295  real(8)::xd, yd
296 
297  npzm = 0
298  npzp = 0
299  nchpzm = 0
300  nchpzp = 0
301 
302  do j = 1, ntp
303  i = indx(j)
304 ! pt = sqrt( a(i).fm.p(1)**2 + a(i).fm.p(2)**2)
305 ! p= sqrt( pt**2 + a(i).fm.p(3)**2 )
306  if( a(i)%fm%p(3) .gt. 0.) then
307  npzp = npzp + 1
308  if(a(i)%charge .ne. 0) then
309  nchpzp = nchpzp +1
310  endif
311  else
312  npzm = npzm + 1
313  if(a(i)%charge .ne. 0) then
314  nchpzm = nchpzm + 1
315  endif
316  endif
317  enddo
318  ncht = nchpzm + nchpzp
319  call getdiffcode(nw, diffcode)
320 ! write(*,'("h ",i3, 6i6)' )
321 ! * diffcode(1), ntp, npzm, npzp, Ncht, Nchpzm, Nchpzp
322 !////////
323 ! call cgetcm(tg, plab, gc, icon)
324 ! write(0,*) ' gcbeta=', gc
325 !//////////////////
326 
327  do j = 1, ntp
328  i = indx(j)
329  pt = sqrt( a(i)%fm%p(1)**2 + a(i)%fm%p(2)**2)
330  p= sqrt( pt**2 + a(i)%fm%p(3)**2 )
331 !
332  wx = a(i)%fm%p(1)/p
333  wy = a(i)%fm%p(2)/p
334  wz = a(i)%fm%p(3)/p
335 ! if(xyz .eq. 0) then
336  if(a(i)%charge /= 0) cycle
337  xd = dist*wx
338  yd = dist*wy
339  if( abs(xd) > 10.) cycle
340  if( abs(yd) > 10.) cycle
341  if( wz < 0. ) then
342  xd = -xd
343  yd = -yd
344  endif
345  write(*,'(3i3, 1p, g14.5, 0p, 2f7.2)')
346  * a(i)%code, a(i)%subcode, a(i)%charge,
347  * a(i)%fm%p(4), xd, yd
348 ! else
349 ! write(*,'(3i3,g14.5,1p3E11.3,0p3f17.13, i5)')
350 ! * a(i).code, a(i).subcode, a(i).charge,
351 ! * a(i).fm.p(4)-a(i).mass, xpos, ypos, zpos,
352 ! * wx, wy, wz, j
353 !
354 ! endif
355 ! call cyeta(a(i), y, eta)
356 !/////////////
357 ! call clorez(gc, a(i), pl)
358 ! write(*,'(2i4, 1p, g13.4, 0p, f10.4, 1p,6g13.4)')
359 ! * a(i).code, a(i).charge, pt, eta, pl.fm.p(4)-pl.mass,
360 ! * a(i).fm.p(1:4)
361 !//////////////////
362 ! write(*,'(2i4, 1p, g13.4, 0p, f10.4,1p, g13.4)')
363 ! * a(i).code, a(i).charge, pt, eta, a(i).fm.p(4)
364  enddo
365 ! if(ntp .gt. 0 .or. outzero .eq. 0) then
366 ! write(*, *)
367 ! endif
368  end
369  subroutine gencol(a, ntp)
370  implicit none
371 #include "Zptcl.h"
372 #include "Zcode.h"
373 #include "Zevhnv.h"
374 #include "Zevhnp.h"
375 #include "Zmanagerp.h"
376  include "Zprivate.h"
377  type(ptcl):: a(*)
378 ! projectile and target information (both befor
379 ! and after collision ) in different system.
380 !
381  integer ntp
382  integer j
383  integer tZ, tA
384  real*8 xs
385 !
386  if( tg%code .eq. knuc ) then
387  ta = 1
388  elseif( tg%code .eq. kgnuc ) then
389  ta = tg%subcode
390  else
391  write(0,*) ' target code=', tg%code, 'invalid'
392  stop 9999
393  endif
394  tz = tg%charge
395 
396 #ifdef QGSJET1
397  if(activemdl .eq. 'qgsjet1') then
398  call qgs01event(plab, ta, tz, a, ntp)
399  endif
400 #elif defined SIBYLL
401  if(activemdl .eq. 'sibyll') then
402  call sibyllevent(plab, ta, tz, a, ntp)
403  endif
404 #else
405  if(activemdl .eq. 'qgsjet2' ) then
406  call cxsecqgs(plab, ta, xs)
407  endif
408  call chacol(plab, ta, tz, a, ntp)
409 #endif
410  do j = 1, ntp
411 ! boost to target mooving system
412  call cibst1(j, tg, a(j), a(j))
413  enddo
414  end
415 
416 
417  subroutine cutbyangle(a, ntp0, ntp)
418  implicit none
419 #include "Zptcl.h"
420 #include "Zcode.h"
421 #include "Zevhnv.h"
422 #include "Zevhnp.h"
423 #include "Zmanagerp.h"
424  include "Zprivate.h"
425  type(ptcl):: a(*)
426  integer ntp0 ! input. number of ptcls. in a
427  integer ntp ! output. could be the same as ntp0
428  integer j
429  integer i
430  real*8 p, wz
431  j = 0
432  do i = 1, ntp0
433  p = a(i)%fm%p(1)**2 + a(i)%fm%p(2)**2 +
434  * a(i)%fm%p(3)**2
435  p = sqrt(p)
436  wz = a(i)%fm%p(3)/p
437  if( wz .ge. wzmin .and. wz .le. wzmax ) then
438  j = j + 1
439  a(j)=a(i)
440  endif
441  enddo
442  ntp = j
443  end
444  subroutine sortbyke(a, ntp)
445  implicit none
446 #include "Zptcl.h"
447 #include "Zcode.h"
448 
449  include "Zprivate.h"
450  integer ntp
451  type(ptcl):: a(*)
452 ! projectile and target information (both befor
453 ! and after collision ) in different system.
454 !
455 
456  integer i
457  do i = 1, ntp
458  ke(i) = a(i)%fm%p(4) - a(i)%mass
459  enddo
460  call kqsortd(ke, indx, ntp)
461  call ksortinv(indx, ntp)
462 ! ke( indx(1) ) is the highest energy
463  end
464  subroutine outtrace(nev, a, ntp)
465  implicit none
466 #include "Zptcl.h"
467 #include "Zcode.h"
468 #include "Zevhnp.h"
469 #include "Zevhnv.h"
470 #include "Zmass.h"
471 #include "Zmanagerp.h"
472 #include "Zmanager.h"
473 #include "Ztrackp.h"
474  include "Zprivate.h"
475 
476  integer ntp, nev
477  type(ptcl):: a(ntp)
478  integer i, j, leng, icon, klena
479  real*8 p, wx, wy, wz
480  real x1, y1, z1, x2, y2, z2
481  character*100 tracefile
482 
483  write(tracefile, *) tracedir(1:klena(tracedir))//'/trace', nev
484  call kseblk(tracefile, ' ', leng)
485  call copenfw(tracedev, tracefile(1:leng), icon)
486  if(icon .ne. 0) then
487  call cerrormsg('tracefile could not be opened',0)
488  endif
489  do j = 1, ntp
490  i = indx(j)
491  p= sqrt( a(i)%fm%p(1)**2 + a(i)%fm%p(2)**2
492  * + a(i)%fm%p(3)**2 )
493  wx = a(i)%fm%p(1)/p
494  wy = a(i)%fm%p(2)/p
495  wz = a(i)%fm%p(3)/p
496  if(xyz .eq. 0) then
497  x1 = 0.
498  y1 = 0.
499  z1 = 0.
500  else
501  x1 = xpos
502  y1 = ypos
503  z1 = zpos
504  endif
505  x2 = x1 + wx*trackl
506  y2 = y1 + wy*trackl
507  z2 = z1 + wz*trackl
508  write(tracedev,'(3g14.5, i3, g14.4, i3, i2)')
509  * x1, y1, z1,
510  * a(i)%code, a(i)%fm%p(4) - a(i)%mass, a(i)%charge,
511  * 0
512  write(tracedev, '(3g14.5, i3, g14.4, i3, g14.4)' )
513  * x2, y2, z2,
514  * a(i)%code, a(i)%fm%p(4) - a(i)%mass, a(i)%charge,
515  * trackl
516  write(tracedev, *)
517  write(tracedev, *)
518  enddo
519  close(tracedev)
520  end
521 
subroutine cmkseed(dummy, seed)
Definition: cmkSeed.f:3
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
subroutine csetcosorepi(from)
Definition: cintModels.f:252
subroutine sortbyke(a, ntp)
Definition: Gencol.f:754
integer maxn LabEquivE real outresul integer pjchg integer tgchg integer xyz real pjpz real tgpy
Definition: Zprivate.h:8
max ptcl codes in the kgzai
Definition: Zcode.h:2
subroutine cbst1(init, p1, p2, po)
Definition: cbst1.f:54
integer maxn LabEquivE real outresul integer pjchg integer tgchg integer inpfileno
Definition: Zprivate.h:8
max ptcl codes in the kdmes
Definition: Zcode.h:2
max ptcl codes in the kgnuc
Definition: Zcode.h:2
subroutine cintmodels(from)
Definition: cintModels.f:3
subroutine cfixmodel(aPtcl)
Definition: cfixModel.f:2
max ptcl codes in the kphi
Definition: Zcode.h:2
latitude latitude this system is used *****************************************************************! type coord sequence union map real z z in m endmap xyz map real ! latitude in deg is to the north ! longitude in deg is to the east *h ! height in m endmap llh map real ! polar angle ! azimuthal angle *radius ! radial distance endmap sph endunion character *sys ! which system xyz
Definition: Zcoord.h:25
max ptcl codes in the klambdac
Definition: Zcode.h:2
max ptcl codes in the kkaon
Definition: Zcode.h:2
subroutine cibst1(init, p1, p2, po)
Definition: cibst1.f:29
subroutine readinpfile(eof)
Definition: Gencol.f:422
integer maxn LabEquivE real outresul integer pjcode
Definition: Zprivate.h:8
subroutine outtrace(nev, a, ntp)
Definition: Gencol.f:772
subroutine cmydecay(Jdecay, tau, a, nin, nout)
Definition: cmydecay.f:4
subroutine qgs01init
Definition: qgs01init.f:2
max ptcl codes in the komega
Definition: Zcode.h:2
Definition: Zptcl.h:72
integer maxn wzmax
Definition: Zprivate.h:3
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
subroutine copenfw2(io, fnin, form, icon)
Definition: copenf.f:205
subroutine getdiffcode(nw, difcode)
Definition: getDiffCode.f:3
subroutine kqsortd(A, ORD, N)
Definition: kqsortd.f:23
subroutine cquhookr(i, rv)
Definition: cqUHookr.f:2
integer maxn LabEquivE real outresul integer pjchg integer tgcode
Definition: Zprivate.h:8
subroutine init
Definition: Gencol.f:62
subroutine ksortinv(idx, n)
Definition: ksortinv.f:2
subroutine creadparam(io)
Definition: creadParam.f:5
max ptcl codes in the klambda
Definition: Zcode.h:2
integer maxn LabEquivE real outresul integer pjchg integer tgsub
Definition: Zprivate.h:8
subroutine gencol(a, ntp)
Definition: Gencol.f:585
integer maxn LabEquivE real outresul integer pjchg integer tgchg integer xyz real pjpz real * tgpx
Definition: Zprivate.h:8
integer maxn LabEquivE real * ke(maxn) integer indx(maxn) integer nevent integer outzero
integer maxn trackl
Definition: Zprivate.h:3
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code knuc
Definition: cblkHeavy.h:7
max ptcl codes in the krho
Definition: Zcode.h:2
subroutine cfixprefix(dsn)
Definition: cintModels.f:209
integer maxn LabEquivE real outresul integer pjchg integer tgchg integer xyz real pjpy
Definition: Zprivate.h:8
nodes a
subroutine formpjtg(confirm)
Definition: Gencol.f:443
subroutine copenfw(io, fnin, icon)
Definition: copenf.f:122
subroutine cutbyangle(a, ntp0, ntp)
Definition: Gencol.f:727
subroutine cquhooki(i, iv)
Definition: cqUHookr.f:15
subroutine cmkptc(code, subcode, charge, p)
Definition: cmkptc.f:15
max ptcl codes in the keta
Definition: Zcode.h:2
subroutine outresul(a, ntp)
Definition: Gencol0.f:229
integer maxn LabEquivE real outresul integer pjsub
Definition: Zprivate.h:8
subroutine cquhookc(i, cv)
Definition: cqUHookr.f:28
max ptcl codes in the klast
Definition: Zcode.h:2
Definition: Zptcl.h:75
max ptcl codes in the kpion
Definition: Zcode.h:2
integer maxn LabEquivE real outresul integer pjchg integer tgchg integer xyz real * pjpx
Definition: Zprivate.h:8
max ptcl codes in the ksigma
Definition: Zcode.h:2
subroutine chacol(pj, ia, iz, a, ntp)
Definition: chAcol.f:3
subroutine kseblk(text, c, lc)
Definition: kseblk.f:18
max ptcl codes in the kbomega
Definition: Zcode.h:2
subroutine cgetloginn(userid)
Definition: cgetLoginN.f:29