Optical helicity and Hertz vectors