1 #include "isajet/pilot.h"
4 C Hadronize all partons in /JETSET/ corresponding to jet JET.
6 #if defined(CERNLIB_IMPNONE)
9 #include "isajet/itapes.inc"
10 #include "isajet/primar.inc"
11 #include "isajet/jetpar.inc"
12 #include "isajet/pjets.inc"
13 #include "isajet/pinits.inc"
14 #include "isajet/partcl.inc"
15 #include "isajet/const.inc"
16 #include "isajet/jetset.inc"
17 #include "isajet/jwork.inc"
18 #include "isajet/keys.inc"
19 #include "isajet/q1q2.inc"
20 #include "isajet/frame.inc"
22 REAL ROT(3,3),POLD(5),PNEW(5),PSUM(5)
23 REAL CPHI,SPHI,AMSUM,ESUM,PJ,CTHJ,STHJ,PTJ
24 INTEGER K,K1,K2,IP,NPLV1,IFAIL,NBEGIN,JET,NFRAG,NFRGMX,JETJ,
29 C NFRAG counter protects against possible infinite loop.
40 IF(JDCAY(J).NE.0) GO TO 220
42 IF(JETJ.NE.JET) GO TO 220
45 C Generate Field-Feynman jet for each quark or gluon, or...
47 JTABS = IABS(JTYPE(J))
51 IF(NPTCL.LT.NFIRST) GO TO 220
53 C Rotate hadrons to parton direction
55 PTJ=PJSET(1,J)**2+PJSET(2,J)**2
56 PJ=SQRT(PTJ+PJSET(3,J)**2)
58 C Following is to fix occasional bug on 32-bit machines
70 CPHI=SIGN(1.,PJSET(3,J))
82 DO 230 IP=NFIRST,NPTCL
89 240 PPTCL(K1,IP)=PPTCL(K1,IP)+ROT(K1,K2)*POLD(K2)
92 C ... hadronize all other partons with delta function.
95 IF((IABS(JTYPE(J)).EQ.80.OR.IABS(JTYPE(J)).EQ.90).AND.
96 $ .NOT.KEYS(2).AND..NOT.KEYS(12)) GO TO 210
97 IF(NPTCL.GE.MXPTCL) GO TO 9999
100 PPTCL(K,NPTCL)=PJSET(K,J)
103 IDENT(NPTCL)=JTYPE(J)
108 C Sum masses and insert jet label
111 DO 260 IP=NBEGIN,NPTCL
112 AMSUM=AMSUM+PPTCL(5,IP)
113 IORIG(IP)=ISIGN(IABS(IORIG(IP))+IPACK*JET,IORIG(IP))
116 C Require sum of masses less than jet energy.
118 IF(AMSUM.GT.ESUM.AND.NBEGIN.NE.NPTCL.AND.NFRAG.LT.NFRGMX) THEN
123 C For WPAIR events rescale jet to W mass.
125 IF((KEYS(6).OR.KEYS(7).OR.KEYS(9).OR.KEYS(10)).AND.JET.LT.10)
127 IF(IABS(JTYPE(JET+N0JETS-1)).LT.80) RETURN
128 IF(AMSUM.GE.PJSET(5,JET+N0JETS-1)) THEN
129 IF(NFRAG.GT.NFRGMX) RETURN
133 PSUM(4)=PJSET(5,JET+N0JETS-1)
136 CALL RESCAL(NBEGIN,NPLV1,PSUM,IFAIL)
144 WRITE(ITLIS,9998) NPTCL
145 9998 FORMAT(//' ERROR IN FRGJET ... NPTCL > ',I6)