C   20/03/80 003201329  MEMBER NAME  CUTPED   (S)           FORTRAN
      SUBROUTINE CUTPED
C---  CUT OFF ADC-PEDESTALS (MICROPROCESSOR SUBTRACTED) BELOW 50 CH.
C---  & CREATE NEW VALUES FOR LNG, HPOINT, AND HGGADC
C---  (DEALS WITH 240 ADC-CHANNELS)
C
C     H.WRIEDT     12.06.79       14:00
C     LAST MODIFICATION     20.03.80      13:25
C
      IMPLICIT INTEGER*2 (H)
C
      COMMON /CWORK/ IWORK(42),LNG,HPOINT(4),HGGADC(2,240)
C
      NDAT = LNG - 2
        DO 100 I = 1,NDAT
        HADR = HGGADC(1,I)
        IF (HGGADC(2,I).GE.50) GOTO 101
C---    CUTOFF OF ADCS WITH LOW CONTENT
C       (THRESHOLD: 49 CHANNELS)
        HGGADC(2,I) = 0
        GOTO 100
C---    SCRATCH UNPHYSICAL ADC-ADDRESSES (I.E. ADDRESSES 208 - 215,
C---    >229) AND CONTENTS
  101   IF ((HADR.GE.208.AND.HADR.LE.215).OR.(HADR.GE.230))
     &   HGGADC(2,I) = 0
  100   CONTINUE
C
      CALL GGSRTH(0,NDAT)
      LNG = 2
        DO 200 I = 1,NDAT
        IF (HGGADC(2,I).LE.0) GOTO 201
  200   LNG = I+2
  201 NDAT = LNG-2
      CALL GGSORT
C
C---  SET UP NEW POINTERS
      HPOINT(1) = 1
      HPOINT(2) = 1
      HPOINT(3) = 1
      IF (NDAT.LE.0) GOTO 211
        DO 210 I = 1,NDAT
        HADDR = HGGADC(1,I)
        IF (HADDR.LE.95) HPOINT(2) = 2*I+1
        IF (HADDR.LE.191) HPOINT(3) = 2*I+1
  210   CONTINUE
  211 HPOINT(4) = 2*NDAT+1
      RETURN
      END
