Accurate prediction of band gaps and optical properties of HfO2