Laser-induced electronic absorption spectra of CO+ and H2O+ in ion beams detected through ion–molecule reactions