Analysis and optimization of thin film photovoltaic materials and device fabrication by real time spectroscopic ellipsometry