Mechanistic study of the optogalvanic effect in a hollow-cathode discharge