C$      SUBROUTINE NOINT(INDEX)
      SUBROUTINE NOINT(IGOOD)
C----------------------------------------------------------------------
C-
C-   Purpose and Methods : 
C-
C-   Inputs  : 
C-   Outputs : 
C-   Controls: 
C-
C-   Created  20-OCT-1994   MIRKO BOEZIO
C-
C----------------------------------------------------------------------
      INCLUDE 'INTEST.TXT'
      
      REAL BAR(2,NPLA)
      REAL RIL(NCHA/2)
      INTEGER IBAR(2,NPLA)
      INTEGER NPIANI
      COMMON/ANGOLO/BAR,IBAR
      SAVE /ANGOLO/
      COMMON/GENERAL/RIG,RMASS
      SAVE /GENERAL/

      INDEX = 0
C
      NPIANI = 0
C
      EMAX = 2. * (RIG * RIG + RMASS * RMASS) / (RIG * RIG)
C
c      print *,'1npiani ',npiani,' rig ',rig
C$      IF (RIG.NE.0) NPIANI = INT( ANINT( 14. + 1.2 * LOG(ABS(RIG)) ) )
      IF (RIG.NE.0) NPIANI = INT( ANINT( 9. + LOG(ABS(RIG)) ) )
c
      IF ( NPIANI.gt.22 ) NPIANI = 22
      IF ( NPIANI.lt.1 )  NPIANI = 1
c      print *,'2npiani ',npiani
C
      DO K = 1,NCHA/2
        RIL(K) = 1000.
      ENDDO
C
      NGIR = 0
      IBAD = 0
      IGOOD = 0
      DO M = 1,2
C
        DO J = 1,NPIANI
C
          DO K = 1,NGIR
            RIL(K) = 1000.
          ENDDO
C
          NNN = 0
C
c     print *,'m j ',m,j
          BB = BAR(M,J)
C
          NGIR = NCL(M,J)
          IF (NGIR.EQ.0) GO TO 5
          IF (NGIR.GT.1) IBAD = IBAD + 1
C$          IF (IBAD.GT.1) GO TO 999
C$          IF (IBAD.GT.2) GO TO 999
          IF (NGIR.GT.1) GO TO 5
          DO L = 1,NGIR
            RIL(L) = ABS(CLUS(M,J,L) - BB)
          ENDDO
          MM = NCHA/2
          LK = LVMIN(RIL,MM)
C
C$          IF (RIL(LK).LE.4) IGOOD = IGOOD + 1
          IF (RIL(LK).LE.4.AND.CLUS(M,J,LK+NCHA/2).LT.EMAX) IGOOD =
     &      IGOOD + J
C$          IF (RIL(LK).LE.8.AND.CLUS(M,J,LK+NCHA/2).LT.EMAX) IGOOD =
C$     &      IGOOD + 1 
C
    5     CONTINUE
C
        ENDDO
      ENDDO
C
      IF (IGOOD.GE.5) INDEX = 1
C

  999 RETURN
      END
