Invariant mass distribution of D$^0$ candidates with 5 < $p_{\rm T}^{\rm D^0}$ < 8 GeV/$c$ in $R_{\rm T}$ < 1 events