EUROPEAN ORGANIZATION FOR NUCLEAR RESEARCH

PTC_TRACKLINE

PERFORMS A PARTICLE TRAJECTORY TRACKING WITH ACCELERATION USING PTC

USER MANUAL

SYNOPSIS



PTC_TRACKLINE, 
turns         [integer, 1, 0 ] , 
onetable      [logical, false, true ], 
everystep     [logical, false, true], 
tableallsteps [logical, false, true], 
gcs           [logical, false, true],
file          [string, "track", "track" ], 
rootntuple    [logical, false, true],
extension     [string, "", ""];
Parameter Name Type Default value Description
Not present Present, but value not specified
turns integer 1 - Number of turns
onetable logical false true If false, tracking data are written to a single table for each track for each observation point. Table names follow the naming filename.obsMMMM.pNNNN, where
filename is settable prefix with file parameter (see below),
MMMM is observation point number and
NNNN is track number

If true, all data are written to single table called onetable

file string "track" "track" Name of file where track parameters are written, see description of onetable switch above
rootntuple logical false true Stores data to ROOT file as ntuple. Accessible only if RPLOT plugin is available. i.e. only if madxp is dynamically linked and RPLOT plugin is present
everystep logical false true Switches on track parameters recording every integration step. Normally tracking data are stored only at the end of each element. Everystep mode allows the user to get finer data points. It implies usage of the so called node (thin) layout.

Track parameters are stored for each step in thintracking_ptc.txt file. Storage of parameters in a table for each step might be very memory consuming. To switch it off use tableallsteps

Collective effects can be taken to the account only using this mode (this feature of PTC is not interfaced into MAD-X).

gcs logical false true Instructs the code to store track parameters in Global Coordinate System - normally it starts at the entrance phase of the first element.

Description

This MAD-X command performs ray tracking that takes to the account acceleration in traveling wave cavities. It must be invoked in the scope of correctly initialized PTC environment, i.e. after PTC_CREATE_UNIVERSE and PTC_CREATE_LAYOUT commands and before corresponding PTC_STOP . All tracks that are spawned with PTC_START commands beforehand PTC_TRACKLINE command is issued are tracked. Track parameters are dumped at every defined observation point (see PTC_OBSERVE command). Please note that MAD-X always creates observation point at the end of a sequence. Depending on value of onetable switch, all output information is stored in one table (and also file), or in one table per track per observation point is written if the switch is false. The user must note that track parameters plotting (see PLOT command) is only possible if onetable switch is set to false (status as for Feb. 2006). This unfortunate solution is the legacy of the regular MAD-X track command, that is designed for circular machines where the user usually tracks a few particles for many turns rather then many particles for one turn each.

Tracks that do not fit in aperture are immediately stopped.

Behavior of PTC calculations can be adapted with PTC_SETSWITCH command and with appropriate switches of PTC_CREATE_LAYOUT command.

Command parameters and switches

turns
integer, default value 1, no default value if value explicitly not specified

Number of turns around sequence. If layout is not closed then its value is enforced to 1.

onetable
boolean, default value false, if value explicitly not specified then true

If true then only one table is created and one file is written to disk. If false one file per track per observation point is written. File format is filename.obsNNNN.pMMMM, where NNNN and MMMM are numbers of observation point and track, respectively. Filename is defined by the switch described below.

file
character string, default is "track"

name of file where track parameters are written, see description of onetable switch above.

PROGRAMMERS MANUAL

The routine PTC_TRACKLINE is implemented in file madx_ptc_trackcavs.f90 Its single parameter is the number of observation points.

The call sequence from MAD-X interpreter is the following
exec_command in madxp.c;
pro_ptc_trackline in madxn.c; This routine creates appropriates tables where the track parameters are stored, and after execution of the Fortran routine dumps filled table(s) to files.
w_ptc_trackline_ in wrap.f90; Just interface to the appropriate Fortran module
ptc_trackline in madx_ptc_trackline.f90

The key routine that enables appropriate calculation of beam and track parameters in the presence of traveling wave cavities is setcavities.

Firstly, the ptc_trackline routine finds out which are the observation points. For this purpose array of integers observedelements is allocated. Its length is equal to the number of elements in the sequence. All elements are zero by default. If an element with an index n is an observation point then observedelements[n] is equal to 1. This solution enables fast checking if track parameters should be sent to a table after a given element.

Further setcavities subroutine is called if it was not executed yet before.

PTC_TRACKLINE reads the track initial parameters from the table with the help of gettrack function (implemented in C in file madxn.c). For the performance reasons gettrack creates a two dimensional array and buffers there all the initial track parameters upon first call. The array is destroyed with a call of deletetrackstrarpositions function that is performed at the very end of ptc_trackline subroutine.

Tracking itself is implemented in a doubly nested loop. The external one goes over all initiated tracks, and the internal one performs tracking of a given track element by element. The key PTC routine is called TRACK. It propagates a track described by an array of 6 real numbers, denoted as X in equations below. The important issue is that they are the canonical variables. In order to follow the standard MAD-X representation the values that are written to tables and files are scaled appropriately to the reference momentum for a given element. In the general case it changes along the line if traveling wave cavities are present. Hence, momenta xp, yp and zp are

     
zp=sqrt((1+x(5))**2 - x(2)**2 - x(4)**2) 
xp = x(2)/zp
yp = x(4)/zp
where array x containing 6 elements is the track position in the PTC representation, i.e. x(1) is horizontal spacial coordinate, x(2) - horizontal momentum, x(3) - vertical spacial coordinate, x(4) - vertical momentum, x(5) - δp/p0c, x(6) - longitudinal coordinate (caution, the exact meaning depends on the PTC settings, see PTC_SETSWITCH command ).