Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyveto.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyveto.f
1 
2 C*********************************************************************
3 
4 C...PYVETO
5 C...Interface to UPVETO, which allows user to veto event generation
6 C...on the parton level, after parton showers but before multiple
7 C...interactions, beam remnants and hadronization is added.
8 
9  SUBROUTINE pyveto(IVETO)
10 
11 C...All real arithmetic in double precision.
12  IMPLICIT DOUBLE PRECISION(a-h, o-z)
13 C...Three Pythia functions return integers, so need declaring.
14  INTEGER pyk,pychge,pycomp
15 
16 C...PYTHIA commonblocks.
17  common/pyjets/n,npad,k(4000,5),p(4000,5),v(4000,5)
18  common/pypars/mstp(200),parp(200),msti(200),pari(200)
19  common/pydat1/mstu(200),paru(200),mstj(200),parj(200)
20  common/pyint1/mint(400),vint(400)
21  SAVE /pyjets/,/pypars/,/pyint1/
22 C...HEPEVT commonblock.
23  parameter(nmxhep=4000)
24  common/hepevt/nevhep,nhep,isthep(nmxhep),idhep(nmxhep),
25  &jmohep(2,nmxhep),jdahep(2,nmxhep),phep(5,nmxhep),vhep(4,nmxhep)
26  DOUBLE PRECISION phep,vhep
27  SAVE /hepevt/
28 C...Local array.
29  dimension ireso(100)
30 
31 C...Define longitudinal boost from initiator rest frame to cm frame.
32  gamma=0.5d0*(vint(141)+vint(142))/sqrt(vint(141)*vint(142))
33  gabez=0.5d0*(vint(141)-vint(142))/sqrt(vint(141)*vint(142))
34 
35 C... Reset counters.
36  nevhep=0
37  nhep=0
38  nreso=0
39 
40 C...Oth pass: identify beam and incoming partons
41  DO 140 i=mint(83)+1,mint(83)+6
42  istore=0
43  IF(k(i,2).EQ.94) THEN
44 
45  ELSE
46  istore=1
47  nhep=nhep+1
48  ii=nhep
49  nreso=nreso+1
50  ireso(nreso)=i
51  imoth=k(i,3)
52  ENDIF
53  IF(istore.EQ.1) THEN
54 C...Copy parton info, boosting momenta along z axis to cm frame.
55  isthep(ii)=2
56  idhep(ii)=k(i,2)
57  phep(1,ii)=p(i,1)
58  phep(2,ii)=p(i,2)
59  phep(3,ii)=gamma*p(i,3)+gabez*p(i,4)
60  phep(4,ii)=gamma*p(i,4)+gabez*p(i,3)
61  phep(5,ii)=p(i,5)
62 C...Store one mother. Rest of history and vertex info zeroed.
63  jmohep(1,ii)=imoth
64  jmohep(2,ii)=0
65  jdahep(1,ii)=0
66  jdahep(2,ii)=0
67  vhep(1,ii)=0d0
68  vhep(2,ii)=0d0
69  vhep(3,ii)=0d0
70  vhep(4,ii)=0d0
71  ENDIF
72  140 CONTINUE
73 
74 C...First pass: identify final locations of resonances
75 C...and of their daughters before showering.
76  DO 150 i=mint(84)+3,n
77  istore=0
78  imoth=0
79 
80 C...Skip shower CM frame documentation lines.
81  IF(k(i,2).EQ.94) THEN
82 
83 C... Store a new intermediate product, when mother in documentation.
84  ELSEIF(mstp(128).EQ.0.AND.k(i,3).GT.mint(83)+6.AND.
85  & k(i,3).LE.mint(84)) THEN
86  istore=1
87  nhep=nhep+1
88  ii=nhep
89  nreso=nreso+1
90  ireso(nreso)=i
91  imoth=k(k(i,3),3)
92 
93 C... Store a new intermediate product, when mother in main section.
94  ELSEIF(mstp(128).EQ.1.AND.k(i-mint(84)+mint(83)+4,1).EQ.21.AND.
95  & k(i-mint(84)+mint(83)+4,2).EQ.k(i,2)) THEN
96  istore=1
97  nhep=nhep+1
98  ii=nhep
99  nreso=nreso+1
100  ireso(nreso)=i
101  imoth=max(0,k(i-mint(84)+mint(83)+4,3))
102  ENDIF
103 
104  IF(istore.EQ.1) THEN
105 C...Copy parton info, boosting momenta along z axis to cm frame.
106  isthep(ii)=2
107  idhep(ii)=k(i,2)
108  phep(1,ii)=p(i,1)
109  phep(2,ii)=p(i,2)
110  phep(3,ii)=gamma*p(i,3)+gabez*p(i,4)
111  phep(4,ii)=gamma*p(i,4)+gabez*p(i,3)
112  phep(5,ii)=p(i,5)
113 C...Store one mother. Rest of history and vertex info zeroed.
114  jmohep(1,ii)=imoth
115  jmohep(2,ii)=0
116  jdahep(1,ii)=i
117  jdahep(2,ii)=0
118  vhep(1,ii)=0d0
119  vhep(2,ii)=0d0
120  vhep(3,ii)=0d0
121  vhep(4,ii)=0d0
122  ENDIF
123  150 CONTINUE
124 
125 C...Second pass: identify current set of "final" partons.
126  DO 200 i=mint(84)+3,n
127  istore=0
128  imoth=0
129 
130 C...Store a final parton.
131  IF(k(i,1).GE.1.AND.k(i,1).LE.10) THEN
132  istore=1
133  nhep=nhep+1
134  ii=nhep
135 C..Trace it back through shower, to check if from documented particle.
136  ihist=i
137  isave=ihist
138  160 CONTINUE
139  IF(ihist.GT.mint(84)) THEN
140  IF(k(ihist,2).EQ.94) ihist=k(ihist,3)+(isave-1-ihist)
141  DO 170 iri=1,nreso
142  IF(ihist.EQ.ireso(iri)) imoth=iri
143  170 CONTINUE
144  isave=ihist
145  ihist=k(ihist,3)
146  IF(imoth.EQ.0) goto 160
147  ELSEIF(ihist.LE.4) THEN
148  IF(ihist.EQ.1.OR.ihist.EQ.2) THEN
149  istore=0
150  nhep=nhep-1
151  ELSE
152  imoth=ihist
153  ENDIF
154  ENDIF
155  ENDIF
156 
157  IF(istore.EQ.1) THEN
158 C...Copy parton info, boosting momenta along z axis to cm frame.
159  isthep(ii)=1
160  idhep(ii)=k(i,2)
161  phep(1,ii)=p(i,1)
162  phep(2,ii)=p(i,2)
163  phep(3,ii)=gamma*p(i,3)+gabez*p(i,4)
164  phep(4,ii)=gamma*p(i,4)+gabez*p(i,3)
165  phep(5,ii)=p(i,5)
166 C...Store one mother. Rest of history and vertex info zeroed.
167  jmohep(1,ii)=imoth
168  jmohep(2,ii)=0
169  jdahep(1,ii)=0
170  jdahep(2,ii)=0
171  vhep(1,ii)=0d0
172  vhep(2,ii)=0d0
173  vhep(3,ii)=0d0
174  vhep(4,ii)=0d0
175  ENDIF
176  200 CONTINUE
177 
178 C...Call user-written routine to decide whether to keep events.
179  CALL upveto(iveto)
180 
181  RETURN
182  END