Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pypile.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pypile.f
1 
2 C*********************************************************************
3 
4 C...PYPILE
5 C...Initializes multiplicity distribution and selects mutliplicity
6 C...of pileup events, i.e. several events occuring at the same
7 C...beam crossing.
8 
9  SUBROUTINE pypile(MPILE)
10 
11 C...Double precision and integer declarations.
12  IMPLICIT DOUBLE PRECISION(a-h, o-z)
13  IMPLICIT INTEGER(i-n)
14  INTEGER pyk,pychge,pycomp
15 C...Commonblocks.
16  common/pydat1/mstu(200),paru(200),mstj(200),parj(200)
17  common/pypars/mstp(200),parp(200),msti(200),pari(200)
18  common/pyint1/mint(400),vint(400)
19  common/pyint7/sigt(0:6,0:6,0:5)
20  SAVE /pydat1/,/pypars/,/pyint1/,/pyint7/
21 C...Local arrays and saved variables.
22  dimension wti(0:200)
23  SAVE imin,imax,wti,wts
24 
25 C...Sum of allowed cross-sections for pileup events.
26  IF(mpile.EQ.1) THEN
27  vint(131)=sigt(0,0,5)
28  IF(mstp(132).GE.2) vint(131)=vint(131)+sigt(0,0,4)
29  IF(mstp(132).GE.3) vint(131)=vint(131)+sigt(0,0,2)+sigt(0,0,3)
30  IF(mstp(132).GE.4) vint(131)=vint(131)+sigt(0,0,1)
31  IF(mstp(133).LE.0) RETURN
32 
33 C...Initialize multiplicity distribution at maximum.
34  xnave=vint(131)*parp(131)
35  IF(xnave.GT.120d0) WRITE(mstu(11),5000) xnave
36  inave=max(1,min(200,nint(xnave)))
37  wti(inave)=1d0
38  wts=wti(inave)
39  wtn=wti(inave)*inave
40 
41 C...Find shape of multiplicity distribution below maximum.
42  imin=inave
43  DO 100 i=inave-1,1,-1
44  IF(mstp(133).EQ.1) wti(i)=wti(i+1)*(i+1)/xnave
45  IF(mstp(133).GE.2) wti(i)=wti(i+1)*i/xnave
46  IF(wti(i).LT.1d-6) goto 110
47  wts=wts+wti(i)
48  wtn=wtn+wti(i)*i
49  imin=i
50  100 CONTINUE
51 
52 C...Find shape of multiplicity distribution above maximum.
53  110 imax=inave
54  DO 120 i=inave+1,200
55  IF(mstp(133).EQ.1) wti(i)=wti(i-1)*xnave/i
56  IF(mstp(133).GE.2) wti(i)=wti(i-1)*xnave/(i-1)
57  IF(wti(i).LT.1d-6) goto 130
58  wts=wts+wti(i)
59  wtn=wtn+wti(i)*i
60  imax=i
61  120 CONTINUE
62  130 vint(132)=xnave
63  vint(133)=wtn/wts
64  IF(mstp(133).EQ.1.AND.imin.EQ.1) vint(134)=
65  & wts/(wts+wti(1)/xnave)
66  IF(mstp(133).EQ.1.AND.imin.GT.1) vint(134)=1d0
67  IF(mstp(133).GE.2) vint(134)=xnave
68 
69 C...Pick multiplicity of pileup events.
70  ELSE
71  IF(mstp(133).LE.0) THEN
72  mint(81)=max(1,mstp(134))
73  ELSE
74  wtr=wts*pyr(0)
75  DO 140 i=imin,imax
76  mint(81)=i
77  wtr=wtr-wti(i)
78  IF(wtr.LE.0d0) goto 150
79  140 CONTINUE
80  150 CONTINUE
81  ENDIF
82  ENDIF
83 
84 C...Format statement for error message.
85  5000 FORMAT(1x,'Warning: requested average number of events per bunch',
86  &'crossing too large, ',1p,d12.4)
87 
88  RETURN
89  END