COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cgnlp.f
Go to the documentation of this file.
1 !
2 !
3  subroutine cgnlp(a, ntp, icon)
4 ! ********************************************************
5 ! a: /ptcl/ Output. to get produced particles in cms
6 ! ntp: output. Integer. The number of particle in a.
7 ! icon: Integer. Output.0--> o.k
8 ! 1--> n.g
9  implicit none
10 #include "Zptcl.h"
11 #include "Zmass.h"
12 #include "Zevhnv.h"
13 !
14  type(ptcl):: a(*)
15  integer ntp, icon
16 ! --------------------------------
17  real*8 missgm, roots
18  integer jcon
19 !
20 
21 
22 ! integer maxiso/10/ ! max # of ptcl from isotropic p.s
23  integer maxiso/0/ ! max # of ptcl from isotropic p%s
24 ! logical ok
25 !
26 ! sample # of charged ptcls
27 !
28  missgm = missingp%mass
29  roots = cmsp%mass
30 ! *** until loop***
31 
32  do while (.true.)
33 ! get average # and sampled # of charged ptcl
34 ! Avncharged & Nch
35  call csnchp(jcon)
36  if(jcon .ne. 0) then
37  icon=1
38  goto 900 ! return
39  endif
40 ! fix # of pi+-, pi0, k+-,k0, nn~, dd~,
41 ! and give ptcl mass and code in a;
42 ! # of pi+- etc is obtained by calling
43 ! cqnptc(code, charge, nout)
44  call cfnptc(a, ntp)
45  if(ntp .ge. 1 ) goto 10
46 ! if(ntp .eq. 1 .and. missgm .lt. 15.*maspic) goto 10
47 ! if(ntp .eq. 2 .and. missgm .lt. 30.*maspic) goto 10
48  enddo
49  10 continue
50  if(ntp .le. maxiso .and. ntp .ge. 2) then
51 ! use isotripc p.s
52  call ciso(ntp, a, icon)
53  if(icon .eq. 1) then
54 ! <Pt> is too large so use cylindrical p.s
55  call ccylps(ntp, a, icon)
56  elseif(icon .eq. 2) then
57  icon=1
58  endif
59  elseif(ntp .ge. 2) then
60  call ccylps(ntp, a, icon)
61  else
62 ! assume 1 (or 0) pion production in cms
63  call c1pion(a, ntp, icon)
64  endif
65  900 continue
66  end
67 ! *****************************
68  subroutine ccpmul(roots, avn)
69 ! *****************************
70 ! average charged particle multiplicity at root(s)
71 ! /**** UA5 parameterization ***/
72 ! root(s) GeV
73  implicit none
74 #include "Zevhnp.h"
75 
76  real*8 roots, avn
77 ! real*8 lambda/0.3/, no/0.6135/, qcdErg/1000./ ! up to 1000 GeV.
78 ! | this is wrong (total multiplicity)
79  real*8 lambda/0.3/, no/0.34/, qcdErg/1000./
80 !
81 ! e UA5 data.
82 ! original
83 ! avn= 7.2* roots**(2*0.127) -7. including leading.
84 !
85  avn = (no* exp(sqrt(23./18. * log( (roots/lambda))*2))
86  * -3.5)*0.8
87  if(avn .lt. 0.1) then
88  avn = 0.1
89  endif
90 !
91 !
92  end
93 ! **************ccylps**************************************
94 ! generation of ptcls by cylindrical p.s
95 ! icon: 0---> o.k
96 ! 1---> n.g
97 ! ****************************************************
98  subroutine ccylps(ntp, a, icon)
99  implicit none
100 !---- include '../../Zptcl.h'
101 #include "Zptcl.h"
102 !---- include '../Zevhnv.h'
103 #include "Zevhnv.h"
104  integer ntp, icon
105  type(ptcl):: a(ntp)
106 !
107  real*8 ptav, w
108  integer i
109 !
110 ! assign pt
111 ! init for const.
112  call caspti
113 ! loc pt = loc pz
114  call caspt(a, ntp)
115 ! pt---> ptx,pty
116  call csptxy(a, ntp)
117 ! forced conservation of pt.
118  call cptcns(a, ntp, ptav)
119 ! generation of rapidity for missing mass
120  w = missingp%mass
121 ! loc tm = loc pz
122 ! loc rap = loc e
123  call cgrap(w, ptav, ntp, a, icon)
124  if(icon .eq. 0) then
125 ! convert y into to missing mass system energy
126  call cytoe(a, ntp)
127 ! ________________________________
128 ! call cchk(' after cytoe', a, ntp)
129 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130 ! boosting ntp ptcls to cms
131  do i=1, ntp
132  call cibst1(i, missingp, a(i), a(i))
133  enddo
134  endif
135  end
136 ! ********************************************
137 ! generate 1 pion
138 ! leadings are reset here.
139 ! icon: 0--> o.k
140 ! 1--> n.g
141  subroutine c1pion(a, ntp, icon)
142 ! Method:
143 ! Now, the recoil leadings and missing mass and its
144 ! 4 momentum are given. We change this missing mass
145 ! to be a pion and make a transformaton so that
146 ! 3 particles satify the 4 momentum conservation.
147 ! a(1): /ptcl/. Outupt. produced pion
148 ! ntp: integer. Output. 1 if icon =0 (produced)
149 ! 0 if icon =1 (n.g)
150 ! icon: integer. Output. 0--> ok. 1--> n.g
151 ! ********************************************
152  implicit none
153 !---- include '../../Zptcl.h'
154 #include "Zptcl.h"
155 !---- include '../../Zmass.h'
156 #include "Zmass.h"
157 !---- include '../Zevhnv.h'
158 #include "Zevhnv.h"
159 #include "Zcode.h"
160 
161 !
162  integer ntp, icon
163  type(ptcl):: a(*)
164 
165  type(ptcl):: p3(3) ! to store 3 particles
166  real*8 amu(3), roots, gzai
167  integer csum0, csum1, charge
168  character*80 msg
169 !
170 ! modify E,P following cpc p.364
171 ! get gzai for q~=gzai*p~
172 ! q0=sqrt(m**2 + gzai**2(p0**2-mu**2) )
173 !
174  p3(1) = rpjcms ! reooil proj. in cms
175  p3(2) = rtgcms ! recoil trgt. in cms
176  p3(3) = missingp ! missing mass in cms
177  roots = cmsp%mass
178 
179 ! present mass
180  amu(1)=pjlab%mass
181  amu(2)=tglab%mass
182  amu(3)=missingp%mass ! missing mass
183 !
184 
185  csum0 = pjlab%charge + tglab%charge
186  csum1 = rpjcms%charge +rtgcms%charge
187  if( abs(csum1-csum0) .gt. 1) then
188 ! retry once more
189  icon =1
190  goto 900
191  else
192  charge = csum0 - csum1
193 ! true mass ! we want missing --> pion mass.
194 ! modify missing mass to be the pion mass
195  call cmkptc(kpion, 0, charge, p3(3))
196  endif
197 ! get convesion factor
198 ! note: in cnbdcy, amu is not used, because
199 ! it is always 0. (start from 0 mass ptcl)
200 ! and transform to massive case (true mass
201 ! is in /ptcl/ data.)
202 ! However, here, the trial mass is missing mass
203 ! and must be given in amu. True mass is
204 ! in /ptcl/ p3
205  call cnbdc3(3, roots, p3, amu, 1,
206  * gzai, icon)
207  if(icon .eq. 0) then
208  call cnbdc4(3, p3, amu, 1, gzai)
209 ! ________________________________
210 ! write(*,*) ' p3 sumpx',
211 ! * (p3(1).fm.p(1)+p3(2).fm.p(1)+p3(3).fm.p(1))
212 ! write(*,*) ' p3 sumpy',
213 ! * (p3(1).fm.p(2)+p3(2).fm.p(2)+p3(3).fm.p(2))
214 ! write(*,*) ' p3 sumpz',
215 ! * (p3(1).fm.p(3)+p3(2).fm.p(3)+p3(3).fm.p(3))
216 ! write(*,*) ' p3 sum e (gev)',
217 ! * ( p3(1).fm.p(4)+p3(2).fm.p(4)+p3(3).fm.p(4))
218 ! write(*,*) ' roots=',roots
219 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
220 ! reset leadings
221  rpjcms = p3(1)
222  rtgcms = p3(2)
223 ! boost proj. recoil into lab (cms -> lab)
224 ! note: tg(7).fm = cms 4 mom. in lab
225  call cibst1(1, cmsp, rpjcms, rpjlab)
226 ! boost target recoil into lab
227  call cibst1(2, cmsp, rtgcms, rtglab)
228 ! boost proj to target rest system. (may not be used)
229  call cbst1(1, tglab, rpjlab, rpjtatr)
230 ! same for projectile rest system. (may not be used)
231  call cbst1(1, pjlab, rtglab, rtgpatr)
232 ! move pion
233  a(1) = p3(3)
234  ntp = 1
235  else
236 ! ____________________________________________
237  write(0,*) ' failed to adjust missing mass=',
238  * missingp%mass, ' into pion mass. '
239 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
240  ntp = 0
241  icon = 1
242  endif
243  900 continue
244  end
245 ! *********************************************************
246  subroutine caspti
247 ! *********************************************************
248 ! preparation for assigning pt
249  implicit none
250 !---- include '../../Zptcl.h'
251 #include "Zptcl.h"
252 !---- include '../../Zmass.h'
253 #include "Zmass.h"
254 !---- include '../Zevhnv.h'
255 #include "Zevhnv.h"
256 !
257  real*8 efe0, xx
258 ! real*8 ptbase/330.d-3/
259  real*8 ptbase/180.d-3/
260 ! real*8 ptbase/170.d-3/
261 !
262 ! some sort of effective E0, which I cannot
263 ! remember the reasoning now.
264 ! efe0 = (Efrs**2 + 2*(masn + Pjlab.mass)*Efrs)/2
265 ! * /masn
266  efe0 =max(1.d0, (efrs**2 - masn*2- pjlab%mass**2)/2
267  * /masn)
268 
269 !
270 ! Powerexp in pt**pw2 * exp(-pt/..) dpt case.
271  powerexp=1.0d0 + (efe0)**(-0.05d0)
272  if(efe0 .lt. 40.) then
273  xx = (efe0 - 40.)/5.5 + 6.
274  ptnorm = ptbase *exp(xx)/(1+exp(xx))
275  elseif(efe0 .lt. 40000.) then
276  ptnorm= ptbase
277  else
278  ptnorm= ptbase
279 ! Ptnorm = ptbase *( efe0/40000.)**0.025
280  endif
281  probpower=min(0.04d0*nch, 0.33d0)
282  powerp=3.d0 +
283  * 1.d0/
284  * (0.01 + 0.01*3.29* missingp%mass**0.3)
285  if(powerp .gt. 100.d0) then
286  probpower=0.d0
287  endif
288  end
289 !
290 ! *****************
291  subroutine caspt(a, ntp)
292 ! generation of pt
293 ! *****************
294 !---- include '../../Zptcl.h'
295 #include "Zptcl.h"
296 !---- include '../../Zcode.h'
297 #include "Zcode.h"
298 !---- include '../Zevhnv.h'
299 #include "Zevhnv.h"
300  integer ntp
301  type(ptcl):: a(ntp)
302 
303  real*8 pttmp
304  integer ntpc
305 ! <>pt for NN~, DD~
306 ! real*8 ptnnb/500.d-3/, ptddb/750.d-3/, ptavpi/330.d-3/,
307 ! * ptavk/479.d-3/, ptaveta/480.d-3/
308  real*8 ptnnb/250.d-3/, ptddb/370.d-3/, ptavpi/180.d-3/,
309  * ptavk/240.d-3/, ptaveta/240.d-3/
310 ! real*8 ptnnb/240.d-3/, ptddb/360.d-3/, ptavpi/170.d-3/,
311 ! * ptavk/230.d-3/, ptaveta/230.d-3/
312 !
313  ntpc = 0
314 ! (n,n~)
315  pttmp=ptnnb* ptnorm/ptavpi
316 ! sample pt
317  call cspt(pttmp, nnnb, a, ntpc)
318 
319 ! (d,d~)
320  pttmp = ptddb* ptnorm/ptavpi
321  call cspt(pttmp, nddb, a, ntpc)
322 ! pi+/-
323  pttmp=ptnorm
324  call cspt(pttmp, npic, a, ntpc)
325 ! pi0
326  call cspt(pttmp, npi0, a, ntpc)
327 ! eta
328  pttmp = ptaveta*ptnorm/ptavpi
329  call cspt(pttmp, neta, a, ntpc)
330 ! kaon +/ -
331  pttmp = ptavk*ptnorm/ptavpi
332  call cspt(pttmp, nkch, a, ntpc)
333 ! k0
334  call cspt(pttmp, nk0, a, ntpc)
335  end
336 ! ****************************************************
337  subroutine ciso( ntp, a, icon)
338 ! isotropic phase space
339 ! icon: 0---> o.k
340 ! 1---> <pt> is big, better to use cylindrical p.s
341 ! 2---> n.g
342 ! ****************************************************
343  implicit none
344 !---- include '../../Zptcl.h'
345 #include "Zptcl.h"
346 !---- include '../Zevhnv.h'
347 #include "Zevhnv.h"
348  integer ntp, icon
349  type(ptcl):: a(ntp)
350 !
351  integer nc, jcon, i
352  real*8 ptc1/500.d-3/, ptc2/700.d-3/
353 !
354  real*8 ptlm1, ptlm2, missgm, wg, sumpt, avpt
355 !
356  character*80 msg
357 
358  missgm = missingp%mass
359  nc=0
360  if(pjlab%fm%p(4) .lt. 1000.d0) then
361  ptlm1=ptc1*(pjlab%fm%p(4)/1000.d0)**0.04
362  ptlm2=ptc2*(pjlab%fm%p(4)/1000.d0)**0.04
363  else
364  ptlm1=ptc1
365  ptlm2=ptc2
366  endif
367  if(3.1415/4.0* missgm/ntp .gt. ptlm1) then
368  jcon=1
369  else
370 ! *** until loop***
371  do while (.true.)
372 ! isotropic p.s decay; take almost all weights
373 ! wg=.95 does not make any diff.(slower speed)
374 ! call cnbdcy(ntp, missgm, a, 1, wg, jcon)
375  call cnbdcy(ntp, missgm, a, 0, wg, jcon)
376  nc=nc+1
377  if(nc .gt. 15) then
378  jcon=3
379  write(msg,*) ' cnbdcy fail but try further'
380  call cerrormsg(msg, 1)
381  endif
382  if(jcon .ne. 0 .or. wg .gt. .05d0) goto 99
383  enddo
384  99 continue
385  if(jcon .eq. 0) then
386 ! boost 4 momentum into cms
387  do i=1, ntp
388  call cibst1(i, missingp, a(i), a(i))
389  enddo
390 ! get <pt> and see if it is too large
391 ! get sum of pt
392  sumpt=0.d0
393  do i=1, ntp
394  sumpt=sumpt +
395  * sqrt(a(i)%fm%p(1)**2+a(i)%fm%p(2)**2)
396  enddo
397  avpt=sumpt/ntp
398  if(avpt .gt. ptlm2) then
399  jcon = 2
400  elseif(avpt .gt. ptlm1) then
401  jcon = 1
402  else
403  jcon = 0
404  endif
405  else
406  jcon = 2
407  endif
408  endif
409  icon=jcon
410  end
411 ! ***********************************************
412 ! convert rapidity y into to cms energy
413 !
414  subroutine cytoe(a, n)
415  implicit none
416 !---- include '../../Zptcl.h'
417 #include "Zptcl.h"
418  integer n
419  type(ptcl):: a(n)
420 !
421  integer i
422  real*8 etemp
423  do i=1, n
424 ! note that rap and e have the same pos.
425 ! etemp=a(i).fm.tm * cosh( a(i).fm.rap )
426  etemp=a(i)%fm%p(3)* cosh( a(i)%fm%p(4) )
427 ! a(i).fm.p(3) = a(i).fm.tm * sinh( a(i).fm.rap )
428  a(i)%fm%p(3) = a(i)%fm%p(3)* sinh( a(i)%fm%p(4))
429  a(i)%fm%p(4) = etemp
430  enddo
431  end
432 ! *****************************************************
433  subroutine cspt(avpt, nptcl, a, ntpc)
434 ! to sample a pt
435 ! avpt: real*8. Input. average pt in exponential part.
436 ! nptcl: integer. Input. # of ptcls to be assigned
437 ! a: /ptcl/. output. a.fm.p(3) is given a pt value
438 ! ntpc: integer. input/oututp. a(ntpc+1) is the first
439 ! ptcl pos. ntpc is incremented by nptcl
440 ! on return.
441 
442  implicit none
443 !---- include '../../Zptcl.h'
444 #include "Zptcl.h"
445 !---- include '../Zevhnv.h'
446 #include "Zevhnv.h"
447  integer nptcl, ntpc
448  type(ptcl):: a(*)
449  real*8 avpt
450 !
451 ! real*8 u, bpt/1.7d0/, pt
452 ! real*8 u, bpt/1.5d0/, pt
453  real*8 u, bpt/1.0d0/, pt
454 
455 
456  integer nc
457 
458  do nc = 1, nptcl
459  call rndc(u)
460  if(u .lt. probpower) then
461 ! power pt
462  call cspwpt(bpt, powerp, pt)
463  else
464 ! pt**pw2 * exp(-pt/..)dpt
465 
466  call ksgmrm(powerexp, avpt, pt)
467  endif
468  ntpc = ntpc +1
469  a(ntpc)%fm%p(3) = pt
470  enddo
471  end
472 ! ***********************************************************
473 !
474 ! dptcns: do forced conservation of pt * c
475 ! ***********************************************************
476 !
477 !/usage/ call cptcns(a, nt, ptav)
478 !
479 ! 1) compute sum of ptx and pty and distribute them to each ptcl
480 ! propotionally to pt to have zero-sum ptx and pty.
481 ! 2) adjust pt, ptx, pty so that the sum of pt becomes the same
482 ! values as that of original one
483 !
484 ! a(nt) : /ptcl/. Input/Output.
485 ! ptav: real*8. Output. <pt>
486 !
487 !
488 ! before calling this routine, pz should not be
489 ! set as z-component. it is the location of
490 ! pt.
491  subroutine cptcns(a, nt, ptav)
492  implicit none
493 !---- include '../../Zptcl.h'
494 #include "Zptcl.h"
495  integer nt
496  type(ptcl):: a(nt)
497  real*8 ptav
498 !
499  real*8 sumpx, sumpy, sumpt, cfx, cfy
500  real*8 sumpt2, cf
501  integer i
502 !
503  if(nt .ge. 2) then
504 ! get sum of pt, ptx, pty
505  sumpx = 0.d0
506  sumpy = 0.d0
507  sumpt = 0.d0
508  do i=1, nt
509  sumpt = sumpt + a(i)%fm%p(3)
510  sumpx = sumpx + a(i)%fm%p(1)
511  sumpy = sumpy + a(i)%fm%p(2)
512  enddo
513  if(sumpt .gt. 0.d0) then
514 ! correction factor
515  cfx=sumpx/sumpt
516  cfy=sumpy/sumpt
517 !
518  sumpt2=0.d0
519  do i=1, nt
520  a(i)%fm%p(1) = a(i)%fm%p(1) - a(i)%fm%p(3) * cfx
521  a(i)%fm%p(2) = a(i)%fm%p(2) - a(i)%fm%p(3) * cfy
522  a(i)%fm%p(3) = sqrt(a(i)%fm%p(1)**2 + a(i)%fm%p(2)**2 )
523  sumpt2=a(i)%fm%p(3) + sumpt2
524  enddo
525 ! adjust: sum (pt) = original value
526  cf = sumpt/sumpt2
527 ! multipliy cf to pt and ptx,pty
528  do i=1, nt
529  a(i)%fm%p(3) = a(i)%fm%p(3)*cf
530  a(i)%fm%p(1) = a(i)%fm%p(1)*cf
531  a(i)%fm%p(2) = a(i)%fm%p(2)*cf
532  enddo
533  ptav=sumpt/nt
534  else
535  ptav = 1.d-1
536  endif
537  elseif(nt .gt. 0) then
538  ptav=a(1)%fm%p(3)
539  else
540  ptav = 1.d-1
541  endif
542  end
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
subroutine cgnlp(a, ntp, icon)
Definition: cgnlp.f:4
subroutine cbst1(init, p1, p2, po)
Definition: cbst1.f:54
subroutine cfnptc(a, ntot)
Definition: csnchp.f:119
subroutine ksgmrm(s, av, x)
Definition: ksgamd.f:125
subroutine c1pion(a, ntp, icon)
Definition: cgnlp.f:142
subroutine caspti
Definition: cgnlp.f:247
masn
Definition: Zmass.h:5
subroutine cnbdc4(n, p, mu, inm, gzai)
Definition: cnbdcy.f:321
subroutine caspt(a, ntp)
Definition: cgnlp.f:292
subroutine cytoe(a, n)
Definition: cgnlp.f:415
subroutine cgrap(w, ptav, ntp, a, icon)
Definition: cgrap.f:3
subroutine cibst1(init, p1, p2, po)
Definition: cibst1.f:29
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 ccpmul(roots, avn)
Definition: cgnlp.f:69
subroutine cnbdcy(n, ecm, p, jw, w, icon)
Definition: cnbdcy.f:48
subroutine rndc(u)
Definition: rnd.f:91
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
subroutine ccylps(ntp, a, icon)
Definition: cgnlp.f:99
subroutine csnchp(icon)
Definition: csnchp.f:3
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
subroutine cnbdc3(n, ecm, p, mu, inm, gzai, icon)
Definition: cnbdcy.f:252
subroutine cmkptc(code, subcode, charge, p)
Definition: cmkptc.f:15
subroutine ciso(ntp, a, icon)
Definition: cgnlp.f:338
subroutine csptxy(a, nt)
Definition: csptxy.f:9
Definition: Zptcl.h:75
max ptcl codes in the kpion
Definition: Zcode.h:2
subroutine cspt(avpt, nptcl, a, ntpc)
Definition: cgnlp.f:434
subroutine cptcns(a, nt, ptav)
Definition: cgnlp.f:492
subroutine cspwpt(b, p, pt)
Definition: cspwpt.f:15