CAUTION For the time being cavities MUST not be placed one after another, and at least a marker must be inserted between two neighboring accelerating structures. Otherwise, program will stop with the error message.
This routine sets up the properties of a layout and traveling wave cavities. The main goal is to update reference beam energy for the elements that follow a traveling wave cavity. It traces the synchronous particle, i.e. one that has all its parameters set to zero at the beginning of the layout under study. At the point it arrives to a cavity, the parameters of the latter one are adjusted according to the switches defined by the user. There are 2 cases
Parameters of the cavities are dumped to the file named twcavsettings.txt.
At the end patches at the ends of the cavities are set, so the parameters after them are calculated taking to the account reference energy increase.
The exact program behavior depends on the PTC switches settings.
Please note that in PTC phase velocity of a cavities wave is always equal to speed of light. Hence, if PTC internal state TIME is TRUE, what is the most correct setting, then voltage seen by a particle is varying along the structure. If TIME is FALSE, track is assumed to fly with speed of light and in such case a particle moves together with the wave front.