Black hole pair production on cosmic strings in the presence of a background magnetic field