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

Go to the source code of this file.

Functions/Subroutines

subroutine kbinom (p, n, nb)
 

Function/Subroutine Documentation

◆ kbinom()

subroutine kbinom ( real*8  p,
integer  n,
integer  nb 
)

Definition at line 26 of file kbinom.f.

References kgauss(), rndc(), and true.

Referenced by csampintenuc().

26  implicit none
27  real*8 p
28  integer n, nb
29 
30  real*8 av, s, x, u
31  integer i
32 !
33  nb=0
34  if(n .gt. 20 .and. p .gt. .25 .and. p .lt. .75) then
35  av=p*n
36  s=sqrt(p*n*(1.-p))
37 ! *** until loop***
38  do while (.true.)
39  call kgauss(av, s, x)
40  nb=x+.5
41  if(nb .ge. 0 .and. nb .le. n) goto 100
42  enddo
43  100 continue
44  else
45  do i=1, n
46  call rndc(u)
47  if(u .le. p) then
48  nb=nb+1
49  endif
50  enddo
51  endif
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
subroutine kgauss(m, v, g1)
Definition: kgauss.f:10
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 call graph for this function:
Here is the caller graph for this function: