C   14/01/83 307091722  MEMBER NAME  RTBIN    (S)           FORTRAN
      SUBROUTINE RESULT
      COMMON/TOFWRT/NWRIT,LPOINT,TOFREC(15002)
      COMMON/ACSUMS/ NACP(20),NACM(20),ZACP(20),ZACM(20)
      COMMON/SUMS/ ZTOT(20),NTOT(20),ZOTOT(20),NOTOT(20),
     1             NRTOT(20),ZRTOT(20),NROTOT(20),ZROTOT(20)
     2             ,JTOT,JOTOT,XTOT,XOTOT
      COMMON/SING/ZEV(20,20),ZOP(20,20),NEV(20,20),NOP(20,20)
      COMMON /COUNT/ NLOP,NBIN
      COMMON/ACFAC/INDAC,ACUT(5),ACTOT(5),DBIN(20)
      COMMON//BOOK(20000)
      DIMENSION CFAC(20),XAV(5),ZHELP(20)
      LOGICAL PRFL,POK

C  3*1979/80
C  5*SPRING 81
C  4*AUTUMN 81
C  3*SPRING 82
C  3*SUMMER 82
      DATA PI/3.1420/,LBUG/0/,IW/0/
      DATA CFAC/1.18889,1.5256,1.50898,
     2          1.113,1.196,1.145,1.145,1.307,
     3          2*1.119,2*1.0655,
     4          2*1.133,1.078,
     5          3*1.090     ,2*0./
C
      DFICUT = .017
      ALFCUT = .20
      CTOF = 3.142/21.
      ZA = 1000
      ZB = 13000
      CFIC = 3.142/12.
      CALL HLIMIT(20000)
      CALL HEXTEN
      CALL HBOOK1(7,'ASYMM/ACOLL $',20,0.,.2)
      CALL HTABLE( 54,'ITP ITPL$',5,9.,14.,5,9.,14.,1023.)
      CALL HBOOK1(105,'REDUC  $',400,0.,400.)
      CALL HBOOK1(333,'REJECT $',100,0.,100.)
      CALL HBOOK1(11,'COSTET $',100,-1.,1.)
      CALL HBOOK1(21,'COSTET $',100,-1.,1.)
      CALL HBOOK1(171,20H IDTOF             $,100,-50.,50.)
      CALL HBOOK1(12,'COSTET $',20,-.85,.85)
C     CALL HBOOK1(22,'COSTET $',20,-.85,.85)
C     CALL HBOOK1(13,'COSTET $',16,-.85,.85)
C     CALL HBOOK1(14,'COSTET $',12,-.85,.85)
C     CALL HBOOK1(15,'COSTET $',10,-.85,.85)
      CALL HBOOK1(16,'COSTET $',20,-.80,.80)
      CALL HBOOK1(17,'COSTET $',16,-.80,.80)
C     CALL HBOOK1(18,'COSTET $',12,-.80,.80)
      CALL HBOOK1(19,'COSTET $',10,-.80,.80)
      CALL HBOOK1(29,'COSTET $',10,-.80,.80)
      CALL HBARX(11)
      CALL HBARX(12)
C     CALL HBARX(13)
C     CALL HBARX(14)
C     CALL HBARX(15)
      CALL HBARX(16)
      CALL HBARX(17)
C     CALL HBARX(18)
      CALL HBARX(19)
      CALL HBOOK2( 31,' RADCOR   $',40,0.,20.,40,.8,1.2)
      CALL HBOOK2( 32,10HNRUN W1  $,100,ZA,ZB,40,0.,2.)
      CALL HBOOK2( 33,10HIB DTH   $,20,0.,20.,40,0.,1.)
      CALL HBOOK2(102,10HNRUN W   $,100,ZA,ZB,40,0.,2.)
