touschek_scatter

- type: setup/action command.
- function: Simulate Touschek scattering process at each
`TSCATTER`

element based on Monte Carlo method. The local scattering rate is calculated by using Piwinski's formula and from the Monte Carlo simulation. Scattered particles can be tracked through the entire beamline (one pass only), and beam loss information is recorded. - notes:
- A momentum aperture file is required previous using this command. It
should contain momentum aperture at least at each
`TSCATTER`

element and can be obtained by running`momentum_aperture`

command. - The simulation can be done for a Gaussian distributed beam or an arbitrary
particle distribution given by histogram file(s) (See
`MHISTOGRAM`

). - When using histogram file as input, it should contain data at least at each
`TSCATTER`

element. This can be done by inserting a`MHISTOGRAM`

element following each`TSCATTER`

element. With`lumped=1`

option, a multi page SDDS file will be output automatically or you can combine individual output file into a multi page SDDS file before using this command. - The input particle distribution can be given in 3 ways: 2D(x-x')+2D(y-y')+2D(dt-dp); or 4D(x-x'-y-y')+2D(dt-dp); or 6D(x-x'-y-y'-dt-dp); base on user's choice. We recommend to use lower ``order'' histogram table if the original particle number which used to generate these table is not large enough.
- The
`emit_*`

,`emit_dp`

and`sigma_s`

is always required for running the simulation (Used for Piwinski's rate). Use closed value when simulate a non-Gaussian distributed bunch.

- A momentum aperture file is required previous using this command. It
should contain momentum aperture at least at each

&touschek_scatter double charge = 0; double frequency = 1; double emit_x = 0; double emit_nx = 0; double emit_y = 0; double emit_ny = 0; double sigma_dp = 0; double sigma_s = 0; double distribution_cutoff[3] = {3, 3, 3}; double Momentum_Aperture_scale = 0.85; STRING Momentum_Aperture = NULL; STRING XDist = NULL; STRING YDist = NULL; STRING ZDist = NULL; STRING TranDist = NULL; STRING FullDist = NULL; STRING bunch = NULL; STRING loss = NULL; STRING distribution = NULL; STRING initial = NULL; STRING output = NULL; long nbins = 100; long n_simulated = 5E6; double ignored_portion = 0.01; long i_start = 0; long i_end = 1; long do_track = 0; long match_position_only = 0; long overwrite_files = 1; long verbosity = 0; &end

`charge`

-- Bunch charge in ``C''. Can not be zero.`frequency`

-- Bunch repeating frequency.`emit_x`

,`emit_y`

-- RMS emittance for the X, Y plane. Ignored if RMS normalized emittance is nonzero.`emit_nx`

,`emit_ny`

-- RMS normalized emittance for the X, Y plane.`sigma_dp`

,`sigma_s`

-- Fractional momentum spread, , and bunch length.`distribution_cutoff`

-- The number of sigmas to use at each plane for Gaussian beam.`Momentum_Aperture`

-- Input filename contains estimated momentum aperture at each`TSCATTER`

element.`Momentum_Aperture_scale`

-- This value times the aperture value from`Momentum_Aperture`

file sets up the limitation of the simulation. Only particles have will be kept. And the scattering rate is calulated at this value.`XDist`

,`YDist`

,`ZDist`

-- Input filename of 2D histogram table of X, Y, and Z plane. X and Y are ignored when`TranDist`

or`FullDist`

is present.`TranDist`

-- Input file name of the 4D histogram table of transverse plane. Has to be used together with`ZDist`

.`FullDist`

-- Input file name of the 6D histogram table. If present, all other tables are ignored.`bunch`

-- The (incomplete) name of an SDDS file to which the phase-space coordinates of the simulated scattered particles are to be written. Recommended value: ``%s-%03ld.bun''. If ``%03ld'' or the equivalent is not provided then only the last simulated bunch is kept (One bunch for one`TSCATTER`

element).`loss`

-- The (incomplete) name of an SDDS file to which the original and final phase-space coordinates of the lost simulated scattered particles are to be written. Recommended value: ``%s-%03ld.los''. Used together with`do_track = 1`

.`distribution`

-- The (incomplete) name of an SDDS file to which the one dimension histogram of simulated scattered particles are to be written. Recommended value: ``%s-%03ld.dis''`initial`

-- The (incomplete) name of an SDDS file to which the one dimension histogram of simulated particles before scattering are to be written. Recommended value: ``%s-%03ld.ini''`output`

-- The (incomplete) name of an SDDS file. The loss rate is summarized along the beamline and the average loss rate (particles per second per meter) at each location (1 m step) is written to this file. Recommended value: ``%s-%03ld.out''`nbins`

-- Bin number used for the`distribution`

and`initial`

table.`n_simulated`

-- The total number of simulatted scattered particles with . Small value will cause unstable simulation rate.`ignored_portion`

-- The total scattering rate ignored from tracking. This will greatly increase the tracking speed. This number should be much less than the total loss rate. For example, if the total loss rate is 50% of the total scattering rate, then ignor 5% (0.05) of the scattering particles will cause some of 10% error. But the simulation is greatly speed up.`i_start`

,`i_end`

-- The simulation will be done from the`i_start`

to`i_end`

`TSCATTER`

element along the beamline.`do_track`

-- If non-zero, then scattered particles will be tracked from the location they are generated to the end of the beamline. The loss property can be analysised using`output`

or`loss`

.`match_position_only`

-- If non-zero, then matching of the momentum aperture data to the lattice is done using the position data only (`s`

column), rather than the element names. Can be helpful if errors appear about files ending prematurely or data not matching.`overwrite_files`

-- If non-zero, then output files will be overwritten. If set to zero, then when output files are found, the corresponding computations are skipped. This can be used to restart a Touschek scattering run, provided the output filenames are index (e.g., of the form ``%s-%03ld.los'' rather than ``%s.los''.)