C   09/09/79 C9090901   MEMBER NAME  LGREIN   (SOURCE)      FORTRAN
      SUBROUTINE LGREIN(NPCL,NPR)
C
C     REINITIALIZE ADATA(NPCLS+2) I.E THE ENERGY OF EACH CLUSTER
C     WHEN LGCDIR IS CALLED WITHOUT LGANAL.
C     Y.WATANABE    09-09-79  05:20
C         NPR   =THE BOS POINTER TO THE RAW LG-ADC DATA ('ALGN')
C         NPCL  =THE BOS POINTER TO THE LG-RESULT BANK ('LGCL')
C
      IMPLICIT INTEGER *2 (H)
C
C----------------------------------------------------------------------
C             MACRO CDATA .... BOS COMMON.
C
C             THIS MACRO ONLY DEFINES THE IDATA/HDATA/ADATA NAMES.
C             THE ACTUAL SIZE OF /BCS/ IS FIXED ON MACRO CBCSMX
C             OR BY OTHER MEANS. A DEFAULT SIZE OF 40000 IS GIVEN HERE.
C
C----------------------------------------------------------------------
C
      COMMON /BCS/ IDATA(40000)
      DIMENSION HDATA(80000),ADATA(40000),IPNT(50)
      EQUIVALENCE (HDATA(1),IDATA(1),ADATA(1)),(IPNT(1),IDATA(55))
      EQUIVALENCE (NWORD,IPNT(50))
C
C------------------------ END OF MACRO CDATA --------------------------
C     ADATA(NPCLS+2)=CLUSTER ENERGY IN GEV
C---- FIX POINTERS FOR CLUSTER DATA
      NPCGI = NPCL+IDATA(NPCL+1)-1
C---- GET NO.OF CLUSTERS
      NCLST = IDATA(NPCGI+3)
      IF(NCLST.LT.1) RETURN
      NPCLS = NPCL+IDATA(NPCL+3)-1
      LSTEP=IDATA(NPCGI+21)
      NPALGN=2*NPR+6
      NPMAP = (NPCL+IDATA(NPCL+2))*2 -1
C     SUM UP ADC'S TO GET THE ENERGY OF EACH CLUSTER.
      DO 30 N=1,NCLST
      I1=HDATA(NPMAP)
      I2=HDATA(NPMAP+1)
      ESUM=0.
      IF(I1.GT.I2) GO TO 20
      DO 10 I=I1,I2
      II=2*I+NPALGN
      ESUM=ESUM+HDATA(II)
10    CONTINUE
20    ADATA(NPCLS+2)=ESUM/1000.
      NPCLS=NPCLS+LSTEP
      NPMAP=NPMAP+2
30    CONTINUE
C
C     REINITIALIZE THE TOTAL ENERGYS IN GEN INFO., TOO.
      CALL SETSL(ADATA(NPCGI+7),0,36,0.)
      RETURN
      END