C     CALL HBOOK2(104,' IT ITL   $',40,0.,20.,40,0.,20.,127.)
C     CALL HBPRO(104)
C     CALL HBOOK2(114,' ITP DIT  $',40,0.,20.,20,-10.,10.,511.)
C     CALL HTABLE(  6,' ITP ICP $',18,0.,18.,25,0.,25.,63.)
C     CALL HBPRO(6)
C     CALL HBOOK2(821,10HPIN1 DFI $,80,-.20,.20,40,-.04,.04)
C     CALL HBOOK2(822,10HPIN1 DFI $,80,-.20,.20,40,-.04,.04)
C     CALL HBPRO(821)
C     CALL HBOOK1(823,'1/PN  CUT DFI $',80,-.2,.2)
C     CALL HBOOK1(824,'PN  CUT DFI $',80,-40.,40.)
C     CALL HBOOK1(824,' FI         $',42,0.,6.28)
C     CALL HBOOK1(825,' FI         $',42,0.,6.28)
C     CALL HBOOK2(720,10HDFI1 DFI2$,50,-.25,.25,50,-.25,.25)
C     CALL HBPROX(720)
C     CALL HBOOK1(1,'COSTET $',20,-1.,1.)
      CALL HBOOK1(826,' FI         $',100,0.,10.)
C     CALL HBOOK1(2,'COSTET $',10,-1.,1.)
      CALL HBOOK2(103,10HNRUN IB  $,100,ZA,ZB,40,0.,20.)
      CALL HBOOK1(100,10HEV S     $,100,24.,39.)
      CALL HINTEG(100,3HYES)
      CALL HBOOK1(101,10HEV NRUN  $,100,ZA,ZB)
      CALL HINTEG(101,3HYES)
C
      INDAC = 3
C
      ACUT(1) = .70
      ACUT(2) = .76
      ACUT(3) = .80
      ACUT(4) = .85
      ACUT(5) = .90
      DO  55   J=1,5
      AC = ACUT(J)
      ACTOT(J) = (AC**3/3.+AC)*3./4.
   55 CONTINUE
      DO   56   J=1,20
      DBIN(J) = .1
   56 CONTINUE
      IF(INDAC.EQ.2) DBIN(2) = .06
      IF(INDAC.EQ.2) DBIN(19) = .06
      IF(INDAC.EQ.2) DBIN(1) = 0.
      IF(INDAC.EQ.2) DBIN(20) =0.
      PRINT 155,ACUT,ACTOT
  155 FORMAT(' ACUT,ACTOT',10F12.4)
      PRINT 156,DBIN
  156 FORMAT(' DBIN ',20F5.2)
C
      CALL SETSL(ZEV,0,1600*4,0)
      CALL SETSL(ZTOT,0,164*4,0)
      CALL SETSL(XAV,0,20,0)
      CALL SETSL(NACP,0,80*4,0)
      JTOT = 0
      JOTOT = 0
      XTOT = 0.
      XOTOT = 0.
      NLOP = 18
      NSUB = NLOP
      NBIN = 12
      LUN = 25
      NIN = 0
      NACC = 0
      L = 0
   60 LPOINT = 2
      READ(LUN,END=82) TOFREC
      PRINT 125,(TOFREC(I),I=1,60)
  125 FORMAT(1X,10F12.3)
      LMAX = IFIX(TOFREC(1))
      NWRDEV = IFIX(TOFREC(2))
   80 CONTINUE
      NIN = NIN + 1
      L = L + 1
      IREJ = 0
      PRFL = .FALSE.
      EB = TOFREC(LPOINT+1)
      ZR = TOFREC(LPOINT+6)
      IF(ZR.LT.5660.)  GOTO  74
      ZZEV= TOFREC(LPOINT+9)
      CALL ELIM(ZR,ZZEV,LOUT)
      IF(LOUT.NE.0)  GOTO  81
