Combined study of the ground and excited states in the transformation of nanodiamonds into carbon onions by electron energy-loss spectroscopy