Mass spectrometry involves firing particles of a unknown material at a known speed through an electrical or magnetic field of known strength. Then by measuring its trajectory, its molecular mass can be found and therefore its composition.