Effects of dopant states on photoactivity in carbon-doped TiO2