12 The GPT code
1.4 Coordinate Systems
1.4.1 Element Coordinate System (ECS)
Elements in the set-up need to be positioned. The parameters of a single-turn solenoid for example are
obvious: the radius, the current and the location. The code for a solenoid however is location independent; It
is centered around the origin with the z-axis as its normal. The GPT kernel handles all necessary coordinate
transforms needed to interface between the code for a solenoid and the actual solenoid positioned in the set-
up.
The base coordinate system of GPT, the World Coordinate System or WCS, is a standard orthonormal right-
handed Cartesian coordinate system. The GPT kernel assigns a private coordinate system to all elements of
the inputfile. This coordinate system, the Element Coordinate System or ECS, is also right-handed
orthonormal Cartesian. The various methods to specify such a coordinate system are described in later
sections. Because both WCS and ECS are Cartesian, their relation can be defined by an orthonormal matrix
M and an offset o as follows:
or
where r is a coordinate measured in either WCS or ECS.
Because the base GPT coordinate system is WCS, all particle positions are stored relative to this coordinate
system. To obtain the electromagnetic fields generated by an element, the following actions are needed:
• Convert the particle coordinates to the ECS using
.
• Calculate the electromagnetic fields using the code of the element.
• Transform these fields back to WCS.
To transform the fields to WCS, the following transformations are used:
Because of the superposition principle, the electromagnetic fields of all the elements in the set-up can be
added to obtain the total field at the position of a particle. This can be a time-consuming process when
hundreds of elements are present. Therefore the kernel differentiates between two kinds of elements: global
elements and local elements.
Global elements have a relatively long working range. The typical example is a large solenoid, possibly even
around an eccelerator section. The fields of all the global elements are added to obtain the total field generated
by the global elements.
Local elements however have a relatively short working range. Their ranges are required to not extend past
the centers of neighbouring local elements, and this is used internally to speed up the tracking. The
overlaptest element can be used to check if any local elements are violating the rules.
1.4.2 Specifying an Element Coordinate System (ECS)
The first parameter of almost all GPT elements is the Element Coordinate System. For example, the syntax
of a solenoid is:
solenoid(ECS,R,I) ;
The specification of an ECS consists of the following two parts:
• The name of the coordinate system relative to which the element is located. This usually is "wcs", but
can also be the name of a previously defined Custom Coordinate System, CCS, see section 1.4.3.
• The offset o and matrix M as defined in
.
Various methods are available for specifying an ECS. They all specify o and M, but the simple methods have
restrictions. The transformation most commonly used is the "z" transformation. It moves an element in the
z-direction without performing any rotations. Another useful coordinate system is the "I" transformation,
the identity transformation. All methods available to specify an ECS are listed in Table 1-A.