COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cspwpt.f
Go to the documentation of this file.
1 !c test cspwpt
2 ! include '../KKlib/rnd.f'
3 !c------------------------------------
4 ! real*8 b, p, pt
5 ! integer i
6 !
7 ! b = 1.7d0
8 ! p = 3.2d0
9 ! do i = 1, 10000
10 ! call cspwpt(b, p, pt)
11 ! write(*, *) sngl(pt)
12 ! enddo
13 ! end
14  subroutine cspwpt(b, p, pt)
15 ! sample pt from x / (x+b)**p dx
16 ! solve ( (1+x/b)(1-p) - (2-p) )(1+x/b)**(1-p) =-u
17 ! for b=3, p=15, <pt>=.5 gev.
18 ! b=3, p= 9, <pt>=1. gev.
19 ! b=6, p=15, <pt>= 1. gev
20 ! <pt>= 2*b/(p-3)
21 ! 1872 msec / 50000 (b=3, p=9)
22  real*8 b, p, pt
23 !
24  real*8 eps0/1.d-3/
25  real*8 u, x1, tmp1, tmp2, f, fp
26  call rndc(u)
27  x1=sqrt( 1. - u) /(p-1.)
28 ! *** until loop***
29  do while (.true.)
30  tmp1=(1.d0+x1)**(1.d0-p)
31  tmp2= 1.d0+(p-1.d0)*x1
32  f=tmp1* tmp2 -u
33  fp=(p-1.d0)*tmp1 * (1.d0 - tmp2/(1.d0+x1))
34  x=x1- f/fp
35  if(x .lt. 1.d0) then
36  eps=abs(x-x1)
37  else
38  eps=abs(( x-x1)/x )
39  endif
40  x1=x
41  if(eps .lt. eps0) goto 100
42  enddo
43  100 continue
44  pt=x1*b
45  end
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 cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
! 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
subroutine cspwpt(b, p, pt)
Definition: cspwpt.f:15