Optical parameter extraction and error analysis of terahertz time domain spectrum detection