C   25/02/80 102141944  MEMBER NAME  TOFSM2   (S)           FORTRAN
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
       SUBROUTINE TOFSM2 
C
C           COMPUTES ROUGH TOF (NO PULSEHEIGHT CORRECTION
C           NO Z-DEPENDENCE)
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
      IMPLICIT INTEGER*2 (H)
C PMF 03.11.98 
      LOGICAL TBIT
      COMMON/TFPRM/ NRNC1,NRNC2,DYC(4),IFLC(42),CM(42),CP(42),
     -DTAU(42),WM(42),WP(42),SV(42),DM(42),DP(42),PEDLM(42),PEDLP(42)
      COMMON/SMPTOF/MTOF,TTOF(42),NTOF,HTOF(42)
      COMMON/BCS/IDATA(1)
      DIMENSION HDATA(2),HELP(2)
      EQUIVALENCE  (HDATA(1),IDATA(1)),(ICAMWD,HELP(1))
      DATA ITOFST/93/,HELP /0,0/
      DATA IENTRY/0/
C
      IF(IENTRY.NE.0)  GOTO  10
      IENTRY = 1
      CALL CORCST(NRUN)
   10 CONTINUE
C
      MTOF = 0
      NTOF = 0
      CALL SETSL(TTOF,0,42*4,0.)
      CALL SETSL(HTOF,0,42*2,0.)
      IPTOF  = IDATA(IBLN('ATOF'))
      IF(IPTOF.LE.0)  RETURN
      IPTOF = IPTOF*2
      IPJ = IDATA(IBLN('LATC'))
      IF(IPJ.LE.0) RETURN
      IF(IDATA(IPJ).LE.3) RETURN
      IPJ = 2*IPJ
      J1 = IPJ + 6
      J2 = IPJ + 11
      NBIT=7
      DO 32 JK = J1,J2
      HELP(2) = HDATA(JK)
      ICAMWD = ISHFTL(ICAMWD,1)
      DO 32 IBT = 1,NBIT
      ICAMWD = ISHFTR(ICAMWD,1)
      IE = (JK-J1)*NBIT
      IF(.NOT.TBIT(ICAMWD,31)) GO TO 32
      IE = IE + IBT
      NTOF = NTOF + 1
      HTOF(IE) = 1
32    CONTINUE
C
      DO   1   I=1,42
      IF1 = 2*I-1
      IAD = ITOFST + IF1 + (IF1-1)/8
      ITDCL = HDATA(IPTOF+IAD)
      ITDCR = HDATA(IPTOF+IAD+1)
      IF(ITDCL.LT.10.OR.ITDCL.GE.2048)  GOTO  1
      IF(ITDCR.LT.10.OR.ITDCR.GE.2048)  GOTO  1
      TDCL = ITDCL*DM(I)-CM(I)
      TDCR = ITDCR*DP(I)-CP(I)
      TTOF(I) = .5*(TDCL+TDCR)
      MTOF = MTOF + 1
    1 CONTINUE
C/////////
       RETURN
       END