C
   74 PCUT = EB/3.
      INDAC = 3
      IF(ZR.GT.5660.)  GOTO  76
      INDAC = 2
      PCUT = 4.
      IB = 1
      IF(EB.GE.16.81) IB = 2
      IF(EB.GE.17.59) IB = 3
      GOTO  99
   76 IF(ZR.GT.7600.)  GOTO  97
C SPRING 81
      INDAC = 2
      IB = 1+3
      IF(EB.LE.15.)  GOTO  99
      IB = 3+3
      IF(ZR.LT.6630.) IB = 2+3
      IF(ZR.GT.6989.) IB = 4+3
      IF(ZR.GE.7326.) IB = 5+3
      GOTO  99
   97 CONTINUE
C AUTUMN 81
      IF(ZR.GT.10000.)  GOTO  98
      IB = 1+8
      IF(EB.GT.17.20) IB = 2+8
      IF(ZR.GT.9152.) IB = 3+8
      IF(ZR.GT.9452.) IB = 4+8
      GOTO  99
   98 IF(ZR.GT.11000.)  GOTO  121
C SPRING 82
      IB = 1+12
      IF(EB.LT.17.4) IB = 2+12
      IF(ZR.GT.10565.) IB = 3+12
      GOTO  99
  121 IF(ZR.GT.20000.)  GOTO  99
C SUMMER 82
      IB = 1+15
      IF(ZR.GT.11472.) IB = 2+15
      IF(ZR.GT.11916.) IB = 3+15
   99 CONTINUE
C
      CALL HF1(105,(IB-1)*20.,1.)
      S = 4.*EB*EB
      T1 = TOFREC(LPOINT+2)
      T1L= TOFREC(LPOINT+7)
      T2 = TOFREC(LPOINT+3)
      T2L= TOFREC(LPOINT+8)
C     IF(T1L.GT.1..OR.T2L.GT.1.) PRFL = .TRUE.
C     IF(ABS(T1-T1L).GT..2) PRFL = .TRUE.
C     IF(ABS(T2-T2L).GT..2) PRFL = .TRUE.
      T1T = T1
      T2T = T2
      P1 = TOFREC(LPOINT+4)
      P2 = TOFREC(LPOINT+5)
      PN1 = TOFREC(LPOINT+15)
      PN2 = TOFREC(LPOINT+16)
      DFI = TOFREC(LPOINT+17)
      POK = .TRUE.
      IF(P1*P2.LT.0.)  GOTO  88
C     GOTO  81
C     PRFL = .TRUE.
      POK = .FALSE.
      CALL HF1(105,(IB-1)*20.+2.,1.)
   83 IF(ABS(DFI).GT.DFICUT)  GOTO  88
      POK = .TRUE.
      CALL HF1(105,(IB-1)*20.+4.,1.)
C     GOTO  88
      P1 =-PN1
      P2 =-PN2
   88 CONTINUE
      ITRB = IFIX(TOFREC(LPOINT+14))
   54 CONTINUE
      FI1 = TOFREC(LPOINT+10)
      FI2 = TOFREC(LPOINT+11)
      ALF = TOFREC(LPOINT+12)
C
      IF(P1*P2.GT.0..AND.PRFL) PRINT 127
  127 FORMAT(1H+,79X,'***')
