  The analysis of weak gravitational lensing in wide-field imaging surveys is
considered to be a major cosmological probe of dark energy. Our capacity to
constrain the dark energy equation of state relies on the accurate knowledge of
the galaxy mean redshift $\langle z \rangle$. We investigate the possibility of
measuring $\langle z \rangle$ with an accuracy better than $0.002\,(1+z)$, in
ten tomographic bins spanning the redshift interval $0.2<z<2.2$, the
requirements for the cosmic shear analysis of Euclid. We implement a
sufficiently realistic simulation to understand the advantages,
complementarity, but also shortcoming of two standard approaches: the direct
calibration of $\langle z \rangle$ with a dedicated spectroscopic sample and
the combination of the photometric redshift probability distribution function
(zPDF) of individual galaxies. We base our study on the Horizon-AGN
hydrodynamical simulation that we analyse with a standard galaxy spectral
energy distribution template-fitting code. Such procedure produces photometric
redshifts with realistic biases, precision and failure rate. We find that the
Euclid current design for direct calibration is sufficiently robust to reach
the requirement on the mean redshift, provided that the purity level of the
spectroscopic sample is maintained at an extremely high level of $>99.8\%$. The
zPDF approach could also be successful if we debias the zPDF using a
spectroscopic training sample. This approach requires deep imaging data, but is
weakly sensitive to spectroscopic redshift failures in the training sample. We
improve the debiasing method and confirm our finding by applying it to
real-world weak-lensing data sets (COSMOS and KiDS+VIKING-450).
