Reconstructing the galaxy density field with photometric redshifts - I. Methodology and validation on stellar mass functionsN. Malavasi, L. Pozzetti, O. Cucciati, S. Bardelli and A. CimattiA&A, 585 (2016) A116DOI: https://doi.org/10.1051/0004-6361/201526718