Next: Beam Line Sequences
Up: Beam Lines
Previous: Sub-lines
  Contents
  Index
Reflection and Repetition
An unsigned repetition count and an asterisk indicate
repetition of a beam line member.
An optional minus sign (-) prefix causes reflection,
i.e. all elements in the subsequence are taken in reverse order.
Sub-lines of reflected lines are also reflected,
but on physical elements the reflection flag is ignored.
The minus sign must precede any repetition count.
Repetitions are expanded immediately when a line is read,
so are reflections of anonymous beam lines.
The result is a flat line referring to a sequence of named elements and/or
beam lines.
When the line is output, it has the form resulting from this expansion.
Example:
R:LINE=(G,H);
S:LINE=(C,R,D);
T:LINE=(2*S,2*(E,F),-S,-(A,B));
TWISS,LINE=T;
The three lines are stored as follows:
R:LINE=(G,H);
S:LINE=(C,R,D);
T:LINE=(S,S,E,F,E,F,-S,B,A);
When T is expanded, substitution is recursive:
- Replace sub-line S:
(C,R,D,C,R,D,E,F,E,F,D,-R,C,B,A)
- Replace sub-line R:
(C,G,H,D,C,G,H,D,E,F,E,F,D,H,G,C,B,A)
Note that the inner sub-line R is reflected together with
the outer sub-line S.
MAD User Guide, http://wwwslap.cern.ch/mad/