C
C   MAKE ADDITIONAL CUTS HERE AND GO TO 81
C
C   CHOOSE LEAD GLASS OR TRACKS
C     T1 = T1L
C     T2 = T2L
      CALL HF1(105,(IB-1)*20.+6.,1.)
      IF(IB.GT.3.AND.IB.LE.8.AND.
     &  (ABS(T1).GT..75.OR.ABS(T2).GT..75))  GOTO  81
      IREJ = 1
      IF(ABS(T1).GT.ACUT(INDAC))  GOTO  81
      IREJ = 2
      IF(ABS(T2).GT.ACUT(INDAC))  GOTO  81
      IREJ = 3
      CALL HF1(105,(IB-1)*20.+10.,1.)
      PAV = .5*(ABS(P1)+ABS(P2))
      IF(PAV.LT.PCUT)  GOTO  81
      IREJ = 4
      CALL HF1(105,(IB-1)*20.+14.,1.)
      IF(ALF.GT.ALFCUT)  GOTO  81
      IREJ = 5
      CALL HF1(105,(IB-1)*20.+15.,1.)
      ITR1 = IAND(ITRB,16)
      ITR2 = IAND(ITRB,32)
      IF(ITR1.NE.0) CALL HF1(105,(IB-1)*20.+16.,1.)
      IF(ITR2.NE.0) CALL HF1(105,(IB-1)*20.+17.,1.)
      IF(IB.GT.3.AND.IB.LE.8.AND.ITR1.LE.0)  GOTO  81
      IREJ = 6
      IF(IB.GT.8.AND.ITR2.LE.0)  GOTO  81
      IREJ = 7
C     IF(ITR1.LE.0.OR.ITR2.NE.0)  GOTO  81
C
C CALCULATE WHICH CELL LAST POINT IS IN
      AF = 0.
      IC1 = (FI1-AF*CFIC)/CFIC+1
      IC2 = (FI2-AF*CFIC)/CFIC+1
C
C CALCULATE WHICH TOFCOUNTER LAST POINT IS IN
            NCNT1 = IFIX((FI1+CTOF/2.)/CTOF)+1
            IF(NCNT1.GE.43) NCNT1=NCNT1-42
            IF(NCNT1.LT.1) NCNT1=1
            NCNT2 = IFIX((FI2+CTOF/2.)/CTOF)+1
            IF(NCNT2.GE.43) NCNT2=NCNT2-42
            IF(NCNT2.LT.1) NCNT2=1
      IDTOF = IABS(NCNT1-NCNT2)
      CALL HF1(171,FLOAT(IDTOF)-21.,1.)
C     IF(IABS(IDTOF-21).LE.1)  GOTO 81
C
      DFI1 = FI1-(FLOAT(IC1)-.5+AF)*CFIC
      DFI2 = FI2-(FLOAT(IC2)-.5+AF)*CFIC
      CALL HFILL(720,DFI1,DFI2,1.)
C     IF(ABS(DFI1).LT..01.OR.ABS(DFI1).GT..12)  GOTO  81
C     IF(ABS(DFI2).LT..01.OR.ABS(DFI2).GT..12)  GOTO  81
C
      NACC = NACC + 1
      T = .5*(ABS(T1)+ABS(T2))
C
      TP = 100.
      IF(P1.LT.0.) TP = T1
      IF(P2.LT.0.) TP = T2
      IF(P1.GT.0.) TN = T1
      IF(P2.GT.0.) TN = T2
      FIP= 100.
      IF(P1.LT.0.) FIP=FI1
      IF(P2.LT.0.) FIP=FI2
      IF(P1.GT.0.) FIN=FI1
      IF(P2.GT.0.) FIN=FI2
      IF(P1*P2.LT.0.) CALL HFILL(821,1./PN1,DFI,1.)
      IF(P1*P2.LT.0.) CALL HFILL(821,1./PN2,DFI,1.)
      IF(T1.GT.0..AND.ABS(DFI).LT.DFICUT) CALL HF1(823,1./PN1,1.)
      IF(T2.GT.0..AND.ABS(DFI).LT.DFICUT) CALL HF1(823,1./PN2,1.)
C     IF(T1.GT.0..AND.ABS(DFI).LT.DFICUT) CALL HF1(824,PN1,1.)
C     IF(T2.GT.0..AND.ABS(DFI).LT.DFICUT) CALL HF1(824,PN2,1.)
      IF(POK)  GOTO  70
C
C  IN CASE OF EQUAL SIGNS TAKE SIGN OF SMALLER MOM
      IF(ABS(P2).GT.ABS(P1))  GOTO  71
