C   25/02/82 203051112  MEMBER NAME  LGBRPS   (JADESR)      FORTRAN
C
      SUBROUTINE LGBRCS(JCOSM)
C
C    S.YAMADA   15-02-82  14:00
C     LAST MODIFICATION   05-03-82  10:10
C                         DEBUGGED.
C
C---- SIMPLE PROGRAM FOR LG-BARREL COSMIC RAY REJECTION
C---- OUTPUT
C     JCOSM=0 IF NOT COSMIC LIKE.
C     JCOSM=1 IF DOUBTED TO BE A BARREL COSMIC EVENT.
C     JCOSM=2 IF BARREL COSMIC EVENT.
C
      IMPLICIT INTEGER *2 (H)
C
#include "clgwork1.for"
C
      DIMENSION EAB(2,3),COSA(2),COSB(2),COSD(2)
C*****

C****   COSMIC LIKE EVENTS.
C
      JCOSM = 0
    1   CALL LGKOSM(KFLAG,EAB,NHITA,NHITB,COSA,COSB,COSD,DNORM)
      EXTRA = ETOT(1)-EAB(1,3)-EAB(2,3)
      EXTRAB = ETOT(2)-EAB(1,3)-EAB(2,3)
      RA1 = 0.
      IF( EAB(1,1).GT.0. ) RA1 = EAB(1,2)/EAB(1,1)
      RB1 = 0.
      IF( EAB(2,1).GT.0. ) RB1 = EAB(2,2)/EAB(2,1)
C
C---- CHECK COSMIC OR NOT
      IF( KFLAG.NE.0 )                            GO TO 100
      IF( NCLST.LE.0 )                            GO TO 100
      IF(NCLST.GT.2 .AND.(EXTRA.GT.2.0 .OR. EXTRAB.GT.0.5)) GO TO 100
C---- SAVE POSSIBLE BHABHA/GG
      IF( EAB(1,3).GT.5.0 .AND. EAB(2,3).GT.5.0)  GO TO 100
C---- CHECK THE 1-ST CLUST
C
C--     BIG AND LONG CLUSTER
        IF( EAB(1,1).GT.30000..AND. RA1.LE.0.08)    GO TO 1000
C--     MEDIUM SIZE;  CHECK DIRECTION IN PHI-Z PLANE
        IF( EAB(1,1).GT.20000. .AND. RA1.LT.0.2 .AND.
     *      ABS(COSA(1)).GT.0.50 )               GO TO 1000
C
C---  CHECK THE 2-ND CLUSTER
C--     BIG AND LONG CLUSTER
        IF( EAB(2,1).GT.30000..AND. RB1.LE.0.08)  GO TO 1000
C--     MEDIUM SIZE;  CHECK DIRECTION IN PHI-Z PLANE
        IF( EAB(2,1).GT.20000. .AND. RB1.LT.0.2 .AND.
     *      ABS(COSB(1)).GT.0.50 )                GO TO 1000
C
C---- SMALL SIZE    CHECK DIRECTIONS OF BOTH CLUSTER
        IF(EAB(1,1).GT.15000. .AND. RA1.LT.0.2 .AND. EAB(1,3).GE.1.0
     *  .AND. EAB(2,1).GT.15000 .AND. RB1.LT.0.2 .AND. EAB(2,3).GE.0.5
     *  .AND. ABS(COSA(1)).GT.0.5 .AND. ABS(COSB(1)).GT.0.5)
     *                                           GO TO 1000
C
C---- TIGHTER CUT
  200 ELPSCT = EAB(1,3)*200 + 20000.0
      IF( NCLST.LE.1 ) GO TO 100
      IF( EAB(1,3).LT.0.8 .OR. EAB(2,3).LT.0.4) GO TO 100
      IF( EAB(1,1).LT.ELPSCT) GO TO 100
      IF( EAB(2,1).LT.ELPSCT) GO TO 100
      JCOSM = 1
      GO TO 100
C
 1000 JCOSM = 2
  100 RETURN
      END
