Understanding the effects of Cr doping in rutile TiO2 by DFT calculations and X-ray spectroscopy