A method of operating a linear accelerator (102,302), comprising: using a power generator to: generate first radiofrequency power pulses (110, 301, 110a) having a first power and a first frequency, and generate second radiofrequency power pulses (110, 301, 110a) having a second power and a second frequency different than the first power and first frequency; providing the first and second radiofrequency power pulses to resonant cavities of the linear accelerator (102, 302) in a predetermined sequence; providing first charged particles (104, 304) into the resonant cavities of the accelerator at a first beam current while the first radiofrequency power pulses are provided to the accelerator; accelerating (102, 302) the first charged particles to a first energy at a first resonance frequency while providing the first radiofrequency power pulses; providing second charged particles (104, 304) into the resonant cavities of the accelerator while providing to the accelerator the second radiofrequency power pulses; and accelerating (102, 302) the second charged particles to a second energy different from the first energy while providing the second radio frequency power pulses; using a first automatic frequency controller (136,324) to match the first frequency of the first radiofrequency power pulses to a first resonance frequency of the accelerator while providing the first radiofrequency power pulses; and characterised by matching the second frequency of the second radiofrequency power pulses to a second resonance frequency of the accelerator different from the first resonance frequency while providing the second radiofrequency power pulses, by driving the power generator at an electric power that causes frequency shifts in the power generator matching, at least in part, frequency shifts in the second resonance frequency of the accelerator. using a power generator to: generate first radiofrequency power pulses (110, 301, 110a) having a first power and a first frequency, and generate second radiofrequency power pulses (110, 301, 110a) having a second power and a second frequency different than the first power and first frequency; generate first radiofrequency power pulses (110, 301, 110a) having a first power and a first frequency, and generate second radiofrequency power pulses (110, 301, 110a) having a second power and a second frequency different than the first power and first frequency; providing the first and second radiofrequency power pulses to resonant cavities of the linear accelerator (102, 302) in a predetermined sequence; providing first charged particles (104, 304) into the resonant cavities of the accelerator at a first beam current while the first radiofrequency power pulses are provided to the accelerator; accelerating (102, 302) the first charged particles to a first energy at a first resonance frequency while providing the first radiofrequency power pulses; providing second charged particles (104, 304) into the resonant cavities of the accelerator while providing to the accelerator the second radiofrequency power pulses; and accelerating (102, 302) the second charged particles to a second energy different from the first energy while providing the second radio frequency power pulses; using a first automatic frequency controller (136,324) to match the first frequency of the first radiofrequency power pulses to a first resonance frequency of the accelerator while providing the first radiofrequency power pulses; and characterised by matching the second frequency of the second radiofrequency power pulses to a second resonance frequency of the accelerator different from the first resonance frequency while providing the second radiofrequency power pulses, by driving the power generator at an electric power that causes frequency shifts in the power generator matching, at least in part, frequency shifts in the second resonance frequency of the accelerator.