C  P2 SMALLER
      IF(P2.LT.0.) TP = T2
      IF(P2.GT.0.) TP = T1
      IF(P2.GT.0.) TN = T2
      IF(P2.LT.0.) TN = T1
      IF(P2.LT.0.)FIP =FI2
      IF(P2.GT.0.)FIP =FI1
      IF(P2.GT.0.)FIN =FI2
      IF(P2.LT.0.)FIN =FI1
      GOTO  87
C  P1 SMALLER
   71 IF(P1.LT.0.) TP = T1
      IF(P1.GT.0.) TP = T2
      IF(P1.GT.0.) TN = T1
      IF(P1.LT.0.) TN = T2
      IF(P1.LT.0.)FIP =FI1
      IF(P1.GT.0.)FIP =FI2
      IF(P1.GT.0.)FIN =FI1
      IF(P1.LT.0.)FIN =FI2
C
   87 CONTINUE
C     PRFL = .TRUE.
      CALL HFILL(822,1./PN1,DFI,1.)
      CALL HFILL(822,1./PN2,DFI,1.)
      IF(PRFL)PRINT 126, L,IB,EB,ZR,T1,T2,PN1,PN2,S,DFI,ITRB
  126 FORMAT(2I5,F8.2,F8.0,2F8.3,2F8.1,F8.2,F7.3,I5)
C     PRFL = .FALSE.
C CHANGE SIGN OF LARGER MOM
C     IF(ABS(P1).GT.ABS(P2))  GOTO  85
C     P2 = -P2
C     GOTO  89
C  85 P1 = -P1
C  89 IF(P1.LT.0.) TP = T1
C     IF(P2.LT.0.) TP = T2
C
   70 CONTINUE
C TP IS COS THET OF POSITIVE TRACK
      ITP = (TP+.96)/.16+1
      ITN = (TN+.96)/.16+1
C T  IS AVERAGE COS(THET) OF POSITIVE AND NEG TRACK
      T = T*TP/ABS(TP)
      IT = (T+.96)/.16+1
C     ITP = IT
C     ITP = ITN
      IT1 = (T1+1.)/.1+1
      IT2 = (T2+1.)/.1+1
      ICP = IC1
      IF(ITP.EQ.IT2) ICP = IC2
C TRACK-LG CORR PLOT
      ITPL = 20
      ITPT = IT1
      IF(ABS(TP-T2).LT..001) ITPT = IT2
      IF(T1L.GT.1..OR.T2L.GT.1.)  GOTO 84
      IT1T= (T1T+1.)/.1+1
      IT1L= (T1L+1.)/.1+1
      IT2T= (T2T+1.)/.1+1
      IT2L= (T2L+1.)/.1+1
      ITPL = IT1L
      IF(ABS(TP-T2).LT..001) ITPL = IT2L
C  CHECK SIGN AT VERTICAL INCIDENCE
C     IF(ITP.NE.10.AND.ITP.NE.11)  GOTO  94
C     CALL HFILL(54,FLOAT(ITP),FLOAT(ITPL),1.)
C     LBUG = LBUG + 1
C     IF(LBUG.LE.20) PRINT 283,T1,T2,T1L,T2L,TP
C 283 FORMAT(' VERTICAL',10F10.3)
CC    IF(LBUG.LE.20) PRINT 284,IT1,IT2,IT1L,IT2L,ITP,ITPL
C 284 FORMAT(' VERTICAL',6I5)
C     IF(ITP.EQ.10.AND.ITPL.EQ.11) ITP = 11
C     IF(ITP.EQ.11.AND.ITPL.EQ.10) ITP = 10
C     IF(LBUG.LE.20) PRINT 284,ITP
C
   94 CONTINUE
