COSMOS v7.655  COSMOSv7655
(AirShowerMC)
Gencol.f
Go to the documentation of this file.
1 #include "Zintmodel.h"
2 
3 #ifdef MODIFYX
4 #include "csoftenPiK.f"
5 #endif
6 
7 #include "ZcosmosBD.h"
8 #ifdef MODIFYX
10 #endif
11  implicit none
12 #include "Zptcl.h"
13 #include "Ztrackp.h"
14 #include "Zevhnp.h"
15 
16  include "Zprivate.h"
17 
18  integer i, nev, j, ntp, eof, ntpo
19  type(ptcl):: w(maxn)
20 
21  call init
22  do j = 1, nevent
23  if(inpfileno .gt. 0) then
24  call readinpfile(eof)
25  if(eof .eq. 1) then
26  write(0,*)
27  * ' number of events generated is ',j-1
28  goto 100
29  endif
30  call formpjtg(0)
31  endif
32  call gencol(w, ntp)
33 #ifdef MODIFYX
34 ! in cms we work
35  call csoftenfe(pj, fwbw, w, ntp, ntpo)
36  ntp = ntpo
37 #endif
38  call cutbyangle(w, ntp, ntpo)
39  ntp = ntpo
40  call sortbyke(w, ntp) ! sort by kinetic energy
41  if(trace .gt. 0) then
42  call outtrace(j, w, ntp)
43  endif
44  if(outresul == 0 ) then
45  call outresula(w, ntp)
46  elseif(outresul == 1 ) then
47  call outresulb(w, ntp)
48  elseif(outresul == 2 ) then
49  call outresulc(w, ntp)
50  elseif(outresul == 3 ) then
51  call outresulx(w, ntp)
52  endif
53  enddo
54  write(0,*)
55  * ' number of events generated is ',nevent
56  100 continue
57  write(0,*)
58  * "Equivalent Lab. Energy was ", labequive," GeV/n"
59  end
60 
61  subroutine init
62  implicit none
63 #include "Zptcl.h"
64 #include "Zcode.h"
65 #include "Zevhnp.h"
66 #include "Zevhnv.h"
67 #include "Zmass.h"
68 #include "Zmanager.h"
69 #include "Zmanagerp.h"
70 #include "Ztrackp.h"
71 
72  include "Zprivate.h"
73  character*200 input, file
74  character*20 uid
75  integer klena, icon, eof
76 
77  external cblkmanager
78  external cblkevhnp
79 
80  call creadparam(5)
81 
82 
83  if(tracedir .eq. ' ') then
84  call cgetloginn(uid)
85  tracedir = '/tmp/'//uid(1:klena(uid))
86  endif
87 
88  if(desteventno(2) .eq. 0) then
89  nevent =abs( desteventno(1) )
90  else
91  nevent = abs( desteventno(2) )
92  endif
93  call cmkseed(initrn(1), initrn)
94  call rnd1i(initrn) ! random number init.
95  call cquhookr(1, wzmin)
96  call cquhookr(2, wzmax)
97  write(0,*) ' cos* min max=', wzmin, wzmax
98  call cquhookr(3, trackl)
99  call cquhooki(1, outzero)
100  call cquhooki(2, outresul)
101 ! make projectile going +z
102  call cquhookc(1, input)
103  if(input(1:4) .eq. "file") then
104  read(input(5:10), *) inpfileno
105  xyz=index(input, "xyz")
106  call cquhookc(2, input)
107  file = ' '
108  file=input(1:klena(input))
109  call copenfw2(inpfileno, file, 1, icon)
110  if(icon .ne. 1) then
111  write(0,*)
112  * ' file=', file, ' cannot be opened in Gencol'
113  stop 9999
114  endif
115  call readinpfile(eof)
116 ! once rewind to read successively for event generation
117  rewind inpfileno
118  else
119  inpfileno=0
120  read(input, *)
121  * pjcode, pjsub, pjchg, pjpx, pjpy, pjpz ! proj. mom/n
122  call cquhookc(2, input)
123  input = trim(input)//" /"
124  read(input, *)
125  * tgcode, tgsub, tgchg, tgpx, tgpy, tgpz, targetname ! target. mom/n
126  call cquhookc(3, input)
127  if(input .ne. ' ') then
128 ! read(input, *) xpos, ypos, zpos
129  read(input, *) xpos(1:3)
130  xyz = 1
131  else
132  xyz = 0
133  endif
134  endif
135  call formpjtg(1) ! form proj. and target
136  call cfixprefix('configDummy')
137  call csetcosorepi('gencol') ! this is probably not used
138 
139 
140  if( index( intmodel,'qgsjet1') .ne. 0 ) then
141 #ifdef QGSJET1
142  call qgs01init
143  activemdl = 'qgsjet1'
144 #else
145  write(0,*) 'to use qgsjet1, define it in Zintmodel.h'
146 #endif
147 ! elseif(index (IntModel, 'sibyll') .ne. 0 ) then
148 ! call csibyllinit
149 ! ActiveMdl = 'sibyll'
150  else
151  call cintmodels('gencol')
152  call cfixmodel( plab )
153  endif
154 
155  write(0, *) 'Active int. model=',activemdl
156 
157  if( plab%code == kgnuc ) then
158  labequive= plab%fm%p(4)/plab%subcode
159  else
160  labequive=plab%fm%p(4)
161  endif
162  if( activemdl == "dpmjet3" ) then
163  call checkenergy
164  call checkptcls
165  endif
166 ! for muon N.I, we must read mutab for which we must read
167 ! all elemag table too.
168  if(pj%code == kmuon ) then
169 !c call epReadMediaForMuon !////////////
170  endif
171  end
172  subroutine epreadmediaformuon
173 #include "Zcode.h"
174 #include "Zptcl.h"
175 
176  include "Zprivate.h"
177  integer icon
178 
179  if( targetname /= " " ) then
180  mediano = 1
181 !ccc call eprdMFile(targetName, icon) !!////////////
182  if( icon /= 0 ) then
183  write(0,*) " targetName =", targetname
184  write(0,*) " not acceptable "
185  stop
186  endif
187  else
188  write(0,*) " projectile code =", plab%code, "= muon"
189  write(0,*) " In this case, media name of the target must"
190  write(0,*) " follow the target partcile momentum, e.g,"
191  write(0,*) " UserHookc = '1 -1 0 0. 0 500',"
192  write(0,*) " '9 16 8 0 0 0. LiqO2',"
193  write(0,*) " "
194  stop
195  endif
196  end
197 
198 
199  subroutine checkenergy
200  implicit none
201 #include "Zptcl.h"
202 #include "Zprivate.h"
203 #include "Zcode.h"
204  integer icon
205 
206  character(80):: input
207  character(8):: bb(3)
208  integer:: nr
209  real(8):: Einput
210 
211  if( pj%code == kphoton ) then
212  if( tg%code == kgnuc ) then
213  if( pj%fm%p(4) < 7. ) then
214  write(0,*)
215  * 'photon E must be >= 7 for A target'
216  stop
217  endif
218  else
219  if( pj%fm%p(4) < 6. ) then
220  write(0,*)
221  * 'photon E must be >= 6 for non-A target'
222  stop
223  endif
224  endif
225  endif
226 
227  call copenf(11, "dpmjet.inp", icon)
228  if(icon /= 0 ) then
229  write(0,*) ' dpmjet.inp cannot be opened'
230  stop
231  endif
232  do while(.true.)
233  read(11,'(a)') input
234  call ksplit(input,8, 3, bb, nr)
235  if( bb(1) == "ENERGY") then
236  read(bb(2),*) einput
237  write(0,*) "ENERGY in dpmjet.inp =", einput
238  if( einput < labequive) then
239  write(0,*) " is too small; give a value"
240  write(0,*) "little bit larger than ",labequive
241  write(0,*) " if taget is A, ~1.5 % "
242  write(0,*) " if taget is p/n, very little"
243  write(0,*)
244  * "E.g ",labequive*1.001, " with ~ 4 digit accuracy"
245  stop
246 ! elseif( Einput > LabEquivE*1.002 ) then
247  elseif( tg%code == kgnuc .and.
248  * einput > labequive*1.040 ) then
249  write(0,*) " is too large; give a vlaue"
250  write(0,*) "little bit larger than ",labequive
251  write(0,*)
252  * "E%g ",labequive*1.03, " with ~ 4 digit accuracy"
253  stop
254  elseif( tg%code /= kgnuc .and.
255  * einput > labequive*1.002 ) then
256  write(0,*) " is too large; give a vlaue"
257  write(0,*) "little bit larger than ",labequive
258  write(0,*)
259  * "E%g ",labequive*1.001, " with ~ 4 digit accuracy"
260  stop
261  else
262  write(0,*) " is close to ", labequive, " and OK"
263  endif
264  close(11)
265  exit
266  endif
267  enddo
268  end
269 
270  subroutine checkptcls
271 ! check projectile and target ;
272 ! Are they same in param and dpmjet.inp ?
273  implicit none
274 #include "Zptcl.h"
275 #include "Zprivate.h"
276 #include "Zcode.h"
277  integer icon
278 
279  character(80):: input
280  character(8):: bb(5)
281  integer:: nr
282  character(8)::btype
283  integer code, subc, charge
284 
285  call copenf(11, "dpmjet.inp", icon)
286  if(icon /= 0 ) then
287  write(0,*) ' dpmjet.inp cannot be opened'
288  stop
289  endif
290  do while(.true.)
291  read(11,'(a)', end=100) input
292  call ksplit(input,8, 5, bb, nr)
293 
294  if( bb(1) == "PROJPAR") then
295  if( nr == 2 ) then
296  btype=bb(2)
297  call cbtype2cos(btype, code, subc, charge)
298  if( code /= pj%code .or. charge /= pj%charge ) then
299  ! subcode not checked
300  write(0,*)
301  * ' projectile mismatch bw dpmjet.inp and param'
302  write(0,*) ' dpmjet.inp :', btype
303  write(0,*) ' param: ', pj%code, pj%charge
304  stop
305  endif
306  elseif( nr == 3 ) then
307  read( bb(2), *) subc
308  read( bb(3), *) charge
309  if( subc > 1 ) then
310  if( subc /= pj%subcode .or. charge /= pj%charge ) then
311  write(0,*) 'proj mismatch bw dpmjet.inp and param'
312  stop
313  endif
314  else
315  if( pj%code /= knuc .and. charge /= pj%charge ) then
316  write(0,*) 'proj mismatch bw dpmjet.inp and param'
317  stop
318  endif
319  endif
320  endif
321  elseif(bb(1) == "TARGETPAR") then
322  if( nr == 2 ) then
323  btype=bb(2)
324  call cbtype2cos(btype, code, subc, charge)
325  if( code /= tg%code .or. charge /= tg%charge ) then
326  ! subcode not checked
327  write(0,*)
328  * ' target mismatch bw dpmjet.inp and param'
329  write(0,*) ' dpmjet.inp :', btype
330  write(0,*) ' param: ', tg%code, tg%charge
331  stop
332  endif
333  elseif( nr == 3 ) then
334  read( bb(2), *) subc
335  read( bb(3), *) charge
336  if( subc > 1 ) then
337  if( subc /= tg%subcode .or. charge /= tg%charge ) then
338  write(0,*)
339  * 'target mismatch bw dpmjet.inp and param'
340  stop
341  endif
342  else
343  if( tg%code /= knuc .and. charge /= tg%charge ) then
344  write(0,*)
345  * 'target mismatch bw dpmjet.inp and param'
346  stop
347  endif
348  endif
349  endif
350  endif
351  enddo
352  100 continue
353  close(11)
354  write(0,*)
355  * ' proj targ consistency btw dpmjet.inp and param: OK'
356  end
357  subroutine cbtype2cos(btype, code, subc, charge)
358  implicit none
359 #include "Zcode.h"
360  character(8),intent(in):: btype
361  integer,intent(out):: code, subc, charge
362 
363  select case(btype)
364  case("PROTON")
365  code = knuc
366  charge = 1
367  subc = -1
368  case("APROTON")
369  code = knuc
370  charge = -1
371  subc = 1
372  case("PHOTON")
373  code = kphoton
374  charge = 0
375  subc = 0
376  case("NEUTRON")
377  code = knuc
378  charge = 0
379  subc = -1
380  case("ANEUTRON")
381  code = knuc
382  charge = 0
383  subc = 1
384  case("PION+")
385  code = kpion
386  charge = 1
387  subc = -1
388  case("PION-")
389  code = kpion
390  charge = -1
391  subc = 1
392  case("KAON+")
393  code = kkaon
394  charge = 1
395  subc = -1
396  case("KAON-")
397  code = kkaon
398  charge = -1
399  subc = 1
400  case("LAMBDA")
401  code = klambda
402  charge = 0
403  subc = -1
404  case("ALAMBDA")
405  code = klambda
406  charge = 0
407  subc = 1
408  case("PIZERO")
409  code = kpion
410  charge = 0
411  subc = 0
412  case default
413  write(0,*) ' not acceptable ptcl=',btype
414  stop
415  end select
416 ! 'KAONSHRT' ,
417 ! &'SIGMA- ' , 'SIGMA+ ' , 'SIGMAZER' , 'PIZERO ' , 'KAONZERO' ,
418 ! &'AKAONZER'
419  end subroutine cbtype2cos
420 
421  subroutine readinpfile(eof)
422  implicit none
423 #include "Zptcl.h"
424  include "Zprivate.h"
425 
426  integer eof ! output . data read--> 0
427  ! eof reached --> 1
428  read(inpfileno,*, end=100)
429  * pjcode, pjsub, pjchg, pjpx, pjpy, pjpz
430  read(inpfileno,*, end=100)
431  * tgcode, tgsub, tgchg, tgpx, tgpy, tgpz
432  if(xyz .gt. 0 ) then
433 ! read(inpfileno,*, end=100) xpos, ypos, zpos
434  read(inpfileno,*, end=100) xpos(1:3)
435  endif
436  eof = 0
437  return
438  100 continue
439  eof = 1
440  end
441 ! *******************
442  subroutine formpjtg(confirm)
443 ! ******************
444  implicit none
445 #include "Zptcl.h"
446 #include "Zcode.h"
447 #include "Zevhnp.h"
448 #include "Zevhnv.h"
449 #include "Zmass.h"
450 #include "Zmanager.h"
451 #include "Zmanagerp.h"
452 #include "Ztrackp.h"
453 
454  include "Zprivate.h"
455  type(ptcl)::resttg, zcmsp, zplab
456  integer confirm ! input. if 0, root s is not printed.
457  ! else printed
458  real*8 roots, s
459 ! form projectile and target
460  integer::icon
461 
462  call cmkptc(pjcode, pjsub, pjchg, pj)
463 ! pjmnum: proj. mass number in integer
464  if(pjcode .ne. kgnuc) then
465  pjmnum = 1
466  else
467  pjmnum = pjsub
468  endif
469  pj%fm%p(1) = pjpx*pjmnum ! total mom.
470  pj%fm%p(2) = pjpy*pjmnum
471  pj%fm%p(3) = pjpz*pjmnum
472  pj%fm%p(4) =
473  * sqrt(pj%fm%p(1)**2 + pj%fm%p(2)**2 + pj%fm%p(3)**2
474  * + pj%mass**2)
475 
476 ! make taget (rest or moving -z or ...)
477  call cmkptc(tgcode, tgsub, tgchg, tg)
478  if(tgcode .ne. kgnuc) then
479  tgmnum = 1
480  else
481  tgmnum = tgsub
482  endif
483  tg%fm%p(1) = tgpx*tgmnum ! total mom.
484  tg%fm%p(2) = tgpy*tgmnum
485  tg%fm%p(3) = tgpz*tgmnum
486  tg%fm%p(4) =
487  * sqrt(tg%fm%p(1)**2 + tg%fm%p(2)**2 + tg%fm%p(3)**2
488  * + tg%mass**2)
489 !
490  if(tgpx .eq. 0. .and. tgpy .eq. 0. .and.
491  * tgpz .eq. 0.) then
492 ! target is at rest; s = (Ep+Et)^2 - (Pp+Pt)^2
493 ! = (Ep+Mt)^2 - Pp^2
494 ! = Mp^2 +2EpMt +Mt^2
495 !
496  s= 2*pj%fm%p(4)*tg%mass +tg%mass**2 + pj%mass**2
497  else
498 ! by general formula;
499 ! Mp^2 + Mt^2 +2(Ep*Et - Pp.Pt)
500  s = pj%mass**2 + tg%mass**2 +
501  * 2*(pj%fm%p(4)*tg%fm%p(4) -
502  * dot_product(pj%fm%p(1:3), tg%fm%p(1:3) ) )
503  endif
504  roots = sqrt(s)
505 ! if(confirm .ne. 0) then
506  write(0, *) ' roots/2=', roots/2
507  write(0, *) 's,roots above are total not by /n'
508 ! endif
509 !c boost to target rest system
510  call cbst1(1, tg, pj, plab)
511 ! make rest target
512  call cbst1(2, tg, tg, resttg)
513  ! get /n cms
514  call cgeqm2(plab, resttg, cmsp, icon)
515 !////////////
516  write(0,*) ' Cmsp= (/n)',cmsp%fm%p(:), cmsp%mass
517  write(0,*) ' plab=',plab%fm%p(4)
518  write(0,*) ' tg=', tg%fm%p(4)
519 !///////////
520  if(icon /= 0 ) then
521  write(0,*) ' input 2 ptcls cannot form CMS'
522  stop
523  endif
524 
525 ! Next part will be used only by EPOS
526 ! get equiv. CMS particle (Zcmsp) when projectile Pt is 0.
527 ! If crossing angle is /= 0, Cmsp and Zcmsp
528 ! differ and we must use Zcmsp here!!!!. 2016/01/24
529  zplab = plab
530  zplab%fm%p(1:2) = 0.
531  zplab%fm%p(3) = sqrt( zplab%fm%p(4)**2- zplab%mass**2)
532  ! get /n cms
533  call cgeqm2(zplab, resttg, zcmsp, icon)
534 ! inform Zcmsp to cintModels.f
535 ! call cputGencolCMS(Cmsp)
536  call cputgencolcms(zcmsp)
537  end
538 ! ************************
539  subroutine outresula(a, ntp)
540  implicit none
541 #include "Zptcl.h"
542 #include "Zcode.h"
543 #include "Zevhnp.h"
544 #include "Zevhnv.h"
545 #include "Zmass.h"
546 #include "Zmanagerp.h"
547 #include "Zmanager.h"
548 #include "Ztrackp.h"
549  include "Zprivate.h"
550 
551  integer ntp
552  type(ptcl):: a(ntp)
553  integer i, j
554  real*8 p
555  real*8 wx(3)
556  integer nw, difcode(20)
557 
558  call getdiffcode(nw, difcode)
559 
560  do j = 1, ntp
561  i = indx(j)
562  p = sqrt(
563  * dot_product( a(i)%fm%p(1:3), a(i)%fm%p(1:3)) )
564  wx(1:3)= a(i)%fm%p(1:3)/p
565  if(xyz .eq. 0) then
566  write(*,
567  * '(i3,i5,i4,1p, g14.5,0p, 3f17.13, i8)')
568  * a(i)%code, a(i)%subcode, a(i)%charge,
569  * a(i)%fm%p(4)-a(i)%mass, wx(1:3), j
570 
571 
572  else
573  write(*,'(i3,i5,i4,g14.5,1p3E11.3,0p3f17.13, i8)')
574  * a(i)%code, a(i)%subcode, a(i)%charge,
575  * a(i)%fm%p(4)-a(i)%mass, xpos(1:3), wx(1:3), j
576 
577  endif
578  enddo
579  if(ntp .gt. 0 .or. outzero .eq. 1) then
580  write(*, *)
581  endif
582  end
583 
584  subroutine gencol(a, ntp)
585  implicit none
586 #include "Zptcl.h"
587 #include "Zcode.h"
588 #include "Zmass.h"
589 #include "Zevhnv.h"
590 #include "Zevhnp.h"
591 #include "Zmanagerp.h"
592  include "Zprivate.h"
593 
594  type(ptcl):: a(*)
595 ! projectile and target information (both befor
596 ! and after collision ) in different system.
597 !
598  integer ntp
599  integer j
600  integer tZ, tA, L
601  real*8 xs, SIGbdif, xsair
602  real*8 roots
603 
604  ta = tgmnum
605  tz = tg%charge
606 
607  if(pj%code == kmuon ) then
608 ! sepcial treatment
609  call epgencolbymuon(plab, ta, tz, a, ntp)
610 !! elseif( pj.code == kphoton ) then
611 ! sepcial treatment
612 !! call epGencolByPhoton(plab, tA, tZ, a, ntp)
613  elseif(pj%code == kelec .or.
614  * ( pj%code /= kgnuc .and. pj%code >knuc ) ) then
615  write(0,*) ' ptcl code =', pj%code, ' not '
616  write(0,*) ' supported in Gencol'
617  stop
618  else
619 ! init for 1 event
620  if(activemdl .eq. 'qgsjet2' ) then
621  call cxsecqgs(plab, ta, xs)
622  elseif(activemdl .eq. 'epos' ) then
623  call ceposinioneevent(plab, tg, xs)
624  endif
625 !!!!!!!
626 ! you may include ToPrintXS.f here to print out E vs XS for Sibyll
627  !!!!!!!!
628 ! generate event
629  if(activemdl .eq. 'qgsjet1') then
630 #ifdef QGSJET1
631  call qgs01event(plab, ta, tz, a, ntp)
632 #endif
633 !! elseif(ActiveMdl .eq. 'sibyll') then
634 !!!
635 !! call csibyllevent(plab, tA, tZ, a, ntp)
636  else
637  call chacol(plab, ta, tz, a, ntp)
638  endif
639  endif
640  call getimpactparam(b)
641  do j = 1, ntp
642 ! boost to original target system
643  call cibst1(j, tg, a(j), a(j))
644  enddo
645  end
646  subroutine epgencolbymuon
647  implicit none
648 ! call epInfoPhotoP(incGp); incGpをHowPhotopに焼き直し
649 ! call ep2cosCond
650 ! call cfixModel( cTrack.p )
651 ! call ciniSmpIntL ! not related.
652 ! call epsmpNEPIntL(Media(MediaNo)) !st decay length only
653 ! call ep2cosCondr !set FromEpics = .false.
654 ! if( cTrack.p.fm.p(4) .gt. Media(MediaNo).cnst.muNEmina )
655 ! call epmuNsmpP( Media(MediaNo),
656 ! * cTrack.p.fm.p(4), prob, path)
657 ! epfixProc ! ProcessNo
658 !
659 ! epmuinte:
660 ! call epmuNsmpE(Media(MediaNo), Move.Track.p.fm.p(4),
661 ! * Et)
662 ! cTrack.p.fm.p(4) = cTrack.p.fm.p(4) - Et -->muon
663 ! if(Et .gt. 152.d-3) then
664 ! if(Media(MediaNo).mu.MuNI .eq. 3 ) then
665 !c generate gamma-N interaction; employ gamma interaction
666 !c routine
667 ! cTrack.p.fm.p(4) = Et
668 ! call cmkptc( kphoton, 0, 0, cTrack.p)
669 ! call epe2p(cTrack) ! adjust momentum
670 !c
671 ! call ep2cosPtcl( cTrack.p )
672 !c for small basic cross section case.
673 ! call epfixTarget2(ActiveMdl, Media(MediaNo))
674 ! call ep2cosCond2(Media(MediaNo).colA,
675 ! * Media(MediaNo).colZ)
676 ! call cphotop ! Cosmos function
677 ! call eppushPtcl(cTrack) ! use pos. info from this ptcl
678 
679  end
680 
681  subroutine epgencolbyphoton(plab, tA, tZ, a, ntp)
682  implicit none
683 ! #include "Zcode.h"
684 #include "Ztrack.h"
685 #include "Ztrackv.h"
686 #include "Ztrackp.h"
687 #include "Zelemagp.h"
688 
689 ! include "Zprivate.h"
690 
691  type(ptcl):: plab ! input proj. in Lab
692  integer,intent(in):: tA ! target A
693  integer,intent(in):: tZ ! target Z
694  type(ptcl):: a(*) ! ouptut. produced ptcl
695  integer,intent(out):: ntp ! # of produced ptcls
696 
697  real(8):: TargetA, xs
698  if( howphotop > 0 .and. plab%fm%p(4) > minphotoprode ) then
699 ! call ep2cosCond
700 ! call cfixModel( pj )
701 ! call cgpXsec(Media(MediaNo).A, E, xs)
702 ! prob = xs*Media(MediaNo).mbtoPX0
703 ! call rndc(u)
704 ! tgp = -log(u)/prob
705 !   −ーーーーーーーーーーー above is probably not needed
706 
707 !//// call ep2cosPtcl(plab)
708 ! call epfixTarget2(ActiveMdl, Media(MediaNo))
709 ! call ep2cosCond2(Media(MediaNo).colA,
710 ! * Media(MediaNo).colZ, Media(MediaNo).colXs)
711  targeta= ta
712  call cgpxsec(targeta, plab%fm%p(4), xs)
713 !//// call ep2cosCond2(tA, tZ, xs) ! xs will not be used
714  call cphotop ! Cosmos function
715 !! call eppushPtcl(cTrack) ! puch Cosmos made ptcl into Epics
716  a(1:nproduced) = pwork(1:nproduced)
717  ntp = nproduced
718  else
719  write(0,*) ' HowPhotoP=', howphotop, ' Eg=', plab%fm%p(4)
720  write(0,*) ' Either of above NG for photon projectile'
721  stop
722  endif
723 
724  end
725 
726  subroutine cutbyangle(a, ntp0, ntp)
727  implicit none
728 #include "Zptcl.h"
729 #include "Zcode.h"
730 #include "Zevhnv.h"
731 #include "Zevhnp.h"
732 #include "Zmanagerp.h"
733  include "Zprivate.h"
734  type(ptcl):: a(*)
735  integer ntp0 ! input. number of ptcls. in a
736  integer ntp ! output. could be the same as ntp0
737  integer j
738  integer i
739  real*8 p, wz
740  j = 0
741  do i = 1, ntp0
742  p = a(i)%fm%p(1)**2 + a(i)%fm%p(2)**2 +
743  * a(i)%fm%p(3)**2
744  p = sqrt(p)
745  wz = a(i)%fm%p(3)/p
746  if( wz .ge. wzmin .and. wz .le. wzmax ) then
747  j = j + 1
748  a(j)=a(i)
749  endif
750  enddo
751  ntp = j
752  end
753  subroutine sortbyke(a, ntp)
754  implicit none
755 #include "Zptcl.h"
756 #include "Zcode.h"
757 
758  include "Zprivate.h"
759  integer ntp
760  type(ptcl):: a(*)
761 ! projectile and target information (both befor
762 ! and after collision ) in different system.
763  integer i
764  do i = 1, ntp
765  ke(i) = a(i)%fm%p(4) - a(i)%mass
766  enddo
767  call kqsortd(ke, indx, ntp)
768  call ksortinv(indx, ntp)
769 ! ke( indx(1) ) is the highest energy
770  end
771  subroutine outtrace(nev, a, ntp)
772  implicit none
773 #include "Zptcl.h"
774 #include "Zcode.h"
775 #include "Zevhnp.h"
776 #include "Zevhnv.h"
777 #include "Zmass.h"
778 #include "Zmanagerp.h"
779 #include "Zmanager.h"
780 #include "Ztrackp.h"
781  include "Zprivate.h"
782 
783  integer ntp, nev
784  type(ptcl):: a(ntp)
785  integer i, j, leng, icon, klena
786  real*8 p
787 ! , wx, wy, wz
788 ! real x1, y1, z1, x2, y2, z2
789  character*100 tracefile
790  real(8):: x1(3), x2(3)
791 
792  write(tracefile, *) tracedir(1:klena(tracedir))//'/trace', nev
793  call kseblk(tracefile, ' ', leng)
794  call copenfw(tracedev, tracefile(1:leng), icon)
795  if(icon .ne. 0) then
796  call cerrormsg('tracefile could not be opened',0)
797  endif
798  if(xyz .eq. 0) then
799  x1(1:3)=0.
800  else
801  x1(1:3)=xpos(1:3)
802  endif
803 
804 ! colliding partilces
805  if(trace == 1 ) then
806  call puttrace(x1, pj, -2*trackl)
807  call puttrace(x1, tg, -2*trackl)
808  endif
809 
810  do j = 1, ntp
811  i = indx(j)
812  call puttrace(x1, a(i), trackl)
813  enddo
814  close(tracedev)
815  end
816  subroutine puttrace(x1, a, leng)
817  implicit none
818 #include "Zmanagerp.h"
819 #include "Zptcl.h"
820 #include "Ztrackp.h"
821  include "Zprivate.h"
822 
823  real(8),intent(in)::x1(3) ! origin
824  type(ptcl):: a ! a partilce
825  real(8),intent(in):: leng ! length of track to be drawn
826 
827  real(8)::wx(3), x2(3), p
828 
829  p = sqrt( dot_product(a%fm%p(1:3), a%fm%p(1:3)))
830  if( p >0. ) then
831  wx(1:3)= a%fm%p(1:3)/p
832  else
833  wx(1:3) = 0.
834  endif
835  x2(1:3) = x1(1:3) + wx(1:3)*leng
836  write(tracedev,'(3g14.5, i3, g14.4, i3, i2)')
837  * x1(1:3),
838  * a%code, a%fm%p(4) - a%mass, a%charge,
839  * 0
840  write(tracedev, '(3g14.5, i3, g14.4, i3, g14.4)' )
841  * x2(1:3),
842  * a%code, a%fm%p(4) - a%mass, a%charge,
843  * trackl
844  write(tracedev, *)
845  write(tracedev, *)
846  end
847 
848  subroutine outresulb(a, ntp)
849  implicit none
850 #include "Zptcl.h"
851 #include "Zcode.h"
852 #include "Zevhnp.h"
853 #include "Zevhnv.h"
854 #include "Zmass.h"
855 #include "Zmanagerp.h"
856 #include "Zmanager.h"
857 #include "Ztrackp.h"
858  integer,save:: nthev=0
859  include "Zprivate.h"
860 ! general process information; only for dpmjet3
861  INTEGER IPROCE,IDNODF,IDIFR1,IDIFR2,IDDPOM,IPRON
862  COMMON /poprcs/ iproce,idnodf,idifr1,idifr2,iddpom,ipron(15,4)
863 ! IPROCE
864 ! 1 non-diffractive inelastic
865 ! 2 elestic
866 ! 3 quasi elestic vector meson prod. (photon)
867 ! 4 central diffraction
868 ! 5 single diff. ptcl 1
869 ! 6 // ptcl 2
870 ! 7 double diff.
871 ! 8 direct photo-hadron
872 ! For moore detail, see manual in Documents/CosmicRays/phojetShort.pdf
873 ! say, IDIFR1 classifies IPROCE=5
874 
875  integer ntp
876  type(ptcl):: a(ntp)
877  integer i, j
878 
879  integer:: npp
880 
881 
882 
883  real*8 p, wx, wy, wz, pt, y, eta
884  integer npzm, npzp, Ncht, Nchpzm, Nchpzp
885  integer nw, diffcode(20)
886  real(8):: Xfpz, Xfke
887 !//////////////
888  type(ptcl):: inlab
889  real(8):: ylab, etalab
890  integer icon
891  type(ptcl):: pcms, pl
892  type(fmom):: gc
893 !/////////////
894  nthev=nthev+1
895 
896  npzm = 0
897  npzp = 0
898  nchpzm = 0
899  nchpzp = 0
900 
901 
902  do j = 1, ntp
903  i = indx(j)
904  if( a(i)%fm%p(3) .gt. 0.) then
905  npzp = npzp + 1
906  if(a(i)%charge .ne. 0) then
907  nchpzp = nchpzp +1
908  endif
909  else
910  npzm = npzm + 1
911  if(a(i)%charge .ne. 0) then
912  nchpzm = nchpzm + 1
913  endif
914  endif
915  enddo
916  ncht = nchpzm + nchpzp
917 ! ntpp = 0 ! ?
918 
919  do j = 1, ntp
920  i = indx(j)
921  pt = sqrt( a(i)%fm%p(1)**2 + a(i)%fm%p(2)**2)
922  p= sqrt( pt**2 + a(i)%fm%p(3)**2 )
923  xfke = ( a(i)%fm%p(4)-a(i)%mass) /( pj%fm%p(4)- pj%mass)
924  xfpz = a(i)%fm%p(3) / pj%fm%p(3)
925 
926  wz = a(i)%fm%p(3)/p
927  call cyeta(a(i), y, eta)
928  write(*,'(3i4, 1p, 7g13.4)')
929  * a(i)%code, a(i)%subcode, a(i)%charge,
930  * pt, y, eta, a(i)%fm%p(4)-a(i)%mass, a(i)%fm%p(3),
931  * xfke, xfpz
932 ! * ylab, etalab
933 ! write(*,'(3i4, 1p, 3g13.4)')
934 ! * a(i)%code, a(i)%subcode, a(i)%charge,
935 ! * a(i)%fm%p(4)-a(i)%mass, a(i)%fm%p(3), wz
936 
937 
938  enddo
939  if(ntp .gt. 0 .or. outzero .eq. 1) then
940  write(*, *)
941  endif
942  end
943  subroutine outresulc(a, ntp)
944  implicit none
945 #include "Zptcl.h"
946 #include "Zcode.h"
947 #include "Zevhnp.h"
948 #include "Zevhnv.h"
949 #include "Zmass.h"
950 #include "Zmanagerp.h"
951 #include "Zmanager.h"
952 #include "Ztrackp.h"
953  integer,save:: nthev=0
954  include "Zprivate.h"
955 ! general process information; only for dpmjet3
956  INTEGER IPROCE,IDNODF,IDIFR1,IDIFR2,IDDPOM,IPRON
957  COMMON /poprcs/ iproce,idnodf,idifr1,idifr2,iddpom,ipron(15,4)
958 ! IPROCE
959 ! 1 non-diffractive inelastic
960 ! 2 elestic
961 ! 3 quasi elestic vector meson prod. (photon)
962 ! 4 central diffraction
963 ! 5 single diff. ptcl 1
964 ! 6 // ptcl 2
965 ! 7 double diff.
966 ! 8 direct photo-hadron
967 ! For moore detail, see manual in Documents/CosmicRays/phojetShort.pdf
968 ! say, IDIFR1 classifies IPROCE=5
969 
970  integer ntp
971  type(ptcl):: a(ntp)
972  integer i, j, icon
973 
974 
975  integer:: npp
976 
977  real*8 p, wx, wy, wz, pt, y, eta
978  integer npzm, npzp, Ncht, Nchpzm, Nchpzp
979  integer nw, diffcode(20)
980  real(8):: Xfpz, Xfke
981 !//////////////
982  type(ptcl):: restn
983  type(ptcl):: cmptcl
984  type(fmom):: gc
985  real(8):: s, rootsh, xf, xflab, xfmax
986  real(8):: Esmax, Pszmax, Pzmax, Ebypzmax, Esbyrootsh
987  real(8):: ys, etas, Es, Elab, pabs, cost, teta
988 !/////////////
989  nthev=nthev+1
990 
991 
992  call cmkptc(6, -1, 1, restn)
993  restn%fm%p(1:3)=(/0.,0.,0./)
994  restn%fm%p(4) = restn%mass
995  call cgetcm(pj, restn, gc, icon)
996  s =( restn%mass + pj%fm%p(4) ) *2 * restn%mass
997  rootsh = sqrt(s)/2
998  esmax=rootsh - pj%mass
999  pszmax=sqrt( esmax**2 - maspic**2 ) ! pion case
1000  pzmax = gc%p(4)*pszmax + gc%p(3)* esmax !
1001 
1002  do j = 1, ntp
1003  call cbst0(j, gc, a(j), cmptcl) ! j==1 must be called.
1004  call cyeta(cmptcl, ys, etas)
1005  call cyeta(a(j), y, eta)
1006 
1007  elab = a(j)%fm%p(4)
1008  es = cmptcl%fm%p(4)
1009  xf = cmptcl%fm%p(3)/rootsh
1010  xflab = a(j)%fm%p(3)/pzmax
1011  pt =sqrt( a(j)%fm%p(1)**2 + a(j)%fm%p(2)**2 )
1012  pabs = sqrt( pt**2 + a(j)%fm%p(3)**2 )
1013  cost = a(j)%fm%p(3)/pabs
1014  teta = acos(cost)
1015  write(*, '(2i4, 1p, 9g14.4)')
1016  * a(j)%code, a(j)%charge, etas, es, xf, eta, elab,
1017  * xflab, cost, teta, pt
1018 
1019  enddo
1020  if(ntp .gt. 0 .or. outzero .eq. 1) then
1021  write(*, *)
1022  endif
1023  end
1024 
1025 
1026  subroutine outresulx(a, ntp)
1027  implicit none
1028 #include "Zptcl.h"
1029 #include "Zcode.h"
1030 #include "Zevhnp.h"
1031 #include "Zevhnv.h"
1032 #include "Zmass.h"
1033 #include "Zmanagerp.h"
1034 #include "Zmanager.h"
1035 #include "Ztrackp.h"
1036  include "Zprivate.h"
1037 
1038  integer ntp
1039  type(ptcl):: a(ntp)
1040  integer i, j
1041  real*8 p, mass2, p2
1042  real*8 wx(3)
1043  integer nw, difcode(20)
1044 
1045 ! call getDiffCode(nw, dffcode)
1046 !!!
1047  call csibylgetdiffcode(nw, difcode)
1048 ! write(*,'("h ",i3, 7i6)' )
1049 ! * difcode(1),ntp, npzm, npzp, Ncht, Nchpzm, Nchpzp, nthev
1050 !
1051 ! do i = 1, nw
1052 ! write(*,'(a, 3i10)')
1053 ! * 'dif ', i, difcode(i), ntp
1054 ! enddo
1055  write(*,*) 'dif ', nw, difcode(1:nw)
1056 !!!!!!
1057  do i = 1, ntp
1058  p2 = dot_product(a(i)%fm%p(1:3), a(i)%fm%p(1:3) )
1059  p = sqrt(p2)
1060 ! mass2= a(i)%fm%p(4)**2 - p2
1061  mass2= (a(i)%fm%p(4)- p)*(a(i)%fm%p(4)+ p)
1062 ! if( a(i)%code /= 1 .and.
1063 ! * ( abs(a(i)%mass/sqrt(mass2) -1.) > 0.01 )
1064 ! * .or.
1065 ! * a(i)%code == 0 .and.
1066 ! * ( abs( a(i)%mass-sqrt(mass2) ) > 0.03 ) ) then
1067 !!! write(*,
1068 !!! * '(i3,i5,i4,1p, 6g22.14)')
1069 !!! * a(i)%code, a(i)%subcode, a(i)%charge,
1070 !!! * a(i)%fm%p(:), a(i)%mass, sqrt(mass2)
1071 ! endif
1072  enddo
1073  if(ntp .gt. 0 .or. outzero .eq. 1) then
1074  write(*, *)
1075  endif
1076  end
subroutine ksplit(a, m, n, b, nr)
Definition: ksplit.f:2
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
subroutine outresulx(a, ntp)
Definition: Gencol.f:1027
subroutine cphotop
Definition: cintePhoton.f:217
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 kgnuc
Definition: Zcode.h:2
subroutine cintmodels(from)
Definition: cintModels.f:3
subroutine cfixmodel(aPtcl)
Definition: cfixModel.f:2
integer, save fwbw
Definition: csoftenPiK.f:50
subroutine checkptcls
Definition: Gencol.f:271
const int kphoton
Definition: Zcode.h:6
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
subroutine puttrace(x1, a, leng)
Definition: Gencol.f:817
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
max ptcl codes in the kelec
Definition: Zcode.h:2
integer maxn LabEquivE real outresul integer pjcode
Definition: Zprivate.h:8
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 outtrace(nev, a, ntp)
Definition: Gencol.f:772
subroutine cbst0(init, gb, p, po)
Definition: cbst0.f:25
subroutine qgs01init
Definition: qgs01init.f:2
subroutine epreadmediaformuon
Definition: Gencol.f:173
subroutine getimpactparam(bout)
Definition: getImpactParam.f:3
subroutine outresulb(a, ntp)
Definition: Gencol.f:849
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
subroutine copenf(io, fnin, icon)
Definition: copenf.f:8
subroutine cputgencolcms(cms)
Definition: cintModels.f:281
subroutine cfixprefix(dsn)
Definition: cintModels.f:209
integer maxn LabEquivE real outresul integer pjchg integer tgchg integer xyz real pjpy
Definition: Zprivate.h:8
subroutine outresulc(a, ntp)
Definition: Gencol.f:944
nodes a
subroutine cbtype2cos(btype, code, subc, charge)
Definition: Gencol.f:358
subroutine formpjtg(confirm)
Definition: Gencol.f:443
dE dx *! Nuc Int sampling table b
Definition: cblkMuInt.h:130
subroutine epgencolbyphoton(plab, tA, tZ, a, ntp)
Definition: Gencol.f:682
subroutine copenfw(io, fnin, icon)
Definition: copenf.f:122
subroutine csoftenfe(inci, fwbwin, a, nin, nout)
Definition: csoftenPiK.f:563
subroutine cutbyangle(a, ntp0, ntp)
Definition: Gencol.f:727
subroutine epgencolbymuon
Definition: Gencol.f:647
subroutine cquhooki(i, iv)
Definition: cqUHookr.f:15
subroutine cmkptc(code, subcode, charge, p)
Definition: cmkptc.f:15
subroutine checkenergy
Definition: Gencol.f:200
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
subroutine outresula(a, ntp)
Definition: Gencol.f:540
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
maspic
Definition: Zmass.h:5
subroutine chacol(pj, ia, iz, a, ntp)
Definition: chAcol.f:3
subroutine cyeta(p, y, eta)
Definition: cyeta.f:5
max ptcl codes in the kmuon
Definition: Zcode.h:2
subroutine cgeqm2(p1, p2, q, icon)
Definition: cgeqm.f:34
subroutine kseblk(text, c, lc)
Definition: kseblk.f:18
subroutine cgetcm(p1, p2, gc, icon)
Definition: cgetcm.f:41
subroutine cgpxsec(a, energy, xs)
Definition: cgpXsec.f:11
subroutine cgetloginn(userid)
Definition: cgetLoginN.f:29