Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pymihg.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pymihg.f
1 
2 *********************************************************************
3 
4 C...PYMIHG
5 C...Collapse JCP1 and connecting tags to JCG1.
6 C...Collapse JCP2 and connecting tags to JCG2.
7 
8  SUBROUTINE pymihg(JCP1,JCG1,JCP2,JCG2)
9 C...Double precision and integer declarations.
10  IMPLICIT DOUBLE PRECISION(a-h, o-z)
11  IMPLICIT INTEGER(i-n)
12  INTEGER pyk,pychge,pycomp
13 C...The event record
14  common/pyjets/n,npad,k(4000,5),p(4000,5),v(4000,5)
15 C...Parameters
16  common/pyint1/mint(400),vint(400)
17  SAVE /pyjets/,/pyint1/
18 C...Local variables
19  COMMON /pycbls/mco(4000,2),ncc,jcco(4000,2),jccn(4000,2),maccpt
20  COMMON /pyctag/nct,mct(4000,2)
21  SAVE /pycbls/,/pyctag/
22 
23 C...Break up JCP1<->JCP2 tag and create JCP1<->JCG1 and JCP2<->JCG2 tags
24 C...in temporary tag collapse array JCCN. Only break up one connection.
25  maccpt=1
26  mclps=0
27  DO 100 icc=1,ncc
28  jccn(icc,1)=jcco(icc,1)
29  jccn(icc,2)=jcco(icc,2)
30 C...If there was a mother, it was previously connected to JCP1.
31 C...Should be changed to JCP2.
32  IF (mclps.EQ.0) THEN
33  IF (jccn(icc,1).EQ.max(jcp1,jcp2).AND.jccn(icc,2).EQ.min(jcp1
34  & ,jcp2)) THEN
35  jccn(icc,1)=max(jcg2,jcp2)
36  jccn(icc,2)=min(jcg2,jcp2)
37  mclps=1
38  ENDIF
39  ENDIF
40  100 CONTINUE
41 C...Also collapse colours on JCP1 side of JCG1
42  IF (jcp1.NE.0) THEN
43  jccn(ncc+1,1)=max(jcp1,jcg1)
44  jccn(ncc+1,2)=min(jcp1,jcg1)
45  ELSE
46  jccn(ncc+1,1)=max(jcp2,jcg2)
47  jccn(ncc+1,2)=min(jcp2,jcg2)
48  ENDIF
49 
50 C...Initialize event record colour tag array MCT array to MCO.
51  DO 110 i=mint(84)+1,n
52  mct(i,1)=mco(i,1)
53  mct(i,2)=mco(i,2)
54  110 CONTINUE
55 
56 C...Collapse tags:
57 C...IS = 1 : All tags connecting to JCG1 on JCG1 side -> JCG1
58 C...IS = 2 : All tags connecting to JCG2 on JCG2 side -> JCG2
59 C...IS = 3 : All tags connecting to JCG1 on JCP1 side -> JCG1
60 C...IS = 4 : All tags connecting to JCG2 on JCP2 side -> JCG2
61  DO 160 is=1,4
62 C...Skip if junction.
63  IF ((is.EQ.4.AND.jcp2.EQ.0).OR.(is.EQ.3).AND.jcp1.EQ.0) goto 160
64 C...Define starting point in tag space.
65 C...JCA = previous tag
66 C...JCO = present tag
67 C...JCN = new tag
68  IF (mod(is,2).EQ.1) THEN
69  jco=jcp1
70  jcn=jcg1
71  jcall=jcg1
72  ELSEIF (mod(is,2).EQ.0) THEN
73  jco=jcp2
74  jcn=jcg2
75  jcall=jcg2
76  ENDIF
77  itrace=0
78  120 itrace=itrace+1
79  IF (itrace.GT.1000) THEN
80 C...NB: Proper error message should be defined here.
81  CALL pyerrm(14
82  & ,'(PYMIHG:) Inf loop when collapsing colours.')
83  mint(57)=mint(57)+1
84  mint(51)=1
85  RETURN
86  ENDIF
87 C...Collapse all JCN tags to JCALL
88  DO 130 i=mint(84)+1,n
89  IF (mco(i,1).EQ.jcn) mct(i,1)=jcall
90  IF (mco(i,2).EQ.jcn) mct(i,2)=jcall
91  130 CONTINUE
92 C...IS = 1,2: first step forward. IS = 3,4: first step backward.
93  IF (is.GT.2.AND.(jcn.EQ.jcall)) THEN
94  jca=jcn
95  jcn=jco
96  ELSE
97  jca=jco
98  jco=jcn
99  ENDIF
100 C...If possible, step from JCO to new tag JCN not equal to JCA.
101  DO 140 icc=1,ncc+1
102  IF (jccn(icc,1).EQ.jco.AND.jccn(icc,2).NE.jca) jcn=
103  & jccn(icc,2)
104  IF (jccn(icc,2).EQ.jco.AND.jccn(icc,1).NE.jca) jcn=
105  & jccn(icc,1)
106  140 CONTINUE
107 C...Iterate if new colour was arrived at, but don't go in circles.
108  IF (jcn.NE.jco.AND.jcn.NE.jcall) goto 120
109 C...Change all JCN tags in MCO to JCALL in MCT.
110  DO 150 i=mint(84)+1,n
111  IF (mco(i,1).EQ.jcn) mct(i,1)=jcall
112  IF (mco(i,2).EQ.jcn) mct(i,2)=jcall
113 C...If gluon and colour tag = anticolour tag (and not = 0) try again.
114  IF (k(i,2).EQ.21.AND.mct(i,1).EQ.mct(i,2).AND.mct(i,1)
115  & .NE.0) maccpt=0
116  150 CONTINUE
117  160 CONTINUE
118 
119  DO 200 jcl=nct,1,-1
120  jca=0
121  jcn=jcl
122  170 jco=jcn
123  DO 180 icc=1,ncc+1
124  IF (jccn(icc,1).EQ.jco.AND.jccn(icc,2).NE.jca) jcn
125  & =jccn(icc,2)
126  IF (jccn(icc,2).EQ.jco.AND.jccn(icc,1).NE.jca) jcn
127  & =jccn(icc,1)
128  180 CONTINUE
129 C...Overpaint all JCN with JCL
130  IF (jcn.NE.jco.AND.jcn.NE.jcl) THEN
131  DO 190 i=mint(84)+1,n
132  IF (mct(i,1).EQ.jcn) mct(i,1)=jcl
133  IF (mct(i,2).EQ.jcn) mct(i,2)=jcl
134 C...If gluon and colour tag = anticolour tag (and not = 0) try again.
135  IF (k(i,2).EQ.21.AND.mct(i,1).EQ.mct(i,2).AND.mct(i,1)
136  & .NE.0) maccpt=0
137  190 CONTINUE
138  jca=jco
139  goto 170
140  ENDIF
141  200 CONTINUE
142 
143  RETURN
144  END