forked from ThorstenHellert/SC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCinit.m
74 lines (58 loc) · 1.58 KB
/
SCinit.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function SC = SCinit(RING)
% SCinit
% ======
%
% NAME
% ----
% SCinit - Initializes the toolbox
%
% SYNOPSIS
% --------
% `SC = SCinit(RING)`
%
% DESCRIPTION
% -----------
% This function is used to initialize the toolbox. Required input `RING` is an AT lattice cell structure,
% which is also saved as the ideal lattice in `SC.IDEALRING`. The global variables `plotFunctionFlag`
% and `SCinjections` are set to initial values.
%
% GLOBALS
% -------
% `plotFunctionFlag` ([])::
% If not empty, every call of *SCgetBPMreading* calls *SCplotBPMreading*, hence plotting particle
% trajectories and BPM readings.
% `SCinjections` (0)::
% Counts the number of injected beams. Gets increased by *SCgenBunches*
%
% RETURN VALUE
% ------------
% `SC`::
% Base structure including the lattice structure.
global plotFunctionFlag SCinjections
% Store lattice
SC.RING = RING;
% Define ideal lattice
SC.IDEALRING = RING;
% Relative amount of partcles which may be lost before BPM reading is NaN
SC.INJ.beamLostAt = 1;
% Design injected trajectory
SC.INJ.Z0ideal = zeros(6,1);
% Injetced trajectory
SC.INJ.Z0 = SC.INJ.Z0ideal;
% Injected bunch beam size
SC.INJ.beamSize = zeros(6,6);
% Injected beam random trajectory jitter
SC.INJ.randomInjectionZ = zeros(6,1);
% Number of particles per bunch
SC.INJ.nParticles = 1;
% Number of turns for tracking
SC.INJ.nTurns = 1;
% Number of injections for averaging BPM reading
SC.INJ.nShots = 1;
% Tracking mode
SC.INJ.trackMode = 'TBT';
% Total number of injeceted beams
SCinjections = 0;
% Set plot function flag
plotFunctionFlag = [];
end