Unified theory of photon echoes: The passage from inhomogeneous to homogeneous line broadening