def mod_eikonal(pi, pj, pr):
    """Modified eikonal factor for soft particle with momentum pr
    emitted from the dipole with momenta pi and pj.
    This is obtained starting from the eikonal and:
    - ignoring 1 / sir, which is already included in the normalisation factor;
    - multiplying by the partial fraction sjr / (sir + sjr) to regulate for sjr -> 0.
    """

    pipj = pi.dot(pj)
    pijpr = pr.dot(pi+pj)
    return 2 * pipj / pijpr