Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyhiovly.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyhiovly.f
1 
2 C*********************************************************************
3 
4  SUBROUTINE pyhiovly(MOVLY)
5 
6 C...Initializes multiplicity distribution and selects mutliplicity
7 C...of overlayed events, i.e. several events occuring at the same
8 C...beam crossing.
9  common/ludat1/mstu(200),paru(200),mstj(200),parj(200)
10  SAVE /ludat1/
11  common/pyhipars/mstp(200),parp(200),msti(200),pari(200)
12  SAVE /pyhipars/
13  common/pyhiint1/mint(400),vint(400)
14  SAVE /pyhiint1/
15  dimension wti(0:100)
16  SAVE imax,wti,wts
17 
18 C...Sum of allowed cross-sections for overlayed events.
19  IF(movly.EQ.1) THEN
20  vint(131)=vint(106)
21  IF(mstp(132).GE.2) vint(131)=vint(131)+vint(104)
22  IF(mstp(132).GE.3) vint(131)=vint(131)+vint(103)
23  IF(mstp(132).GE.4) vint(131)=vint(131)+vint(102)
24 
25 C...Initialize multiplicity distribution for unbiased events.
26  IF(mstp(133).EQ.1) THEN
27  xnave=vint(131)*parp(131)
28  IF(xnave.GT.40.) WRITE(mstu(11),1000) xnave
29  wti(0)=exp(-min(50.,xnave))
30  wts=0.
31  wtn=0.
32  DO 100 i=1,100
33  wti(i)=wti(i-1)*xnave/i
34  IF(i-2.5.GT.xnave.AND.wti(i).LT.1e-6) goto 110
35  wts=wts+wti(i)
36  wtn=wtn+wti(i)*i
37  100 imax=i
38  110 vint(132)=xnave
39  vint(133)=wtn/wts
40  vint(134)=wts
41 
42 C...Initialize mutiplicity distribution for biased events.
43  ELSEIF(mstp(133).EQ.2) THEN
44  xnave=vint(131)*parp(131)
45  IF(xnave.GT.40.) WRITE(mstu(11),1000) xnave
46  wti(1)=exp(-min(50.,xnave))*xnave
47  wts=wti(1)
48  wtn=wti(1)
49  DO 120 i=2,100
50  wti(i)=wti(i-1)*xnave/(i-1)
51  IF(i-2.5.GT.xnave.AND.wti(i).LT.1e-6) goto 130
52  wts=wts+wti(i)
53  wtn=wtn+wti(i)*i
54  120 imax=i
55  130 vint(132)=xnave
56  vint(133)=wtn/wts
57  vint(134)=wts
58  ENDIF
59 
60 C...Pick multiplicity of overlayed events.
61  ELSE
62  IF(mstp(133).EQ.0) THEN
63  mint(81)=max(1,mstp(134))
64  ELSE
65  wtr=wts*rlu(0)
66  DO 140 i=1,imax
67  mint(81)=i
68  wtr=wtr-wti(i)
69  IF(wtr.LE.0.) goto 150
70  140 CONTINUE
71  150 CONTINUE
72  ENDIF
73  ENDIF
74 
75 C...Format statement for error message.
76  1000 FORMAT(1x,'Warning: requested average number of events per bunch',
77  &'crossing too large, ',1p,e12.4)
78 
79  RETURN
80  END