An experimental and theoretical understanding of a UV photodetector based on Ag nanoparticles decorated Er-doped TiO2 thin film