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

Go to the source code of this file.

Functions/Subroutines

subroutine ksmpconexp (n, sumx, xa)
 

Function/Subroutine Documentation

◆ ksmpconexp()

subroutine ksmpconexp ( integer  n,
real*8  sumx,
real*8, dimension(n xa 
)

Definition at line 22 of file ksmpConExp.f.

References rndc().

22 !
23 ! This samples x of n particles so that sum of x
24 ! becomes sumx. The pre-assumed one particle distribution of
25 ! each particle is propotional to exp(-b xi/xc) dxi
26 ! but there is a constraint of delta(sum(xi) - sumx).
27 ! sampling is can be done by using (sum-xi)^(m-2) dxi
28 ! for givne sum = sum(xi) (i=1, m)
29 ! n should be b* sumx/xc; For xc=0.1 and b=10, n=sumx*100.
30 !
31 
32  implicit none
33  integer n ! input number of particles to be generated
34  real*8 sumx ! input sum of x
35  real*8 xa(n) ! output. x of n particles generated
36 
37  real*8 x, u, xk
38  integer j
39 
40  x = sumx
41  do j = 1, n-1
42  call rndc(u)
43  xk = x*(1.0- u**(1.0/(n-j)))
44  xa(j) = xk
45  x = x - xk
46  enddo
47  xa(n) = x
subroutine rndc(u)
Definition: rnd.f:91
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
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: