Euclid preparation. XXIV. Calibration of the halo mass function in
Λ(ν)CDM cosmologies
The Euclid photometric cluster survey requires a theoretical halo mass function (HMF) whose uncertainty is subdominant in cosmological parameter recovery. We calibrated an analytic HMF using a Bayesian approach on N-body simulations, accounting for numerical systematic errors. We tested convergence across different codes, initial conditions, box sizes, and mass resolutions, quantified the impact of halo finders, and analyzed scale-free simulations to trace non-universality. The resulting fitting function is sub-percent accurate for nine variants of $\Lambda$CDM, including massive neutrinos. Calibration systematics are largely subdominant, except for the halo finder effect, which could bias inference.