Electronic Structure of Vertically Aligned Mn-Doped CoFe2O4 Nanowires and Their Application as Humidity Sensors and Photodetectors