Understanding Adaptive Laser Pulse-Shaping Control Of Two-Photon Emission And Second Harmonic Generation