next up previous contents index
Next: A Matching Example for Up: Matching Examples Previous: Simple Periodic Beam Line   Contents   Index

Insertion Matching

Match an insertion INSERT to go between two different cells CELL1 and CELL2:

// Some definitions:
BI:     MARKER;
EI:     MARKER;
BM:     MARKER;
EM:     MARKER;
CELL1:  LINE=(...);
CELL2:  LINE=(...);
INSERT: LINE=(...);
MAIN:   LINE=(BM,CELL1,BI,INSERT,EI,CELL2,EM);
P0 = ...;
BEAM1:  BEAM,PC=P0;
C1:     TWISS,LINE=CELL1,BEAM=BEAM1,METHOD=LINEAR,RANGE=BM/BI,STATIC;
C1:     TWISS,LINE=CELL2,BEAM=BEAM1,METHOD=LINEAR,RANGE=EI/EM,STATIC;
MATCH;
  INS:  TWISS,LINE=INSERT,BEAM=BEAM1,METHOD=LINEAR,RANGE=BI/EI;
  VARY,...;
  CONSTRAINT,
    ROW(C1,BI,{BETX,ALFX,BETY,ALFY})==ROW(INS,BI,{BETX,ALFX,BETY,ALFY}),
    WGT={10,1,10,1};
  CONSTRAINT,
    ROW(C2,EI,{BETX,ALFX,BETY,ALFY})==ROW(INS,EI,{BETX,ALFX,BETY,ALFY}),
    WGT={10,1,10,1};
  CONSTRAINT,ROW(INS,EI,{MUX,MUX})={...,...},WGT={10,10};
  SIMPLEX; 
  MIGRAD;
ENDMATCH;
This matches the optical functions BETX,ALFX,BETY,ALFY to fit together at the markers BI,EI, and the phase advances over the insertion.



MAD User Guide, http://wwwslap.cern.ch/mad/