Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pycttr.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pycttr.f
1 C*********************************************************************
2 
3 C...PYCTTR
4 C...Adapted from PYPREP.
5 C...Assigns LHA1 colour tags to coloured partons based on
6 C...K(I,4) and K(I,5) colour connection record.
7 C...KCS negative signifies that a previous tracing should be continued.
8 C...(in case the tag to be continued is empty, the routine exits)
9 C...Starts at I and ends at I or IEND.
10 C...Special considerations for systems with junctions.
11 
12  SUBROUTINE pycttr(I,KCS,IEND)
13 C...Double precision and integer declarations.
14  IMPLICIT DOUBLE PRECISION(a-h, o-z)
15  INTEGER pyk,pychge,pycomp
16 C...Commonblocks.
17  common/pyjets/n,npad,k(4000,5),p(4000,5),v(4000,5)
18  common/pydat1/mstu(200),paru(200),mstj(200),parj(200)
19  common/pydat2/kchg(500,4),pmas(500,4),parf(2000),vckm(4,4)
20  common/pyint1/mint(400),vint(400)
21 C...The common block of colour tags.
22  common/pyctag/nct,mct(4000,2)
23  SAVE /pyjets/,/pydat1/,/pydat2/,/pyint1/,/pyctag/
24  DATA nerrpr/0/
25  SAVE nerrpr
26 
27 C...Skip if parton not existing or does not have KCS
28  IF (k(i,1).LE.0) goto 120
29  kc=pycomp(k(i,2))
30  IF (kc.EQ.0) goto 120
31  kq=kchg(kc,2)
32  IF (kq.EQ.0) goto 120
33  IF (iabs(kq).EQ.1.AND.kq*(9-2*abs(kcs)).NE.isign(1,k(i,2)))
34  & goto 120
35 
36  IF (kcs.GT.0) THEN
37  nct=nct+1
38 C...Set colour tag of first parton.
39  mct(i,kcs-3)=nct
40  ncs=nct
41  ELSE
42  kcs=-kcs
43  ncs=mct(i,kcs-3)
44  IF (ncs.EQ.0) goto 120
45  ENDIF
46 
47  ia=i
48  nstp=0
49  100 nstp=nstp+1
50  IF(nstp.GT.4*n) THEN
51  CALL pyerrm(14,'(PYCTTR:) caught in infinite loop')
52  goto 120
53  ENDIF
54 
55 C...Finished if reached final-state triplet.
56  IF(k(ia,1).EQ.3) THEN
57  IF(nstp.GE.2.AND.kchg(pycomp(k(ia,2)),2).NE.2) goto 120
58  ENDIF
59 
60 C...Also finished if reached junction.
61  IF(k(ia,1).EQ.42) THEN
62  goto 120
63  ENDIF
64 
65 C...GOTO next parton in colour space.
66  110 ib=ia
67 C...If IB's KCS daughter not traced and exists, goto KCS daughter.
68  IF(mod(k(ib,kcs)/mstu(5)**2,2).EQ.0.AND.mod(k(ib,kcs),mstu(5))
69  & .NE.0) THEN
70  ia=mod(k(ib,kcs),mstu(5))
71  k(ib,kcs)=k(ib,kcs)+mstu(5)**2
72  mrev=0
73  ELSE
74 C...If KCS mother traced or KCS mother nonexistent, switch colour.
75  IF(k(ib,kcs).GE.2*mstu(5)**2.OR.mod(k(ib,kcs)/mstu(5),
76  & mstu(5)).EQ.0) THEN
77  kcs=9-kcs
78  nct=nct+1
79  ncs=nct
80 C...Assign new colour tag on other side of old parton.
81  mct(ib,kcs-3)=nct
82  ENDIF
83 C...Goto (new) KCS mother, set mother traced tag
84  ia=mod(k(ib,kcs)/mstu(5),mstu(5))
85  k(ib,kcs)=k(ib,kcs)+2*mstu(5)**2
86  mrev=1
87  ENDIF
88  IF(ia.LE.0.OR.ia.GT.n) THEN
89  CALL pyerrm(12,'(PYCTTR:) colour tag tracing failed')
90  IF(nerrpr.LT.5) THEN
91  write(*,*) 'began at ',i
92  write(*,*) 'ended going from', ib, ' to', ia, ' KCS=',kcs,
93  & ' NCS=',ncs,' MREV=',mrev
94  CALL pylist(4)
95  nerrpr=nerrpr+1
96  ENDIF
97  mint(51)=1
98  RETURN
99  ENDIF
100  IF(mod(k(ia,4)/mstu(5),mstu(5)).EQ.ib.OR.mod(k(ia,5)/mstu(5),
101  & mstu(5)).EQ.ib) THEN
102  IF(mrev.EQ.1) kcs=9-kcs
103  IF(mod(k(ia,kcs)/mstu(5),mstu(5)).NE.ib) kcs=9-kcs
104 C...Set KSC mother traced tag for IA
105  k(ia,kcs)=k(ia,kcs)+2*mstu(5)**2
106  ELSE
107  IF(mrev.EQ.0) kcs=9-kcs
108  IF(mod(k(ia,kcs),mstu(5)).NE.ib) kcs=9-kcs
109 C...Set KCS daughter traced tag for IA
110  k(ia,kcs)=k(ia,kcs)+mstu(5)**2
111  ENDIF
112 C...Assign new colour tag
113  mct(ia,kcs-3)=ncs
114  IF(ia.NE.i.AND.ia.NE.iend) goto 100
115 
116  120 RETURN
117  END