***********************************************
*                 
        real function invmass(ptcut )
*
        implicit none  
        include 'rantpl3.inc'
        real p1, p2, px1, px2, py1, py2, pz1, pz2
        real ptcut

        invmass = 0.      
        if(nmu.ge.2.and.pmu(3,1).ge.ptcut.and.pmu(3,2).ge.ptcut) then
           px1 = pmu(3,1)*cos(pmu(2,1))
           py1 = pmu(3,1)*sin(pmu(2,1))
           pz1 = pmu(3,1)*sinh(pmu(1,1))
           px2 = pmu(3,2)*cos(pmu(2,2))
           py2 = pmu(3,2)*sin(pmu(2,2))
           pz2 = pmu(3,2)*sinh(pmu(1,2))
           p1 = sqrt(px1**2 + py1**2 + pz1**2)      
           p2 = sqrt(px2**2 + py2**2 + pz2**2)
           invmass = sqrt((p1+p2)**2-(px1+px2)**2-(py1+py2)**2
     1               -(pz1+pz2)**2)
        endif
        return
        end
