Spectrum and energy levels of triply ionized barium (Ba iv)