C     IF(IABS(ITPT-ITPL).GT.1) PRINT 117,ZR,T1T,T2T,T1L,T2L,
C    * IT1T,IT2T,IT1L,IT2L,ITPT,ITPL
C 117 FORMAT(' TRLG',5F10.2,6I5)
   84 CALL HFILL(104,FLOAT(ITPT),FLOAT(ITPL),1.)
      DIT = FLOAT(ITPL)-FLOAT(ITPT)
      CALL HFILL(114,FLOAT(ITPT),DIT,1.)
      CALL HFILL(6,FLOAT(ITP),FLOAT(ICP),1.)
      IF(PRFL) PRINT 128, T,TP,IT,ITP
  128 FORMAT('+',87X,2F8.3,2I5)
      IF(IT.LT.1) IT=1
      IF(ITP.LT.1) ITP=1
      IF(IT.GT.20) IT=20
      IF(ITP.GT.20) ITP=20
C
      W = 1.
      DTH = .1
      IF(IB.GT.8)  GOTO  75
      IF(ITP.NE.3.AND.ITP.NE.18)  GOTO  75
      IF(IB.GT.3)  GOTO  73
      DTH = .06
      GOTO 75
   73 DTH = .05
   75 W = CFAC(IB)*RADCOR(ITP,INDAC)
C  75 W = CFAC(IB)
      CALL HFILL(31,FLOAT(ITP),RADCOR(ITP,INDAC))
      CALL HFILL(33,FLOAT(IB),DTH)
      IF(IB.LE.8)  GOTO  77
C     IF(IB.LE.15.AND.(ABS(T1).GE..75.OR.ABS(T2).GE..75)) W = W*1.13
C     IF(IB.GT.15.AND.(ABS(T1).GE..75.OR.ABS(T2).GE..75)) W = W*1.13
   77 IF(W.LE.0.)  W = 1.
      W1 = W
      W = W*.1/DTH
C     IF(ZR.LE.10564.) CALL HF1(824,FIP,1.)
C     IF(ZR.GT.10564.) CALL HF1(825,FIP,1.)
      CALL HFILL(102,ZR,W,1.)
      CALL HFILL( 32,ZR,W1,1.)
      CALL HFILL( 33,FLOAT(IB),DTH,1.)
      CALL HFILL(103,ZR,FLOAT(IB),1.)
      IF(PRFL) PRINT 132,W
  132 FORMAT('+',117X,F8.3)
      CALL HF1(100,2.*EB,1.)
      CALL HF1(101,ZR,1.)
C
C  CALCULATE AVERAGE COS THETA
      XAV(3) = XAV(3) + TP*TP*TP*W
      XAV(1) = XAV(1) + TP*W
      XAV(2) = XAV(2) + W
      CALL HFILL(11,TP,0.,W)
      CALL HFILL(12,TP,0.,W)
      CALL HFILL(22,TP,0.,1.)
      CALL HFILL(13,TP,0.,W)
      CALL HFILL(14,TP,0.,W)
      CALL HFILL(15,TP,0.,W)
      CALL HFILL(16,TP,0.,W)
      CALL HFILL(17,TP,0.,W)
      CALL HFILL(18,TP,0.,W)
      CALL HFILL(19,TP,0.,W)
      CALL HFILL(29,TP,0.,1.)
      CALL HF1(826,FIP,W1)
C
C WRITE EVENT
C
C     WRITE(39)TP,W
      IW = IW + 1
C
      NEV(ITP,IB) = NEV(ITP,IB)+1
      NTOT(IB) = NTOT(IB) + 1
      NRTOT(ITP) = NRTOT(ITP)+1
      JTOT = JTOT + 1
C
      ZEV(ITP,IB) = ZEV(ITP,IB) + W1
      ZTOT(IB) = ZTOT(IB) + W1
      ZRTOT(ITP) = ZRTOT(ITP) + W1
      XTOT = XTOT + W1
C
      IF(.NOT.POK)  GOTO  81
      NOP(ITP,IB) = NOP(ITP,IB)+1
      NOTOT(IB) = NOTOT(IB)+1
      NROTOT(ITP) = NROTOT(ITP)+1
      JOTOT = JOTOT + 1
