In a medical linear accelerator a bending magnet is used to bend the electron beam produced by the accelerator tube, in the treatment direction. For each electron energy the strength of the magnetic field has to be set to a specific level. Changing the magnetic field strength is done by changing the electric current through the bending magnet. When electron energy and magnetic field strength are not matched, performance of the linac can be affected. As electron energy, magneticfield strength and electrical current through the bending magnet are related to each other, it is reasonable to assume that for each electron energy the correct bending current can be predetermined. This calculated bending current reduces the number of variable parameters used to set up a treatment beam. Predetermining a variable simplifies the tuning procedures. It also prevents a deviation of the electron beam energy being compensated by variation of the bending current. Preventing false machine settings can contribute to increase linac performance and reduce down time and cost of ownership.