Observation of strong correlation between quasimonoenergetic electron beam generation by laser wakefield and laser guiding inside a preplasma cavity