Diagnosis and application of laser wakefield accelerators