def cartesian_to_spherical(backend, px, py, pz, e):
    """Converts an array of cartesian four-momentum coordinates (px, py ,pz, E) to spherical (pt, eta, phi, mass).
    
    Args:
        backend (library): either hepaccelerate.backend_cpu or hepaccelerate.backend_cuda
        px (array of floats): Data array of the momentum x coordinate (numpy or cupy)
        py (array of floats): Data array of the momentum y coordinate
        pz (array of floats): Data array of the momentum z coordinate
        e (array of floats): Data array of the energy values
    
    Returns:
        tuple of arrays: returns the numpy or cupy arrays (pt, eta, phi, mass)
    """
    return backend.cartesian_to_spherical(px, py, pz, e)