COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cnbdcy.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine cnbdcy (n, ecm, p, jw, w, icon)
 
subroutine cnbdct (n, p)
 
subroutine cnbdc1 (n, p)
 
subroutine cnbdc2 (n, ecm, p)
 
subroutine cnbdc3 (n, ecm, p, mu, inm, gzai, icon)
 
subroutine cnbdcf (n, ecm, p,
 
subroutine cnbdc4 (n, p, mu, inm, gzai)
 
subroutine cnbdc5 (n, ecm, p, wx)
 
subroutine cnbdc6 (n, ecm, w0)
 
subroutine cnbdc7 (n, ecm, p, wmax)
 

Function/Subroutine Documentation

◆ cnbdc1()

subroutine cnbdc1 ( integer  n,
type(ptcl), dimension(n p 
)

Definition at line 177 of file cnbdcy.f.

References d0, kcossn(), rndc(), and true.

Referenced by cnbdcy().

177  implicit none
178 ! generate massless ptcls isotropically without conservation
179 !---- include '../Zptcl.h'
180 #include "Zptcl.h"
181  integer n
182  type(ptcl):: p(n)
183 !
184  integer i
185  real*8 u1, u2, u, cs, sn, cst, snt
186  do i=1, n
187 ! *** until loop***
188  do while (.true.)
189  call rndc(u1)
190  call rndc(u2)
191  u=u1*u2
192  if(u .gt. 0.) goto 10
193  enddo
194  10 continue
195  p(i)%fm%p(4) = -log(u)
196  call kcossn(cs, sn)
197  call rndc(u)
198  cst=2*u-1.d0
199  snt=sqrt(1. - cst**2)
200  p(i)%fm%p(1) = p(i)%fm%p(4)*snt*cs
201  p(i)%fm%p(2) = p(i)%fm%p(4)*snt*sn
202  p(i)%fm%p(3) = p(i)%fm%p(4)*cst
203  enddo
nodes i
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 rndc(u)
Definition: rnd.f:91
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
subroutine kcossn(cs, sn)
Definition: kcossn.f:13
Definition: Zptcl.h:75
integer n
Definition: Zcinippxc.h:1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cnbdc2()

subroutine cnbdc2 ( integer  n,
real*8  ecm,
type(ptcl), dimension(n p 
)

Definition at line 206 of file cnbdcy.f.

References d0.

Referenced by cnbdcy().

206 ! conformal transformation to conserve 4-momentum
207  implicit none
208 !---- include '../Zptcl.h'
209 #include "Zptcl.h"
210  integer n
211  type(ptcl):: p(n)
212  real*8 ecm
213 !
214  real*8 sumx, sumy, sumz, sume, em, g
215  real*8 a, x, bx, by, bz, bq, pe, tmp, px, py, pz
216  integer i
217 !
218  sumx=0.d0
219  sumy=0.d0
220  sumz=0.d0
221  sume=0.d0
222  do i=1, n
223  sumx=sumx+p(i)%fm%p(1)
224  sumy=sumy+p(i)%fm%p(2)
225  sumz=sumz+p(i)%fm%p(3)
226  sume=sume+p(i)%fm%p(4)
227  enddo
228  em=sqrt( sume**2 - (sumx**2+sumy**2+sumz**2) )
229  g=sume/em
230 
231  a=1.d0/(1.d0+g)
232  x=ecm/em
233  bx=-sumx/em
234  by=-sumy/em
235  bz=-sumz/em
236 !
237  do i=1, n
238  bq=bx*p(i)%fm%p(1) + by*p(i)%fm%p(2) + bz*p(i)%fm%p(3)
239  pe=x*(g*p(i)%fm%p(4) +bq)
240  tmp=p(i)%fm%p(4)+a*bq
241  px=x*(p(i)%fm%p(1) + tmp*bx)
242  py=x*(p(i)%fm%p(2) + tmp*by)
243  pz=x*(p(i)%fm%p(3) + tmp*bz)
244  p(i)%fm%p(1)=px
245  p(i)%fm%p(2)=py
246  p(i)%fm%p(3)=pz
247  p(i)%fm%p(4)=pe
248  enddo
nodes i
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
*************************block data cblkTracking *************************implicit none data *ExactThick *Freec *RatioToE0 *MagChgDist *TimeStructure *Truncn *Truncx data *IncMuonPolari *KEminObs *ThinSampling *EthinRatio *Generate em
Definition: cblkTracking.h:9
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
real * sume
Definition: Zprivate.h:1
real(4), save a
Definition: cNRLAtmos.f:20
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real pz
Definition: Zptcl.h:21
dE dx *! Nuc Int sampling table g
Definition: cblkMuInt.h:130
Definition: Zptcl.h:75
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real py
Definition: Zptcl.h:21
integer n
Definition: Zcinippxc.h:1
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real e endmap map real * x
Definition: Zptcl.h:21
Here is the caller graph for this function:

◆ cnbdc3()

subroutine cnbdc3 ( integer  n,
real*8  ecm,
type(ptcl), dimension(n p,
real*8, dimension(inm, n mu,
integer  inm,
real*8  gzai,
integer  icon 
)

Definition at line 252 of file cnbdcy.f.

References cnbdcf(), d0, and true.

Referenced by c1pion(), and cnbdcy().

252 ! get gzai to transform massive case
253 ! put inm=0 if all mu are the same.
254 ! ***********************************************
255  implicit none
256 !---- include '../Zptcl.h'
257 #include "Zptcl.h"
258  integer n, inm, icon
259  type(ptcl):: p(n)
260  real*8 ecm, mu(inm, n), gzai
261 !
262  real*8 eps/1.d-3/, f, fp, fow
263  integer nr
264 ! initial guess of gzai
265  gzai=.85d0
266  nr=0
267 ! *** until loop***
268  do while (.true.)
269  call cnbdcf(n, ecm, p, mu, inm, gzai, f, fp)
270  gzai= gzai - f/fp
271  fow=f
272  nr=nr+1
273 !$$$$$$$$$$$$
274 ! write(*,*) ' fow=',fow
275 !$$$$$$$$$$$$
276  if(abs(fow) .lt. eps .or. nr .gt. 15) goto 100
277  enddo
278  100 continue
279  if(nr .gt. 15) then
280  icon=1
281  else
282  icon=0
283  endif
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
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
subroutine cnbdcf(n, ecm, p,
Definition: cnbdcy.f:287
Definition: Zptcl.h:75
integer n
Definition: Zcinippxc.h:1
dE dx *! Nuc Int sampling table f
Definition: cblkMuInt.h:130
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cnbdc4()

subroutine cnbdc4 ( integer  n,
type(ptcl), dimension(n p,
real*8, dimension(inm, n mu,
integer  inm,
real*8  gzai 
)

Definition at line 321 of file cnbdcy.f.

Referenced by c1pion(), and cnbdcy().

321 ! tranform to massive case
322 ! *********************************************
323  implicit none
324 !---- include '../Zptcl.h'
325 #include "Zptcl.h"
326  integer n, inm
327  type(ptcl):: p(n)
328  real*8 mu(inm, n), gzai
329 
330  real*8 mux
331  integer i
332  do i=1,n
333  p(i)%fm%p(1) = gzai*p(i)%fm%p(1)
334  p(i)%fm%p(2) = gzai*p(i)%fm%p(2)
335  p(i)%fm%p(3) = gzai*p(i)%fm%p(3)
336 ! next treatment is for safty
337  if(inm .eq. 0) then
338 ! mux=mu(1,1)
339  mux=0.
340  else
341  mux=mu(1,i)
342  endif
343  p(i)%fm%p(4) = sqrt(p(i)%mass**2 +
344  * gzai**2*( p(i)%fm%p(4)**2-mux**2 ) )
345  enddo
nodes i
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
Definition: Zptcl.h:75
integer n
Definition: Zcinippxc.h:1
Here is the caller graph for this function:

◆ cnbdc5()

subroutine cnbdc5 ( integer  n,
real*8  ecm,
type(ptcl), dimension(n p,
real*8  wx 
)

Definition at line 348 of file cnbdcy.f.

References cpxyzp().

Referenced by cnbdcy().

348 ! compute weig.p(4) for massive case
349  implicit none
350 !---- include '../Zptcl.h'
351 #include "Zptcl.h"
352  integer n
353  type(ptcl):: p(n)
354  real*8 ecm, wx
355 !
356  real*8 sum1, pro2, sum3, pab
357  integer i
358 !
359  sum1=0.
360  pro2=1.
361  sum3=0.
362  do i=1, n
363  call cpxyzp(p(i)%fm, pab)
364  sum1=sum1+pab
365  pro2=pro2* pab/p(i)%fm%p(4)
366  sum3=sum3+pab**2/p(i)%fm%p(4)
367  enddo
368  wx=(sum1/ecm)**(2*n-3)*pro2 /sum3
nodes i
subroutine cpxyzp(po, pabs)
Definition: cpxyzp.f:3
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
Definition: Zptcl.h:75
integer n
Definition: Zcinippxc.h:1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cnbdc6()

subroutine cnbdc6 ( integer  n,
real*8  ecm,
real*8  w0 
)

Definition at line 371 of file cnbdcy.f.

References d0, and parameter().

Referenced by cnbdcy().

371 ! compute weig.p(4) for massless case
372  implicit none
373 !---- include '../Zptcl.h'
374 #include "Zptcl.h"
375  integer n
376  real*8 ecm, w0
377 !
378  real*8 pi, hpi, gn1
379  integer i
380  parameter(pi=3.14159265d0, hpi=pi/2)
381 !
382  gn1=1.
383  do i=1, n-2
384  gn1=gn1*i
385  enddo
386  w0= hpi**(n-1) * ecm**(2*n-4)/(n-1)/gn1/gn1
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
nodes i
common ZdedxAir w0
Definition: ZdedxAir.h:2
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
! constants thru Cosmos real * pi
Definition: Zglobalc.h:2
integer n
Definition: Zcinippxc.h:1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cnbdc7()

subroutine cnbdc7 ( integer  n,
real*8  ecm,
type(ptcl), dimension(n p,
real*8  wmax 
)

Definition at line 389 of file cnbdcy.f.

References d, and d0.

Referenced by cnbdcy().

389 ! compute max possible weig.p(4)
390  implicit none
391 !---- include '../Zptcl.h'
392 #include "Zptcl.h"
393  integer n
394  type(ptcl):: p(n)
395  real*8 ecm, wmax
396 
397  integer idx(2), nm, i
398  real*8 summ, en, beta
399 ! count massive ptcls
400  nm=0
401  do i=1,n
402  if(p(i)%mass .gt. 0.d0) then
403  nm=nm+1
404  if(nm .le. 2) then
405  idx(nm)=i
406  endif
407  endif
408  enddo
409  if(nm .eq. 1) then
410  wmax=(1. - p(idx(1))%mass/ecm)**(2*n-3)
411  elseif(nm .eq. 2) then
412  wmax=
413  * (1. + (p(idx(1))%mass/ecm)**2 -
414  * (p(idx(2))%mass/ecm)**2 )**2
415  * -4*(p(idx(1))%mass/ecm)**2
416  if(wmax .le. 0.d0)then
417  wmax=1.d-30
418  else
419  wmax= wmax**(n-1.5d0)
420  endif
421  else
422  summ=0.d0
423  do i=1, n
424  if(p(i)%mass .gt. 0.d0) then
425  en=p(i)%mass/ecm
426  summ=summ+en
427  endif
428  enddo
429  beta=1. - summ**2
430  if(beta .le. 0.d0) then
431  wmax=1.d-30
432  else
433  wmax=sqrt(beta)**(2*n+nm-5)
434  endif
435  endif
nodes i
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
Definition: Zptcl.h:75
integer n
Definition: Zcinippxc.h:1
Here is the caller graph for this function:

◆ cnbdcf()

subroutine cnbdcf ( integer  n,
real*8  ecm,
type(ptcl), dimension(n p 
)

Definition at line 287 of file cnbdcy.f.

References d0.

Referenced by cnbdc3().

287  * mu, inm, gzai, f, fp)
288 ! *********************************************
289  implicit none
290 !---- include '../Zptcl.h'
291 #include "Zptcl.h"
292  integer n, inm
293  type(ptcl):: p(n)
294  real*8 gzai, f, fp, mu(inm, n)
295 !
296  real*8 mux, fx, tmp, ecm
297  integer i
298 !
299  fx=0.d0
300  fp=0.d0
301  do i=1, n
302 ! if compiler is good, we can use mu(1,i)
303 ! even for inm=0; next is for safty.
304  if(inm .eq. 0) then
305 ! mux=mu(1,1)
306  mux=0.d0
307  else
308  mux=mu(1,i)
309  endif
310 
311  tmp= sqrt(p(i)%mass**2+
312  * gzai**2 *( p(i)%fm%p(4)**2 -mux**2 ) )
313  fx=fx + tmp
314  fp=fp + ( p(i)%fm%p(4)**2- mux**2)/ tmp
315  enddo
316  f=log(fx/ecm)
317  fp=fp*gzai/fx
nodes i
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
Definition: Zptcl.h:75
integer n
Definition: Zcinippxc.h:1
dE dx *! Nuc Int sampling table f
Definition: cblkMuInt.h:130
Here is the caller graph for this function:

◆ cnbdct()

subroutine cnbdct ( integer  n,
type(ptcl), dimension(n p 
)

Definition at line 155 of file cnbdcy.f.

References d0.

155  implicit none
156 !---- include '../Zptcl.h'
157 #include "Zptcl.h"
158  integer n
159  type(ptcl):: p(n)
160 !
161  real*8 sumx, sumy, sumz, sume
162  integer i
163 !
164  sumx=0.d0
165  sumy=0.d0
166  sumz=0.d0
167  sume=0.d0
168  do i=1, n
169  sumx=sumx+p(i)%fm%p(1)
170  sumy=sumy+p(i)%fm%p(2)
171  sumz=sumz+p(i)%fm%p(3)
172  sume=sume+p(i)%fm%p(4)
173  enddo
174  write(*,*) ' sumx,y,z=',sumx, sumy, sumz, ' sume=',sume
nodes i
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
real * sume
Definition: Zprivate.h:1
Definition: Zptcl.h:75
integer n
Definition: Zcinippxc.h:1

◆ cnbdcy()

subroutine cnbdcy ( integer  n,
real*8  ecm,
type(ptcl), dimension(n p,
integer  jw,
real*8  w,
integer  icon 
)

Definition at line 48 of file cnbdcy.f.

References cnbdc1(), cnbdc2(), cnbdc3(), cnbdc4(), cnbdc5(), cnbdc6(), cnbdc7(), rndc(), and true.

Referenced by c3pidc(), cddecay1(), cdsdecay(), cetadecay(), cetapdecay(), cg2pi(), cg3pi(), ciso(), ck3pidecay(), ckmuneupidcy2(), clambdacdcy(), cpi0decay(), and ctauneudcy().

48  implicit none
49 ! ***********************************************************
50 !
51 ! ref: CPC. 40(1986)p359. Kleiss, Stirling and Ellis
52 !
53 ! n: input. number of ptcls >=2 (see however, for n=2,
54 ! c2bdcy and for n=3, c3bdcy)
55 ! ecm: input. cms energy.
56 ! p: input. /ptcl/ p(i).mass gives the mass of the i-th ptcl
57 ! in the same unit of ecm.
58 ! output. /ptcl/ p(i).fm.p(1)
59 ! py
60 ! pz
61 ! e of the i-th ptcl
62 ! jw: input. 0--->unweighted event (w=1) obtained. the event
63 ! generated need not be discarded.
64 ! 1--> weighted event( w changes event to event )
65 ! the event must be discarded according to the
66 ! acceptance probability of w=weight/wax weight).
67 ! w: output. see jw
68 ! icon: output. 0-->event generated successfully
69 ! 1-->ecm < sum of mass
70 ! 2-->could not generate (weight problem)
71 ! With n=10 ( 6 pions, 3 kaons, 1 omega ) Ecm=5 GeV,
72 ! to get icon=0 for unweighted events,
73 ! average number of trials is 7; the distribution is
74 ! very well approximated by exp(-ntry/7)dntry
75 ! With Ecm=10 GeV, <ntry> becomes 2.1
76 ! Ecm=4 GeV, <ntry> = 13
77 ! ==============
78 ! With n=4, (2 pions, 1 kaon, 1 omega) Ecm=4 GeV,
79 ! <ntry> is almost 1
80 !---- include '../Zptcl.h'
81 #include "Zptcl.h"
82  integer n, jw, icon
83  type(ptcl):: p(n)
84  real*8 ecm, w
85 ! ------------------
86  real*8 mu(1, 1)/0.d0/, wx, w0, wmax, gzai, u
87 !
88  logical ok
89  integer nc
90 !
91  nc = 0 ! counter to break inf. loop
92 ! *** until loop***
93  do while (.true.)
94 ! generate massless ptcls isotropically without conservation
95  call cnbdc1(n, p)
96 ! conformal transformation to conserve 4-momentum
97  call cnbdc2(n, ecm, p)
98 !$$$$$$$$$$$
99 ! call cnbdct(n, p)
100 !$$$$$$$$$$
101 ! get gzai to transform massive case
102  call cnbdc3(n, ecm, p, mu, 0, gzai, icon)
103 ! **********************
104  if(icon /= 0 ) then !!!!!!!
105  write(0,*) ' icon =',icon, ' from cnbdc3'
106  endif !!!!!!!!
107  if(icon .ne. 0) return
108 ! **********************
109 ! tranform to massive case
110  call cnbdc4(n, p, mu, 0, gzai)
111 !$$$$$$$$$$$
112 ! call cnbdct(n, p)
113 !$$$$$$$$$$
114 ! compute weight for massive case
115  call cnbdc5(n, ecm,p, wx)
116 ! compute weight for massless case
117  call cnbdc6(n, ecm, w0)
118 !$$$$$$$$$$$$$$
119 ! write(*,*) ' wx=',wx,' w0=',w0
120 !$$$$$$$$$$$
121  w=wx*w0
122 ! compute max possible weight
123  call cnbdc7(n, ecm, p, wmax)
124  wmax=wmax*w0
125  if(jw .eq. 0) then
126 !$$$$$$$$$$$$$$
127 ! write(*,*) ' wmax=',wmax
128 !$$$$$$$$$$$
129 ! judge if the event is to be accepted
130  call rndc(u)
131  if(wmax .eq. 0.d0) then
132  ok=.true.
133  else
134  ok = u .lt. w/wmax
135  endif
136  w=1.
137  else
138  if(wmax .eq. 0.d0) then
139  w=1.d0
140  else
141  w=w/wmax
142  endif
143  ok=.true.
144  endif
145  if(ok) goto 100
146  nc = nc +1
147  if(nc .gt. 100) then
148  icon = 2
149  goto 100
150  endif
151  enddo
152  100 continue
subroutine cnbdc4(n, p, mu, inm, gzai)
Definition: cnbdcy.f:321
common ZdedxAir w0
Definition: ZdedxAir.h:2
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 rndc(u)
Definition: rnd.f:91
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
subroutine cnbdc7(n, ecm, p, wmax)
Definition: cnbdcy.f:389
subroutine cnbdc5(n, ecm, p, wx)
Definition: cnbdcy.f:348
subroutine cnbdc6(n, ecm, w0)
Definition: cnbdcy.f:371
subroutine cnbdc3(n, ecm, p, mu, inm, gzai, icon)
Definition: cnbdcy.f:252
subroutine cnbdc2(n, ecm, p)
Definition: cnbdcy.f:206
real cut integer nc
Definition: Zprivate.h:1
Definition: Zptcl.h:75
subroutine cnbdc1(n, p)
Definition: cnbdcy.f:177
integer n
Definition: Zcinippxc.h:1
Here is the call graph for this function:
Here is the caller graph for this function: