2 C*********************************************************************
4 SUBROUTINE LUTEST(MTEST)
6 C...Purpose: to provide a simple program (disguised as subroutine) to
7 C...run at installation as a check that the program works as intended.
8 COMMON/LUJETS/N,K(4000,5),P(4000,5),V(4000,5)
9 COMMON/LUDAT1/MSTU(200),PARU(200),MSTJ(200),PARJ(200)
10 SAVE /LUJETS/,/LUDAT1/
11 DIMENSION PSUM(5),PINI(6),PFIN(6)
13 C...Loop over events to be generated.
14 IF(MTEST.GE.1) CALL LUTABU(20)
18 C...Reset parameter values. Switch on some nonstandard features.
33 IF(IEV.EQ.301.OR.IEV.EQ.351.OR.IEV.EQ.401) MSTJ(116)=3
35 C...Ten events each for some single jets configurations.
39 IF(ITY.EQ.3.OR.ITY.EQ.4) MSTJ(11)=2
40 IF(ITY.EQ.1) CALL LU1ENT(1,1,15.,0.,0.)
41 IF(ITY.EQ.2) CALL LU1ENT(1,3101,15.,0.,0.)
42 IF(ITY.EQ.3) CALL LU1ENT(1,-2203,15.,0.,0.)
43 IF(ITY.EQ.4) CALL LU1ENT(1,-4,30.,0.,0.)
44 IF(ITY.EQ.5) CALL LU1ENT(1,21,15.,0.,0.)
46 C...Ten events each for some simple jet systems; string fragmentation.
47 ELSEIF(IEV.LE.130) THEN
49 IF(ITY.EQ.1) CALL LU2ENT(1,1,-1,40.)
50 IF(ITY.EQ.2) CALL LU2ENT(1,4,-4,30.)
51 IF(ITY.EQ.3) CALL LU2ENT(1,2,2103,100.)
52 IF(ITY.EQ.4) CALL LU2ENT(1,21,21,40.)
53 IF(ITY.EQ.5) CALL LU3ENT(1,2101,21,-3203,30.,0.6,0.8)
54 IF(ITY.EQ.6) CALL LU3ENT(1,5,21,-5,40.,0.9,0.8)
55 IF(ITY.EQ.7) CALL LU3ENT(1,21,21,21,60.,0.7,0.5)
56 IF(ITY.EQ.8) CALL LU4ENT(1,2,21,21,-2,40.,0.4,0.64,0.6,0.12,0.2)
58 C...Seventy events with independent fragmentation and momentum cons.
59 ELSEIF(IEV.LE.200) THEN
61 MSTJ(2)=1+MOD(IEV-131,4)
62 MSTJ(3)=1+MOD((IEV-131)/4,4)
63 IF(ITY.EQ.1) CALL LU2ENT(1,4,-5,40.)
64 IF(ITY.EQ.2) CALL LU3ENT(1,3,21,-3,40.,0.9,0.4)
65 IF(ITY.EQ.3) CALL LU4ENT(1,2,21,21,-2,40.,0.4,0.64,0.6,0.12,0.2)
66 IF(ITY.GE.4) CALL LU4ENT(1,2,-3,3,-2,40.,0.4,0.64,0.6,0.12,0.2)
68 C...A hundred events with random jets (check invariant mass).
69 ELSEIF(IEV.LE.300) THEN
76 IF(I.EQ.1) KFL=INT(1.+4.*RLU(0))
77 IF(I.EQ.NJET) KFL=-INT(1.+4.*RLU(0))
79 THETA=ACOS(2.*RLU(0)-1.)
81 IF(I.LT.NJET) CALL LU1ENT(-I,KFL,EJET,THETA,PHI)
82 IF(I.EQ.NJET) CALL LU1ENT(I,KFL,EJET,THETA,PHI)
83 IF(I.EQ.1.OR.I.EQ.NJET) MSTJ(93)=1
84 IF(I.EQ.1.OR.I.EQ.NJET) PSUM(5)=PSUM(5)+ULMASS(KFL)
86 PSUM(J)=PSUM(J)+P(I,J)
89 IF(PSUM(4)**2-PSUM(1)**2-PSUM(2)**2-PSUM(3)**2.LT.
90 & (PSUM(5)+PARJ(32))**2) GOTO 100
92 C...Fifty e+e- continuum events with matrix elements.
93 ELSEIF(IEV.LE.350) THEN
97 C...Fifty e+e- continuum event with varying shower options.
98 ELSEIF(IEV.LE.400) THEN
100 MSTJ(43)=1+MOD(IEV/2,4)
101 MSTJ(44)=MOD(IEV/8,3)
104 C...Fifty e+e- continuum events with coherent shower, including top.
105 ELSEIF(IEV.LE.450) THEN
109 C...Fifty Upsilon decays to ggg or gammagg with coherent shower.
110 ELSEIF(IEV.LE.500) THEN
113 C...One decay each for some heavy mesons.
114 ELSEIF(IEV.LE.560) THEN
119 CALL LU1ENT(1,100*KFLB+10*KFLC+KFLS,0.,0.,0.)
121 C...One decay each for some heavy baryons.
122 ELSEIF(IEV.LE.600) THEN
128 CALL LU1ENT(1,1000*KFLA+100*KFLB+10*KFLC+KFLS,0.,0.,0.)
131 C...Generate event. Find total momentum, energy and charge.
142 C...Check conservation of energy, momentum and charge;
143 C...usually exact, but only approximate for single jets.
146 IF((PFIN(1)-PINI(1))**2+(PFIN(2)-PINI(2))**2.GE.4.) MERR=MERR+1
147 EPZREM=PINI(4)+PINI(3)-PFIN(4)-PFIN(3)
148 IF(EPZREM.LT.0..OR.EPZREM.GT.2.*PARJ(31)) MERR=MERR+1
149 IF(ABS(PFIN(6)-PINI(6)).GT.2.1) MERR=MERR+1
152 IF(ABS(PFIN(J)-PINI(J)).GT.0.0001*PINI(4)) MERR=MERR+1
154 IF(ABS(PFIN(6)-PINI(6)).GT.0.1) MERR=MERR+1
156 IF(MERR.NE.0) WRITE(MSTU(11),5000) (PINI(J),J=1,4),PINI(6),
157 &(PFIN(J),J=1,4),PFIN(6)
159 C...Check that all KF codes are known ones, and that partons/particles
160 C...satisfy energy-momentum-mass relation. Store particle statistics.
162 IF(K(I,1).GT.20) GOTO 170
163 IF(LUCOMP(K(I,2)).EQ.0) THEN
164 WRITE(MSTU(11),5100) I
167 PD=P(I,4)**2-P(I,1)**2-P(I,2)**2-P(I,3)**2-P(I,5)**2
168 IF(ABS(PD).GT.MAX(0.1,0.001*P(I,4)**2).OR.P(I,4).LT.0.) THEN
169 WRITE(MSTU(11),5200) I
173 IF(MTEST.GE.1) CALL LUTABU(21)
175 C...List all erroneous events and some normal ones.
176 IF(MERR.NE.0.OR.MSTU(24).NE.0.OR.MSTU(28).NE.0) THEN
178 ELSEIF(MTEST.GE.1.AND.MOD(IEV-5,100).EQ.0) THEN
182 C...Stop execution if too many errors.
183 IF(MERR.NE.0) NERR=NERR+1
185 WRITE(MSTU(11),5300) IEV
190 C...Summarize result of run.
191 IF(MTEST.GE.1) CALL LUTABU(22)
192 IF(NERR.EQ.0) WRITE(MSTU(11),5400)
193 IF(NERR.GT.0) WRITE(MSTU(11),5500) NERR
195 C...Reset commonblock variables changed during run.
204 C...Format statements for output.
205 5000 FORMAT(/' Momentum, energy and/or charge were not conserved ',
206 &'in following event'/' sum of',9X,'px',11X,'py',11X,'pz',11X,
207 &'E',8X,'charge'/' before',2X,4(1X,F12.5),1X,F8.2/' after',3X,
208 &4(1X,F12.5),1X,F8.2)
209 5100 FORMAT(/5X,'Entry no.',I4,' in following event not known code')
210 5200 FORMAT(/5X,'Entry no.',I4,' in following event has faulty ',
212 5300 FORMAT(/5X,'Ten errors experienced by event ',I3/
213 &5X,'Something is seriously wrong! Execution stopped now!')
214 5400 FORMAT(//5X,'End result of LUTEST: no errors detected.')
215 5500 FORMAT(//5X,'End result of LUTEST:',I2,' errors detected.'/
216 &5X,'This should not have happened!')