C   17/01/79 409061133  MEMBER NAME  CMASS2   (S)           FORTRAN
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
       SUBROUTINE CMASS(NCN,PMOM,T,TM,TP,PAT,BETA,DBETA,BETAM,BETAP,
     -                  PRO,PKA,PPI,PEL)
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
      DIMENSION XM2(4),PROB(4)
      COMMON /CHEADR/ IHEADR(54)
      EQUIVALENCE (XM2(1),PMAS2),(XM2(2),XKMAS2),(XM2(3),PIMAS2),
     1 (XM2(4),EMS2)
      DATA PMAS2,XKMAS2,PIMAS2,EMS2/ .8803684, .2437081,
     -                               .01947892, 2.61124E-7/
      DATA CVEL/  2.997925E2 / ,DTOF/.5/
      DATA IFAULT/0/
C
      IF(PAT.LT.920.)  GOTO  999
      IF(TM.LE.1.)  GOTO  12
      BETAM= PAT/TM/CVEL
   12 IF(TP.LE.1.)  GOTO  14
      BETAP= PAT/TP/CVEL
C
   14 IF(T.LE.0.)  GOTO  999
      IF(PAT.LT.920.)  GOTO  999
      BETA= PAT/T/CVEL
      BET2= BETA*BETA
      PMOM2 = PMOM*PMOM
      DELP = .033*PMOM2
      EMAS2= PMOM2*(1./BET2-1.)
      EMASS= SQRT(ABS(EMAS2))
      DMAS2= 2.*PMOM2*CVEL*CVEL*T/PAT/PAT*DTOF
      IF(EMASS.GT..00001)  GOTO  20
      DERT = SQRT(DMAS2)
      GOTO  21
   20 DERT = DMAS2/2./EMASS
   21 DERP = (1./BET2-1.)*DELP*DELP
      DMAS = SQRT(DERT**2+ABS(DERP))
      DO   1   M=1,4
      ENRG2 = PMOM2+XM2(M)
      ENRG = SQRT(ENRG2)
      BETAM = ABS(PMOM)/ENRG
      DBP = XM2(M)/ENRG**3.*DELP
      SIGM2 = DBP*DBP + DBETA*DBETA
      PROB(M) = (BETA-BETAM)**2/SIGM2/2.
    1 CONTINUE
      PRO = PROB(1)
      PKA = PROB(2)
      PPI = PROB(3)
      PEL = PROB(4)
       RETURN
  999 BETA = 20.
      EMAS2 = -4.
      IFAULT = IFAULT + 1
      IF(IFAULT.LE. 0) PRINT 102,NCN,T,PAT,PMOM
  102 FORMAT(/' FAULT IN CMASS ',I5,2F10.3)
      RETURN
       END
