Electron g factor in quantum wells determined by spin quantum beats