Fast switching of the proton beam between two treatment rooms and setup of a real-time control of the beam