In TOF MS, ions are generated from a sample using an ionization source such as MALDI or ESI. These ions are then accelerated by an electric field and allowed to drift through a flight tube towards a detector. The velocity of each ion depends on its mass-to-charge ratio, with lighter ions reaching the detector faster than heavier ones. By measuring the time of flight, the mass of the ions can be determined.