Finite beta effects on MHD equilibria and energetic ion losses in a rippled tokamak