  The ESA Euclid mission will produce photometric galaxy samples over 15000
square degrees of the sky that will be rich for clustering and weak lensing
statistics. The accuracy of the cosmological constraints derived from these
measurements will depend on the knowledge of the underlying redshift
distributions based on photometric redshift calibrations. A new approach is
proposed to use the stacked spectra from Euclid slitless spectroscopy to
augment broad-band photometric information to constrain the redshift
distribution with spectral energy distribution fitting. The high spectral
resolution available in the stacked spectra complements the photometry and
helps to break the colour-redshift degeneracy and constrain the redshift
distribution of galaxy samples. We modelled the stacked spectra as a linear
mixture of spectral templates. The mixture may be inverted to infer the
underlying redshift distribution using constrained regression algorithms. We
demonstrate the method on simulated Vera C. Rubin Observatory and Euclid mock
survey data sets based on the Euclid Flagship mock galaxy catalogue. We assess
the accuracy of the reconstruction by considering the inference of the baryon
acoustic scale from angular two-point correlation function measurements. We
selected mock photometric galaxy samples at redshift z>1 using the
self-organising map algorithm. Considering the idealised case without dust
attenuation, we find that the redshift distributions of these samples can be
recovered with 0.5% accuracy on the baryon acoustic scale. The estimates are
not significantly degraded by the spectroscopic measurement noise due to the
large sample size. However, the error degrades to 2% when the dust attenuation
model is left free. We find that the colour degeneracies introduced by
attenuation limit the accuracy considering the wavelength coverage of Euclid
near-infrared spectroscopy.