C  DIFFERENTIAL ACCUM IN ACOLLINEARITY
      IAC = ALF/.01+1
      IF(NACC.LE.20) PRINT 407,ALF,ITP,IAC
  407 FORMAT(' IAC',F10.4,2I5)
      IF(IAC.LT. 1) IAC = 1
      IF(IAC.GT.20) IAC = 20
      IF(ITP.GT.10) NACP(IAC) = NACP(IAC) + 1
      IF(ITP.LE.10) NACM(IAC) = NACM(IAC) + 1
C
      ZOP(ITP,IB) = ZOP(ITP,IB) + W1
      ZOTOT(IB) = ZOTOT(IB) + W1
      ZROTOT(ITP) = ZROTOT(ITP) + W1
      XOTOT = XOTOT + W1
      IF(ITP.GT.10) ZACP(IAC) = ZACP(IAC) + W1
      IF(ITP.LE.10) ZACM(IAC) = ZACM(IAC) + W1
      GOTO  79
C EVENT REJECTED
   81 CALL HFILL(21,TP,0.,1.)
   79 LPOINT = LPOINT + NWRDEV
      CALL HF1(333,FLOAT(IREJ),1.)
      IF(LPOINT.LT.LMAX)  GOTO  80
      GOTO  60
C
   82 IF(IB.LT.18)  GOTO 86
      PRINT 102
      PRINT 109
  109 FORMAT(' NEV')
      DO   40   N=1,NSUB
      PRINT 124,(NEV(L,N),L=1,20),NTOT(N)
  124 FORMAT(1X,20I5,5X,I5)
   40 CONTINUE
      PRINT 102
      PRINT 124,NRTOT,JTOT
      PRINT 102
C
      PRINT 108
  108 FORMAT(' NOP')
      DO   41   N=1,NSUB
      PRINT 124,(NOP(L,N),L=1,20),NOTOT(N)
   41 CONTINUE
      PRINT 102
      PRINT 124,NROTOT,JOTOT
      PRINT 102
C
      PRINT 110
  110 FORMAT(' ZEV')
      DO   42   N=1,NSUB
      PRINT 129,(ZEV(L,N),L=1,20),ZTOT(N)
   42 CONTINUE
      PRINT 102
      PRINT 129,ZRTOT,XTOT
      PRINT 102
C
      PRINT 111
  111 FORMAT(' ZOP')
      DO   43   N=1,NSUB
      PRINT 129,(ZOP(L,N),L=1,20),ZOTOT(N)
   43 CONTINUE
      PRINT 102
      PRINT 129,ZROTOT,XOTOT
      PRINT 102
C
  129 FORMAT(1X,20F5.1,5X,F7.2)
  102 FORMAT(//)
   86 PRINT 145,LUN,NIN,NACC,IB
  145 FORMAT(//' LUN,NIN,NACC,IB ',4I10//)
      NIN = 0
      NACC = 0
      LUN = LUN + 1
      IF(LUN.LE.29)  GOTO  60
C
C     CALL SHRWRT(2,NWRDEV,TOFREC(LPOINT+1),W,DTH)
C  WRITE LAST EVENT DUMMY
      TP = -20.
      WRITE(39)TP,W

C
      PRINT 231,IW,XAV(1),XAV(2),XAV(3)
 231  FORMAT(//' XAV',I10,3F12.5//)
      CALL CROSCL
      CALL HPRERR(11,3HYES)
      CALL HPRERR(12,3HYES)
      CALL HPRERR(13,3HYES)
      CALL HPRERR(14,3HYES)
      CALL HPRERR(15,3HYES)
      CALL HPRERR(16,3HYES)
      CALL HPRERR(17,3HYES)
      CALL HPRERR(18,3HYES)
      CALL HPRERR(19,3HYES)
      CALL HISTDO
      RETURN
      END
