C   11/12/78 C9092001   MEMBER NAME  LGAVDP   (SOURCE)      FORTRAN
      SUBROUTINE LGAVDP(ZAV,EMEV,JEG,DEP)
C
C     S.YAMADA  11-12-78  14:55
C     LAST MODIFICATION    13-09-79   22:35 Y.WATANABE
C
C----   AVERAGE DEPTH OF THE SHOWER IS CALCULATED BY ITERATION.
C
      COMMON /CLGDMS/ X0,RADIUS(6),RADSX0(6),THX0(4),
     $                ZEND(2),ZENDX0(2),ZWID(2),ZGAP(2),PHWID(2),
     $                ZECAP(4),ZECAPX(4),THECPX(2)
C
      COMMON /CLGPRM/ ITH,MAXCLS,IRLTHD,IRLTH2,IRLTH3, ZVRTX
      COMMON /CLGMSB/ MSGVAL,AMSGV1,AMSG2
      DATA SM0/150.0/
C     HALF OF THE COUNTER LENGTH FOR THE DEPTH OF NONSHWERING PARTICLES
C
      ZAV2 = (ZAV-ZVRTX)**2
      DEPO = 0.
C
C---- AVERAGE SHOWER DEPTH ALONG THE AXIS = SM
      IF(JEG.LT.2) SM = SHMAX(EMEV,JEG)
      IF(JEG.EQ.2) SM = SM0
C
      NTRY = 0
    4 NTRY = NTRY+1
      IF(NTRY.GT.20) GO TO 21
      DEP = SM/SQRT(1.0+ZAV2/(RADIUS(3)+DEPO)**2)
      IF(ABS(DEP-DEPO)/DEP.LE.0.01) GO TO 3
      DEPO = DEP
      GO TO 4
C
   21 MSGVAL = NTRY
      AMSGV1 = DEPO
      AMSGV2 = DEP
      CALL LGMESG( 10,1)
C
    3 RETURN
      END
