The transverse momentum ($p_\mathrm{t}$) spectrum of prompt D$^0$ mesons and their antiparticles has been measured via the hadronic decay channels D$^0 \to \mathrm{K}^- \pi^+$ and $\overline{\mathrm{D}}^0 \to \mathrm{K}^+ \pi^-$ in pp and PbPb collisions at a centre-of-mass energy of 5.02 TeV per nucleon pair with the CMS detector at the LHC. The measurement is performed in the D$^0$ meson $p_\mathrm{t}$ range of 2-100 GeV and in the rapidity range of $|y| < $1. The pp (PbPb) dataset used for this analysis corresponds to an integrated luminosity of 27.4 pb$^{-1}$ (530 $\mu$b$^{-1}$). The measured D$^0$ meson $p_\mathrm{t}$ spectrum in pp collisions is well described by perturbative QCD calculations. The nuclear modification factor, comparing D$^0$ meson yields in PbPb and pp collisions, was extracted for both minimum-bias and the 10% most central PbPb interactions. For central events, the D$^0$ meson yield in the PbPb collisions is suppressed by a factor of 5-6 compared to the pp reference in the $p_\mathrm{t}$ range of 6-10 GeV. For D$^0$ mesons in the high-$p_\mathrm{t}$ range of 60-100 GeV, a significantly smaller suppression is observed. The results are also compared to theoretical calculations.
Nuclear modification factor of $(D^{0}+\overline{D}\hspace{.01cm}^{0})/2$ as a function of $p_{T}$ in the centrality range $0-100\%$ and $0-10\%$.
The $p_{T}$-differential production cross section of $(D^{0}+\overline{D}\hspace{.01cm}^{0})/2$ in pp collisions.
The $p_{T}$-differential production yields of $(D^{0}+\overline{D}\hspace{.01cm}^{0})/2$ divided by the nuclear overlap functions $T_{AA}$ for PbPb collisions in the $0-100\%$ and $0-10\%$ centrality ranges.