C   23/09/79 106101721  MEMBER NAME  TAGFLG   (JADESR)      FORTRAN
C   12/09/79 C9091401   MEMBER NAME  TAGFLG   (S)           FORTRAN
      SUBROUTINE TAGFLG(IFLAG)
C---  TAGFLG RETURNS THE FOLLOWING NUMBERS VIA IFLAG:
C       0  IF NO LEAD-GLASS OF THE FORWARD DETECTOR IS HIT
C       1  IF THE LEAD-GLASS ENERGY OF THE MINUS Z-SIDE IS ABOVE
C             THRESHOLD (SMZ)
C       2  IF THE LEAD-GLASS ENERGY OF THE PLUS Z-SIDE IS ABOVE
C             THRESHOLD (SPZ)
C      10  IF THE TAGG-TRIGGER (SMZ.OR.SPZ) IS SET
C     100  IF THE LUMI-TRIGGER (SMZ.AND.SPZ) IS SET
C
C     H.WRIEDT     12.09.79     15:05
C     LAST MODIFICATION    14.09.79    11:30
C
C     EXTERNAL BDLM
      IMPLICIT INTEGER*2 (H)
C
#include "cdata.for"
C
      DATA I2/2/,I7/7/,I13/13/,I15/15/
      DATA ICOUNT/0/
C
      IFLAG = 0
      ICOUNT = ICOUNT + 1
C---  FETCH TRIG-POINTER
      IND = IDATA(IBLN('TRIG'))
      IF (IND.EQ.0) GOTO 2
C---  FETCH TRIG-DATA
C---  TAGG-BIT
      LAT = IDATA(IND+5)
      LLAT = JBIT(LAT,I2)
      IF (LLAT.EQ.1) IFLAG = 10
C
C---  FETCH LATC-POINTER
    2 IND = IDATA(IBLN('LATC'))
      IF (IND.EQ.0) RETURN
C---  FETCH LATC-DATA
C---  LUMI-BIT
      LAT = IDATA(IND+10)
      LLAT = JBIT(LAT,I7)
      IF (LLAT.EQ.1) IFLAG = IFLAG+100
C---  SMZ- AND SPZ-BIT
      LAT = IDATA(IND+14)
      LLAT = JBIT(LAT,I13)
      IF (LLAT.EQ.1) IFLAG = IFLAG+1
      LLAT = JBIT(LAT,I15)
      IF (LLAT.EQ.1) IFLAG = IFLAG+2
      RETURN
      END
