A mass spectrometer is an instrument that produces a stream of charged particles (ions) from a substance being analyzed, separates…