*CMZ :          06/01/95  12.39.51  by   E.Boehm
*-- Author :
      DOUBLE PRECISION FUNCTION HMIMSS (Xdd)
      DOUBLE PRECISION COEFF,P,P0,P1,P2,HELEFT,HBASFT
c
      REAL
     +ID      ,IND     ,DEPTH   ,COINC   ,ASEG    ,BSEG    ,
     +APHA    ,ACHN    ,BPHA    ,BCHN    ,CPHA    ,CCHN    ,
     +DPHA    ,DCHN    ,EPHA    ,ECHN
*
      LOGICAL         CHAIN
      CHARACTER*128   CFILE
*
      COMMON /PAWCHN/ CHAIN, NCHEVT, ICHEVT
      COMMON /PAWCHC/ CFILE
*
      COMMON/PAWIDN/IDNEVT,VIDN1,VIDN2,VIDN3,VIDN(10),
     +ID      ,IND     ,DEPTH   ,COINC   ,ASEG    ,BSEG    ,
     +APHA    ,ACHN    ,BPHA    ,BCHN    ,CPHA    ,CCHN    ,
     +DPHA    ,DCHN    ,EPHA    ,ECHN
*
      DIMENSION X(1),COEFF( 4),IBASFT( 1, 4)
      DATA COEFF/ 0.11838374D+01, 0.63187752D+00, 0.16133151D+00,
     + 0.48443597D-01
     +/
      DATA IBASFT/  0, 10, 20, 30
     +/

      if (achn.eq.0.) then
        ade=3.0*apha/1023.
      else
        ade=30.0*apha/1023.
      endif

      tote=ade
      if (bchn.eq.0.) then
        tote=tote+3.0*bpha/1023.
      else
        tote=tote+45.0*bpha/1023.
      endif
      if (cchn.eq.0.) then
        tote=tote+16.07*cpha/1023.
      else
        tote=tote+166.7*cpha/1023.
      endif
      if (dchn.eq.0.) then
        tote=tote+20.0*dpha/1023.
      else
        tote=tote+225.0*dpha/1023.
      endif
      if (echn.eq.0.) then
        tote=tote+20.0*epha/1023.
      else
        tote=tote+225.0*epha/1023.
      endif

      hmimss=-10.
      if(ade.le.0.)return
c	
      adl=log10(ade)
      x(1)=log10(ade/tote)
c
      FPARAM=0.
      DO 25 K=1, 4
      P=1.
      DO 15 I=1, 1
      NUM=IBASFT(I,K)/10
      ITYP=IBASFT(I,K)-NUM*10
      IF (NUM.NE.0) THEN
      IF (ITYP.EQ.0) THEN
      P0=1.
      P1=X (I)
      DO 10 J=2,NUM
      P2=P1*X (I)
      P0=P1
   10 P1=P2
      P=P*P1
      END IF
      IF (ITYP.EQ.1) P=P*HELEFT(NUM,X (I))
      IF (ITYP.EQ.2) THEN
      P=HBASFT(NUM,X )
      GOTO 20
      END IF
      END IF
   15 CONTINUE
   20 FPARAM=FPARAM+COEFF(K)*P
   25 CONTINUE
	hmimss=adl-fparam
      RETURN
      END
