ZASPE: a code to measure stellar atmospheric parameters and their covariance from spectra