Programs for using the data in a ray output file to calculate the beam size.

The main program is called beamsize. It calculates the size of a beam -in fact 3 sizes, the root-mean_square radius, the mean radius and the maximum distance from centre.

It also uses the final energies of the rays to calculate the mean energy, the root-mean_square spread and the range of energy.

The program looks at the beam at the first test plane and tries to deduce as many as possible of the control parameters that have to be specified. The user is then free to change any of these parameters.

Finally the program searches for data at other test planes, calculates the sizes and energy spreads at all the test planes, shows all the results and exits.

The program is activated by clicking on the beamsize icon or by using the command 'beamsize' when in the cpo directory in DBOS mode.

There is also a version that reads the required control parameters from a separate file. This version is therefore suitable for running in batch mode. Details are given below.

1. In the program beamsize follow the prompts in sequence -do not omit any.

2. The file that contains the data to be analyzed must have been produced with the ray print level partial or higher.

3. The axis of the beam must be along the x, y or z direction.

4. You can specify the position of the centre of the beam or you can let the program find the centre.

5. If you do not specify the centre then you must enter the planes of reflection symmetry that have been used (if any), because CPO3D calculates the rays in the minimum sector only, so these must be reflected to construct the whole beam.

6. The sizes can be calculated for the plane of the test plane or you can specify a single direction. For example if the axis of the beam is the z axis the program would normally look at the radial distances r = sqrt(x*x + y*y) and would calculate the root-mean-square value of r (together with the mean and maximum values). But in this example the user could choose instead to calculate the root-mean-square values etc of x or y only.

7. If the currents are non-zero they would normally be used to weight the results, but the user can choose not to use this weighting, in which case all the rays would be equally weighted.

8. You can choose to exclude all rays that lie more than a specified distance from the centre of the beam.

9. If there is only one test plane and no iterations then this program is unable to read the final energies of the rays (since these are not included in the ray output file) and so energy spreads are not then calculated.

1. If you want to weight the rays by the area of the segments from which they originate but are using the non-space-charge CPO3D program, then it might be possible to use CPO3DS instead and start your rays from an artificial cathode (because the currents are then proportional to the segment areas).

Batch running:

There is a version of the program, called beambat, that can be used in batch mode. It reads all the control parameters from a file that must be called beambat.dat -an example is included in the cpo package. It can be run from a command line, by the command ‘beambat’.

To help the user, the beamsize program outputs a file called 'temp.dat' that can be copied into beambat.dat.

To see how all these options work:

(1) Run beamsize, specifying the output file as tmp1.dat, say, and entering all the other control parameters.

(2) This outputs temp.dat. Copy this to beambat.dat.

(3) Edit the second line of beambat.dat to change the output file to tmp2.dat, say.

(4) Run beambat.

(5) Compare the output of beamsize, namely tmp1.dat, with the output of beambat, namely tmp2.dat. They are essentially the same.