Terahertz pulse induced femtosecond optical second harmonic generation in transparent media with cubic nonlinearity