      real function pmass2(p1,p2)

      implicit none

      integer ndim
      parameter (ndim=3)
      real p1(ndim),p2(ndim)

      pmass2 = sqrt(2.*p1(3)*p2(3)*
     &     (cosh(p1(1)-p2(1))-cos(p1(2)-p2(2))))

      return
      end
