be beams department€¦ · be beams department ch!2 plan 1. overview: survey, track, cofind,...

39
Laurent Deniau, CERN BE/ABP, 1211 Geneva 23, [email protected] BE Beams Department Laurent Deniau CERN-BE/ABP 5 th December 2018 Methodical Accelerator Design - Next Generation Survey and Plot commands (2/5) ABP-HSS meeting

Upload: others

Post on 12-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

BE Beams Department

Laurent DeniauCERN-BE/ABP

5th December 2018

Methodical Accelerator Design - Next GenerationSurvey and Plot commands (2/5)ABP-HSS meeting

Page 2: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

!2

PLAN

1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces.

2. Survey command and Plot command. Geometrical tracking.

3. Track command and Beam command. Dynamical tracking.

4. Twiss command and Cofind command. Tracking DA maps, computing optical functions.

5. Match command. Optimising lattices, functions optima.

Annexes I. Object model, Commands, Environments.

II. MTable, Sequence, Elements.

III. Symplectic integrators. IV. DA maps, GTPSA.

V. Linear Algebra.

Page 3: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

!2

PLAN

1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces.

2. Survey command and Plot command. Geometrical tracking.

3. Track command and Beam command. Dynamical tracking.

4. Twiss command and Cofind command. Tracking DA maps, computing optical functions.

5. Match command. Optimising lattices, functions optima.

Annexes I. Object model, Commands, Environments.

II. MTable, Sequence, Elements.

III. Symplectic integrators. IV. DA maps, GTPSA.

V. Linear Algebra.

1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces.

2. Survey command and Plot command. Geometrical tracking.

3. Track command and Beam command. Dynamical tracking.

4. Twiss command and Cofind command. Tracking DA maps, computing optical functions.

5. Match command. Optimising lattices, functions optima.

Annexes I. Object model, Commands, Environments.

II. MTable, Sequence, Elements.

III. Symplectic integrators. IV. DA maps, GTPSA.

V. Linear Algebra.

Page 4: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

Geometrical tracking

!3

MAD-NGCore

Linear ToolBoxReal & ComplexVector & Matrix

AlgorithmsSolvers, Eigen,FFT, Optimisers

DA ToolboxReal & Complex

GTPSA

MADX Env

Elements

Sequence

Beam

ObjectModel

MTablePlot

Commands

Survey

Track

COFind

Twiss

Match

DA Map

Geometric3D Maps

SymplecticIntegrators

Unit Tests

Dynamic6D Maps

2018

Emit

2019

IBS

2019?

COCorrect

2019

Spin Maps

2020?Radiation

2019

A uses BA B

A exposes BA B

A is-a BA B

Geo/LinAlg Dyn/DiffAlgLegend

TodoDone Dev

Normal form Optical Funs

2019

Aperture

2019

Unification

Page 5: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

Survey examples (MADX vs MAD)

!4

Page 6: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

! global workspace, no ‘import’

-- classesdip: sbend,l=10,angle=2*pi/12,tilt=0.1;midseq: marker;-- sequencemusr: sequence, refer=centre, l=120; dip1 : dip, at=5; dip2 : dip, at=5+10; dip3 : dip, at=5+20; dip4 : dip, at=5+30; dip5 : dip, at=5+40; dip6 : dip, at=5+50; midseq, at=60; dip7 : dip, at=5+60; dip8 : dip, at=5+70; dip9 : dip, at=5+80; dip10: dip, at=5+90; dip11: dip, at=5+100; dip12: dip, at=5+110;endsequence;-- commandbeam,particle=proton;use,period=musr;select,flag=survey,clear;select,flag=survey,column=name,keyword, l,angle,x,y,z,theta,phi,psi;survey,file=“test-survey_1.tfs”;

Simple MADX survey example

Survey examples (MADX vs MAD)

!4

Page 7: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

local beam, sequence, survey in MADlocal sbend, marker in MAD.elementlocal pi in math-- classeslocal dip= sbend {l=10,angle=2*pi/12,tilt=0.1}local mk = marker-- sequencelocal musr = sequence 'musr' {refer='centre',l=120, dip 'dip1' {at=5 }, dip 'dip2' {at=5+10 }, dip 'dip3' {at=5+20 }, dip 'dip4' {at=5+30 }, dip 'dip5' {at=5+40 }, dip 'dip6' {at=5+50 }, mk 'midseq'{at=60 }, dip 'dip7 ' {at=5+60 }, dip 'dip8 ' {at=5+70 }, dip 'dip9 ' {at=5+80 }, dip 'dip10' {at=5+90 }, dip 'dip11' {at=5+100}, dip 'dip12' {at=5+110},}-- command! no beam required

local col= {'name','kind','l','angle', 'x','y','z','theta','phi','psi'}local tbl= survey {sequence=musr}tbl:write(“test-survey_1.tfs”, col)

Simple MAD survey example

! global workspace, no ‘import’

-- classesdip: sbend,l=10,angle=2*pi/12,tilt=0.1;midseq: marker;-- sequencemusr: sequence, refer=centre, l=120; dip1 : dip, at=5; dip2 : dip, at=5+10; dip3 : dip, at=5+20; dip4 : dip, at=5+30; dip5 : dip, at=5+40; dip6 : dip, at=5+50; midseq, at=60; dip7 : dip, at=5+60; dip8 : dip, at=5+70; dip9 : dip, at=5+80; dip10: dip, at=5+90; dip11: dip, at=5+100; dip12: dip, at=5+110;endsequence;-- commandbeam,particle=proton;use,period=musr;select,flag=survey,clear;select,flag=survey,column=name,keyword, l,angle,x,y,z,theta,phi,psi;survey,file=“test-survey_1.tfs”;

Simple MADX survey example

Survey examples (MADX vs MAD)

!4

Page 8: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

Survey tables (MADX vs MAD)

!5

Page 9: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

@ NAME %06s "SURVEY"@ TYPE %06s "SURVEY"@ TITLE %08s "no-title"@ ORIGIN %17s "5.04.02 Darwin 64"@ DATE %08s "04/12/18"@ TIME %08s "23.38.49"* NAME KEYWORD L ANGLE X Y Z THETA PHI PSI$ %s %s %le %le %le %le %le %le %le %le "MUSR$START" "MARKER" 0 0 0 0 0 0 0 0 "DIP1" "SBEND" 10 0.5235987756 -2.545943335 -0.2554463896 9.549296586 -0.5214328139 -0.04993746099 -0.01332532711 "DIP2" "SBEND" 10 0.5235987756 -9.501589878 -0.9533389047 16.53986686 -1.045026159 -0.08656635199 -0.04987468693 "DIP3" "SBEND" 10 0.5235987756 -19.00317976 -1.906677809 19.09859317 -1.570796327 -0.1 -0.1 "DIP4" "SBEND" 10 0.5235987756 -28.50476963 -2.860016714 16.53986686 -2.096566495 -0.08656635199 -0.1501253131 "DIP5" "SBEND" 10 0.5235987756 -35.46041618 -3.557909229 9.549296586 -2.62015984 -0.04993746099 -0.1866746729 "DIP6" "SBEND" 10 0.5235987756 -38.00635951 -3.813355619 -3.93995947e-12 -3.141592654 2.063627047e-14 -0.2 "MIDSEQ" "MARKER" 0 0 -38.00635951 -3.813355619 -3.93995947e-12 -3.141592654 2.063627047e-14 -0.2 "DIP7" "SBEND" 10 0.5235987756 -35.46041618 -3.557909229 -9.549296586 -3.663025467 0.04993746099 -0.1866746729 "DIP8" "SBEND" 10 0.5235987756 -28.50476963 -2.860016714 -16.53986686 -4.186618812 0.08656635199 -0.1501253131 "DIP9" "SBEND" 10 0.5235987756 -19.00317976 -1.906677809 -19.09859317 -4.71238898 0.1 -0.1 "DIP10" "SBEND" 10 0.5235987756 -9.501589878 -0.9533389047 -16.53986686 -5.238159148 0.08656635199 -0.04987468693 "DIP11" "SBEND" 10 0.5235987756 -2.545943335 -0.2554463896 -9.549296586 -5.761752493 0.04993746099 -0.01332532711 "DIP12" "SBEND" 10 0.5235987756 -2.842170943e-14 -1.498801083e-15 7.897682508e-12 -6.283185307 -4.13141743e-14 1.734723476e-17 "MUSR$END" "MARKER" 0 0 -2.842170943e-14 -1.498801083e-15 7.897682508e-12 -6.283185307 -4.13141743e-14 1.734723476e-17

Simple MADX survey example

Survey tables (MADX vs MAD)

!5

Page 10: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

@ title %04s "musr"@ type %06s "survey"@ origin %16s "MAD 0.5.4 OSX 64"@ date %08s "04/12/18"@ time %08s "23:39:23"@ refcol %04s "name"@ direction %le 1@ observe %le 0@ implicit %b false@ relative %b false* name kind l angle x y z theta phi psi$ %s %s %le %le %le %le %le %le %le %le "$start" "marker" 0 0 0 0 0 0 0 0 "dip1" "sbend" 10 0.5235987756 -2.545943335 -0.2554463896 9.549296586 -0.5214328139 -0.04993746099 -0.01332532711 "dip2" "sbend" 10 0.5235987756 -9.501589878 -0.9533389047 16.53986686 -1.045026159 -0.08656635199 -0.04987468693 "dip3" "sbend" 10 0.5235987756 -19.00317976 -1.906677809 19.09859317 -1.570796327 -0.1 -0.1 "dip4" "sbend" 10 0.5235987756 -28.50476963 -2.860016714 16.53986686 -2.096566495 -0.08656635199 -0.1501253131 "dip5" "sbend" 10 0.5235987756 -35.46041618 -3.557909229 9.549296586 -2.62015984 -0.04993746099 -0.1866746729 "dip6" "sbend" 10 0.5235987756 -38.00635951 -3.813355619 1.421085472e-14 -3.141592654 -2.081668171e-17 -0.2 "midseq" "marker" 0 0 -38.00635951 -3.813355619 1.421085472e-14 -3.141592654 -2.081668171e-17 -0.2 "dip7 " "sbend" 10 0.5235987756 -35.46041618 -3.557909229 -9.549296586 -3.663025467 0.04993746099 -0.1866746729 "dip8 " "sbend" 10 0.5235987756 -28.50476963 -2.860016714 -16.53986686 -4.186618812 0.08656635199 -0.1501253131 "dip9 " "sbend" 10 0.5235987756 -19.00317976 -1.906677809 -19.09859317 -4.71238898 0.1 -0.1 "dip10" "sbend" 10 0.5235987756 -9.501589878 -0.9533389047 -16.53986686 -5.238159148 0.08656635199 -0.04987468693 "dip11" "sbend" 10 0.5235987756 -2.545943335 -0.2554463896 -9.549296586 -5.761752493 0.04993746099 -0.01332532711 "dip12" "sbend" 10 0.5235987756 -6.217248938e-15 -1.665334537e-16 -2.131628207e-14 -6.283185307 6.938893904e-17 9.714451465e-17 "$end" "marker" 0 0 -6.217248938e-15 -1.665334537e-16 -2.131628207e-14 -6.283185307 6.938893904e-17 9.714451465e-17

Simple MAD survey example

@ NAME %06s "SURVEY"@ TYPE %06s "SURVEY"@ TITLE %08s "no-title"@ ORIGIN %17s "5.04.02 Darwin 64"@ DATE %08s "04/12/18"@ TIME %08s "23.38.49"* NAME KEYWORD L ANGLE X Y Z THETA PHI PSI$ %s %s %le %le %le %le %le %le %le %le "MUSR$START" "MARKER" 0 0 0 0 0 0 0 0 "DIP1" "SBEND" 10 0.5235987756 -2.545943335 -0.2554463896 9.549296586 -0.5214328139 -0.04993746099 -0.01332532711 "DIP2" "SBEND" 10 0.5235987756 -9.501589878 -0.9533389047 16.53986686 -1.045026159 -0.08656635199 -0.04987468693 "DIP3" "SBEND" 10 0.5235987756 -19.00317976 -1.906677809 19.09859317 -1.570796327 -0.1 -0.1 "DIP4" "SBEND" 10 0.5235987756 -28.50476963 -2.860016714 16.53986686 -2.096566495 -0.08656635199 -0.1501253131 "DIP5" "SBEND" 10 0.5235987756 -35.46041618 -3.557909229 9.549296586 -2.62015984 -0.04993746099 -0.1866746729 "DIP6" "SBEND" 10 0.5235987756 -38.00635951 -3.813355619 -3.93995947e-12 -3.141592654 2.063627047e-14 -0.2 "MIDSEQ" "MARKER" 0 0 -38.00635951 -3.813355619 -3.93995947e-12 -3.141592654 2.063627047e-14 -0.2 "DIP7" "SBEND" 10 0.5235987756 -35.46041618 -3.557909229 -9.549296586 -3.663025467 0.04993746099 -0.1866746729 "DIP8" "SBEND" 10 0.5235987756 -28.50476963 -2.860016714 -16.53986686 -4.186618812 0.08656635199 -0.1501253131 "DIP9" "SBEND" 10 0.5235987756 -19.00317976 -1.906677809 -19.09859317 -4.71238898 0.1 -0.1 "DIP10" "SBEND" 10 0.5235987756 -9.501589878 -0.9533389047 -16.53986686 -5.238159148 0.08656635199 -0.04987468693 "DIP11" "SBEND" 10 0.5235987756 -2.545943335 -0.2554463896 -9.549296586 -5.761752493 0.04993746099 -0.01332532711 "DIP12" "SBEND" 10 0.5235987756 -2.842170943e-14 -1.498801083e-15 7.897682508e-12 -6.283185307 -4.13141743e-14 1.734723476e-17 "MUSR$END" "MARKER" 0 0 -2.842170943e-14 -1.498801083e-15 7.897682508e-12 -6.283185307 -4.13141743e-14 1.734723476e-17

Simple MADX survey example

Survey tables (MADX vs MAD)

!5

Page 11: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

@ title %04s "musr"@ type %06s "survey"@ origin %16s "MAD 0.5.4 OSX 64"@ date %08s "04/12/18"@ time %08s "23:39:23"@ refcol %04s "name"@ direction %le 1@ observe %le 0@ implicit %b false@ relative %b false* name kind l angle x y z theta phi psi$ %s %s %le %le %le %le %le %le %le %le "$start" "marker" 0 0 0 0 0 0 0 0 "dip1" "sbend" 10 0.5235987756 -2.545943335 -0.2554463896 9.549296586 -0.5214328139 -0.04993746099 -0.01332532711 "dip2" "sbend" 10 0.5235987756 -9.501589878 -0.9533389047 16.53986686 -1.045026159 -0.08656635199 -0.04987468693 "dip3" "sbend" 10 0.5235987756 -19.00317976 -1.906677809 19.09859317 -1.570796327 -0.1 -0.1 "dip4" "sbend" 10 0.5235987756 -28.50476963 -2.860016714 16.53986686 -2.096566495 -0.08656635199 -0.1501253131 "dip5" "sbend" 10 0.5235987756 -35.46041618 -3.557909229 9.549296586 -2.62015984 -0.04993746099 -0.1866746729 "dip6" "sbend" 10 0.5235987756 -38.00635951 -3.813355619 1.421085472e-14 -3.141592654 -2.081668171e-17 -0.2 "midseq" "marker" 0 0 -38.00635951 -3.813355619 1.421085472e-14 -3.141592654 -2.081668171e-17 -0.2 "dip7 " "sbend" 10 0.5235987756 -35.46041618 -3.557909229 -9.549296586 -3.663025467 0.04993746099 -0.1866746729 "dip8 " "sbend" 10 0.5235987756 -28.50476963 -2.860016714 -16.53986686 -4.186618812 0.08656635199 -0.1501253131 "dip9 " "sbend" 10 0.5235987756 -19.00317976 -1.906677809 -19.09859317 -4.71238898 0.1 -0.1 "dip10" "sbend" 10 0.5235987756 -9.501589878 -0.9533389047 -16.53986686 -5.238159148 0.08656635199 -0.04987468693 "dip11" "sbend" 10 0.5235987756 -2.545943335 -0.2554463896 -9.549296586 -5.761752493 0.04993746099 -0.01332532711 "dip12" "sbend" 10 0.5235987756 -6.217248938e-15 -1.665334537e-16 -2.131628207e-14 -6.283185307 6.938893904e-17 9.714451465e-17 "$end" "marker" 0 0 -6.217248938e-15 -1.665334537e-16 -2.131628207e-14 -6.283185307 6.938893904e-17 9.714451465e-17

Simple MAD survey example

@ NAME %06s "SURVEY"@ TYPE %06s "SURVEY"@ TITLE %08s "no-title"@ ORIGIN %17s "5.04.02 Darwin 64"@ DATE %08s "04/12/18"@ TIME %08s "23.38.49"* NAME KEYWORD L ANGLE X Y Z THETA PHI PSI$ %s %s %le %le %le %le %le %le %le %le "MUSR$START" "MARKER" 0 0 0 0 0 0 0 0 "DIP1" "SBEND" 10 0.5235987756 -2.545943335 -0.2554463896 9.549296586 -0.5214328139 -0.04993746099 -0.01332532711 "DIP2" "SBEND" 10 0.5235987756 -9.501589878 -0.9533389047 16.53986686 -1.045026159 -0.08656635199 -0.04987468693 "DIP3" "SBEND" 10 0.5235987756 -19.00317976 -1.906677809 19.09859317 -1.570796327 -0.1 -0.1 "DIP4" "SBEND" 10 0.5235987756 -28.50476963 -2.860016714 16.53986686 -2.096566495 -0.08656635199 -0.1501253131 "DIP5" "SBEND" 10 0.5235987756 -35.46041618 -3.557909229 9.549296586 -2.62015984 -0.04993746099 -0.1866746729 "DIP6" "SBEND" 10 0.5235987756 -38.00635951 -3.813355619 -3.93995947e-12 -3.141592654 2.063627047e-14 -0.2 "MIDSEQ" "MARKER" 0 0 -38.00635951 -3.813355619 -3.93995947e-12 -3.141592654 2.063627047e-14 -0.2 "DIP7" "SBEND" 10 0.5235987756 -35.46041618 -3.557909229 -9.549296586 -3.663025467 0.04993746099 -0.1866746729 "DIP8" "SBEND" 10 0.5235987756 -28.50476963 -2.860016714 -16.53986686 -4.186618812 0.08656635199 -0.1501253131 "DIP9" "SBEND" 10 0.5235987756 -19.00317976 -1.906677809 -19.09859317 -4.71238898 0.1 -0.1 "DIP10" "SBEND" 10 0.5235987756 -9.501589878 -0.9533389047 -16.53986686 -5.238159148 0.08656635199 -0.04987468693 "DIP11" "SBEND" 10 0.5235987756 -2.545943335 -0.2554463896 -9.549296586 -5.761752493 0.04993746099 -0.01332532711 "DIP12" "SBEND" 10 0.5235987756 -2.842170943e-14 -1.498801083e-15 7.897682508e-12 -6.283185307 -4.13141743e-14 1.734723476e-17 "MUSR$END" "MARKER" 0 0 -2.842170943e-14 -1.498801083e-15 7.897682508e-12 -6.283185307 -4.13141743e-14 1.734723476e-17

Simple MADX survey example

Survey tables (MADX vs MAD)

!5

TFS tables

saved in files

Page 12: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

@ title %04s "musr"@ type %06s "survey"@ origin %16s "MAD 0.5.4 OSX 64"@ date %08s "04/12/18"@ time %08s "23:39:23"@ refcol %04s "name"@ direction %le 1@ observe %le 0@ implicit %b false@ relative %b false* name kind l angle x y z theta phi psi$ %s %s %le %le %le %le %le %le %le %le "$start" "marker" 0 0 0 0 0 0 0 0 "dip1" "sbend" 10 0.5235987756 -2.545943335 -0.2554463896 9.549296586 -0.5214328139 -0.04993746099 -0.01332532711 "dip2" "sbend" 10 0.5235987756 -9.501589878 -0.9533389047 16.53986686 -1.045026159 -0.08656635199 -0.04987468693 "dip3" "sbend" 10 0.5235987756 -19.00317976 -1.906677809 19.09859317 -1.570796327 -0.1 -0.1 "dip4" "sbend" 10 0.5235987756 -28.50476963 -2.860016714 16.53986686 -2.096566495 -0.08656635199 -0.1501253131 "dip5" "sbend" 10 0.5235987756 -35.46041618 -3.557909229 9.549296586 -2.62015984 -0.04993746099 -0.1866746729 "dip6" "sbend" 10 0.5235987756 -38.00635951 -3.813355619 1.421085472e-14 -3.141592654 -2.081668171e-17 -0.2 "midseq" "marker" 0 0 -38.00635951 -3.813355619 1.421085472e-14 -3.141592654 -2.081668171e-17 -0.2 "dip7 " "sbend" 10 0.5235987756 -35.46041618 -3.557909229 -9.549296586 -3.663025467 0.04993746099 -0.1866746729 "dip8 " "sbend" 10 0.5235987756 -28.50476963 -2.860016714 -16.53986686 -4.186618812 0.08656635199 -0.1501253131 "dip9 " "sbend" 10 0.5235987756 -19.00317976 -1.906677809 -19.09859317 -4.71238898 0.1 -0.1 "dip10" "sbend" 10 0.5235987756 -9.501589878 -0.9533389047 -16.53986686 -5.238159148 0.08656635199 -0.04987468693 "dip11" "sbend" 10 0.5235987756 -2.545943335 -0.2554463896 -9.549296586 -5.761752493 0.04993746099 -0.01332532711 "dip12" "sbend" 10 0.5235987756 -6.217248938e-15 -1.665334537e-16 -2.131628207e-14 -6.283185307 6.938893904e-17 9.714451465e-17 "$end" "marker" 0 0 -6.217248938e-15 -1.665334537e-16 -2.131628207e-14 -6.283185307 6.938893904e-17 9.714451465e-17

Simple MAD survey example

@ NAME %06s "SURVEY"@ TYPE %06s "SURVEY"@ TITLE %08s "no-title"@ ORIGIN %17s "5.04.02 Darwin 64"@ DATE %08s "04/12/18"@ TIME %08s "23.38.49"* NAME KEYWORD L ANGLE X Y Z THETA PHI PSI$ %s %s %le %le %le %le %le %le %le %le "MUSR$START" "MARKER" 0 0 0 0 0 0 0 0 "DIP1" "SBEND" 10 0.5235987756 -2.545943335 -0.2554463896 9.549296586 -0.5214328139 -0.04993746099 -0.01332532711 "DIP2" "SBEND" 10 0.5235987756 -9.501589878 -0.9533389047 16.53986686 -1.045026159 -0.08656635199 -0.04987468693 "DIP3" "SBEND" 10 0.5235987756 -19.00317976 -1.906677809 19.09859317 -1.570796327 -0.1 -0.1 "DIP4" "SBEND" 10 0.5235987756 -28.50476963 -2.860016714 16.53986686 -2.096566495 -0.08656635199 -0.1501253131 "DIP5" "SBEND" 10 0.5235987756 -35.46041618 -3.557909229 9.549296586 -2.62015984 -0.04993746099 -0.1866746729 "DIP6" "SBEND" 10 0.5235987756 -38.00635951 -3.813355619 -3.93995947e-12 -3.141592654 2.063627047e-14 -0.2 "MIDSEQ" "MARKER" 0 0 -38.00635951 -3.813355619 -3.93995947e-12 -3.141592654 2.063627047e-14 -0.2 "DIP7" "SBEND" 10 0.5235987756 -35.46041618 -3.557909229 -9.549296586 -3.663025467 0.04993746099 -0.1866746729 "DIP8" "SBEND" 10 0.5235987756 -28.50476963 -2.860016714 -16.53986686 -4.186618812 0.08656635199 -0.1501253131 "DIP9" "SBEND" 10 0.5235987756 -19.00317976 -1.906677809 -19.09859317 -4.71238898 0.1 -0.1 "DIP10" "SBEND" 10 0.5235987756 -9.501589878 -0.9533389047 -16.53986686 -5.238159148 0.08656635199 -0.04987468693 "DIP11" "SBEND" 10 0.5235987756 -2.545943335 -0.2554463896 -9.549296586 -5.761752493 0.04993746099 -0.01332532711 "DIP12" "SBEND" 10 0.5235987756 -2.842170943e-14 -1.498801083e-15 7.897682508e-12 -6.283185307 -4.13141743e-14 1.734723476e-17 "MUSR$END" "MARKER" 0 0 -2.842170943e-14 -1.498801083e-15 7.897682508e-12 -6.283185307 -4.13141743e-14 1.734723476e-17

Simple MADX survey example

Survey tables (MADX vs MAD)

!5

Column used as dictionary for direct table row access e.g. print(tbl.dip7.theta) displays -3.663025467

TFS tables

saved in files

Page 13: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Survey interface

!6

survey = command 'survey' { beam=_na, -- N/A sequence=nil, -- sequence (required) range=nil, -- range of tracking dir=1, -- s-direction of tracking (1 or -1)

s0=0, -- initial s X0={0,0,0}, -- initial coordinates x, y, z A0={0,0,0}, -- initial angles theta, phi, psi W0=nil, -- initial W matrix (companion of X0)

mapdef=_na, -- always use matrix formalism (i.e. true) mapsave=false, -- save the orientation matrix W (rotations)

nturn=1, -- number of turns nstep=-1, -- number of elements to track nslice=1, -- number of slice for each element implicit=false, -- slice implicit elements too misalign=0, -- 0 none, 1 main, 2 main+error

save=true, -- create mtable and save results title=nil, -- title of mtable (default seq.name) savesel=fnone, -- save selector relative=false, -- save length of slices instead from element start observe=false, -- save only in observed elements (every n turns)

atentry=fnone, -- action called when entering an element atslice=fnone, -- action called after each element slices atexit=fnone, -- action called when exiting an element ataper=_na, -- N/A atsave=fnone, -- action called after saving in mtable

usrdef=nil, -- user defined data attached to the mflow mflow=nil, -- mflow, exclusive with other attributes except nstep exec=exec, -- command to execute upon children creation} :set_readonly() -- reference survey command is readonly

MAD-X like input & setup

Initial setup

Maps setup

Track setup

Save setup

Actions setup: user customisation

User data

Map flow: ongoing survey command

Page 14: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

Element tracking (Survey, Track, Cofind and Twiss)

!7

๏ Thick elements can contain thin sub-elements and patches. ๏ Sub-elements are “at” relative positions, at = pos with 0 ≤ pos ≤ 1. ๏ Tracking to sub-elements (Mthick) takes slicing (nslice) into account. ๏ Tracking directions and (internal) variables:

➡ element direction: edir ➠ affects curvatures (edir = seq.dir). ➡ tracking direction (s): sdir ➠ affects lengths (sdir = cmd.dir). ➡ time direction (t): tdir ➠ affects angles ( tdir = edir x sdir). ➡ beam direction: bdir ➠ affects strengths (bdir = edir x sdir x chg).

Reverse tracking

Back tracking

Signed tracking

thin

thin

thin

P-1P

thin

thin

thick [ ]

~P

~P-1

Mthick Mthick Mthick Mthick

Mdrift

M-1thick M-1thick M-1thick M-1thick

[1] [2] [3] [4] [5]

s > s0Forward

s < s0Backward

M-1drift

Mdrift

M-1drift

extern

Page 15: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

Element slicing (Survey, Track, Cofind and Twiss)

!8

P-1P thick { }

Mthick

extern

{0} {1} {2} {3} {4}{-1} {-2}

atslice atslice atslice atslice atsliceMthick Mthick Mthick

atentry atexit

M-1thick M-1thick M-1thick M-1thick{4} {3} {2} {1} {0}

Mdrift

M-1drift

Mdrift

M-1drift

ataper atsave

ataperatsave

atexit atentry

s > s0Forward

s < s0Backward

{-2} {-1}

๏ Uniform slicing: nslice = N ➠ Lslice_i = Lelem/N.

๏ Non-uniform slicing: nslice = {lw1, lw2, …, lwk} with ∑ lwi = 1 and N = #nslice ➠ Lslice_i = Lelem x lwi.

๏ Slices selectors: ➡ atbegin ➠ active at {0} ➡ atbody ➠ active at {1..N} ➡ atins ➠ active at {1..N-1} ➡ atmid ➠ active at {N/2} (not active for even N) ➡ atend ➠ active at {N} ➡ atbound ➠ active at {0,N}

MADX survey

cannot slice

(wrong with tilt <> 0)

Useful to see misalignments

Page 16: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (single curved layout & many features)

!9

Page 17: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (single curved layout & many features)

!9

Page 18: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (single curved layout & many features)

!9

local plot1 = plot { sequence = lhcb1, range = { 'E.DS.L5.B1', 'S.DS.R5.B1' }, table = mtbl, tablerange = { 100, 400 }, x1y1 = { x = { 'y', 'z' } }, yrange = { -1.2, 1.2 }, colors = { y = 'red', z = 'green' }, styles = { y = "lines", z = "linespoints" }, dashtypes = { y = ".. ", z = "-- " }, pointtypes = { z = 4 }, legendfont = "Times New Roman", legendsize = 21, legendpos = "top right", legend = {y = "{/Symbol b} + \u{03b2}", z = "{/Symbol B} + \u{0392}"}, xlabel = "Absciss label", ylabel = "Ordinate label",}

Page 19: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (single straight layout & multiplot in PDF)

!10

Page 20: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (single straight layout & multiplot in PDF)

!10

-1-0.50

0.51

0 100 200 300 400 500

Ordinatelabel

Absciss label

plot MAD 0.5.4, 05/12/18, 00:12:10

β + βΒ + Β

-1-0.50

0.51

0 100 200 300 400 500

Ordinatelabel

Absciss label

plot MAD 0.5.4, 05/12/18, 00:12:10

y

-1-0.50

0.51

0 100 200 300 400 500

Ordinatelabel

Absciss label

plot MAD 0.5.4, 05/12/18, 00:12:10

y

Page 21: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (single straight layout & multiplot in PDF)

!10

-1-0.50

0.51

0 100 200 300 400 500

Ordinatelabel

Absciss label

plot MAD 0.5.4, 05/12/18, 00:12:10

β + βΒ + Β

-1-0.50

0.51

0 100 200 300 400 500

Ordinatelabel

Absciss label

plot MAD 0.5.4, 05/12/18, 00:12:10

y

-1-0.50

0.51

0 100 200 300 400 500

Ordinatelabel

Absciss label

plot MAD 0.5.4, 05/12/18, 00:12:10

y

lhcb1:set_layangle(false)local multi1 = plot1 { sid = newid(), prolog = "set multiplot", output = "plot-multi.pdf", psizey = 0.4,}local multi2 = myplot { sid = multi1.sid, originy = 0.4, psizey = 0.4, psizex = 0.5, output = "plot-multi.pdf",}multi2 { epilog = "unset multiplot\n unset out", originx = 0.5,}

Page 22: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (LHC 1 & 2 survey)

!11

Page 23: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (LHC 1 & 2 survey)

!11

Page 24: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (LHC 1 & 2 survey)

!11

plot { sequence = lhc, !{lhcb1,lhcb2} laypos = "in", layonly = false, title = "Layout in plot", prolog = 'set size ratio -1', scrdump = "plotlhc.gp",}

Page 25: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (LHC 1 & 2 survey)

!11

plot { sequence = lhc, !{lhcb1,lhcb2} laypos = "in", layonly = false, title = "Layout in plot", prolog = 'set size ratio -1', scrdump = "plotlhc.gp",}

Gnuplot script

size of 5 MB & 125355 lines

~1 sec to display

all items are tagged

i.e. moving the mouse over

show their name and kind

Page 26: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (LHC 1 & 2 at IP1 & IP5)

!12

Page 27: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (LHC 1 & 2 at IP1 & IP5)

!12

Page 28: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (LHC 1 & 2 at IP1 & IP5)

!12

plot { sequence = { lhcb1, lhcb2, lhcb1, lhcb2 }, range = { {“E.DS.L1.B1","S.DS.R1.B1"},{"E.DS.L1.B2","S.DS.R1.B2"}, {"E.DS.L5.B1","S.DS.R5.B1"},{"E.DS.L5.B2","S.DS.R5.B2"}, }, seqdisty = { lhcb2[“E.DS.L1.B2"].mech_sep, ! second bline -0.4, ! third bline -0.4 + lhcb2[‘E.DS.L5.B2'].mech_sep ! fourth bline }, title = "IP1-IP5 two angled beams",}

Page 29: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (LHC 1 & 2 at IP1 & IP5)

!12

plot { sequence = { lhcb1, lhcb2, lhcb1, lhcb2 }, range = { {“E.DS.L1.B1","S.DS.R1.B1"},{"E.DS.L1.B2","S.DS.R1.B2"}, {"E.DS.L5.B1","S.DS.R5.B1"},{"E.DS.L5.B2","S.DS.R5.B2"}, }, seqdisty = { lhcb2[“E.DS.L1.B2"].mech_sep, ! second bline -0.4, ! third bline -0.4 + lhcb2[‘E.DS.L5.B2'].mech_sep ! fourth bline }, title = "IP1-IP5 two angled beams",}

Layout can be at

top, bottom, middle, inside

Page 30: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a 23

, lau

rent

.den

iau@

cern

.ch

Plot example (two rings with 𝜷x)

!13

Page 31: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

Plot example cont’d (two rings with 𝜷x)

!14

Page 32: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

local ncell = 25local mb = sbend { l=2, k0 =\s s.angle/s.l }local mq = quadrupole { l=1 }local cell =\a -> sequence { l=10, refer='entry', mq 'mq1' { at=0, k1=0.29601 }, mb 'mb1' { at=2, angle=a*pi/ncell }, mq 'mq2' { at=5, k1=-0.30242 }, mb 'mb2' { at=7, angle=a*pi/ncell }, }local seq1 = sequence 'seq1' { ncell*cell(+1), beam=beam }local seq2 = sequence 'seq2' { ncell*cell(-1), beam=beam }local sv1 = survey { sequence=seq1, nslice=5, implicit=true, atslice=ftrue, mapsave=true }local tw1 = twiss { sequence=seq1, nslice=5, implicit=true, atslice=ftrue }

! compute betx in global frame local bet11 = { x=vector(#sv1), z=vector(#sv1) }local v, scl = vector(3), round(tw1.beta11:max()/5)for i=1,#sv1 do v = sv1.W[i] * v:fill{3+tw1.beta11[i]/scl, 0, 0} bet11.x[i], bet11.z[i] = v[1], v[3]endbet11.x = bet11.x+sv1.xbet11.z = bet11.z+sv1.z

! plot layout of the two rings and betx on ring 1 plot { sequence = { seq1, seq2 }, laypos = "in", layonly = false, title = "Layout in plot with \u{03b2}_x", data = { x=bet11.x, z=bet11.z }, x1y1 = { x = 'z' }, styles = 'lines', xlabel = "x [m]", ylabel = "z [m]", legend = { z = '\u{03b2}_x/'..scl },}

Plot example cont’d (two rings with 𝜷x)

!14

Page 33: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

local ncell = 25local mb = sbend { l=2, k0 =\s s.angle/s.l }local mq = quadrupole { l=1 }local cell =\a -> sequence { l=10, refer='entry', mq 'mq1' { at=0, k1=0.29601 }, mb 'mb1' { at=2, angle=a*pi/ncell }, mq 'mq2' { at=5, k1=-0.30242 }, mb 'mb2' { at=7, angle=a*pi/ncell }, }local seq1 = sequence 'seq1' { ncell*cell(+1), beam=beam }local seq2 = sequence 'seq2' { ncell*cell(-1), beam=beam }local sv1 = survey { sequence=seq1, nslice=5, implicit=true, atslice=ftrue, mapsave=true }local tw1 = twiss { sequence=seq1, nslice=5, implicit=true, atslice=ftrue }

! compute betx in global frame local bet11 = { x=vector(#sv1), z=vector(#sv1) }local v, scl = vector(3), round(tw1.beta11:max()/5)for i=1,#sv1 do v = sv1.W[i] * v:fill{3+tw1.beta11[i]/scl, 0, 0} bet11.x[i], bet11.z[i] = v[1], v[3]endbet11.x = bet11.x+sv1.xbet11.z = bet11.z+sv1.z

! plot layout of the two rings and betx on ring 1 plot { sequence = { seq1, seq2 }, laypos = "in", layonly = false, title = "Layout in plot with \u{03b2}_x", data = { x=bet11.x, z=bet11.z }, x1y1 = { x = 'z' }, styles = 'lines', xlabel = "x [m]", ylabel = "z [m]", legend = { z = '\u{03b2}_x/'..scl },}

Plot example cont’d (two rings with 𝜷x)

!14

Page 34: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

!15

Extra Slides

Page 35: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

Object model (principle and deferred expressions)

!16

qf

mqqd

quadstrait

element

circuitselements

class kind frame

mq.l = 2.10 ; ! variableqf.k1 = 0.05 ; ! variableqd.k1 = -0.06 ; ! variablemq: quadrupole, l := mq.l; ! kindqf: mq , k1 := qf.k1; ! circuitqd: mq , k1 := qd.k1; ! circuitqf1: qf; ! elementqf->k1 = 0.06 ; ! BAD! no update of childrenvalue qf1->k1 ; ! print 0.05 (no lookup)

mq = quad { l = 2.10 } ! kindqf = mq { k1 = 0.05 } ! circuitqd = mq { k1 = -0.06 } ! circuitqf1 = qf {} ! elementqf.k1 = 0.06 ! update strength of ‘qf’ circuitprint(qf1.k1) ! print 0.06 (lookup)

Clone: parents are prototypes used to create children (chained) Read: attributes are sought in the chain of parents (if needed) Write: attributes are set/overridden only in elements (no lookup)

qf1qd1qf2qd2

Page 36: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

๏ MAD-X definition: ➡ children copy attributes

(share expressions, no dynamic lookup).

➡ global workspace.

Object model (principle and deferred expressions)

!16

qf

mqqd

quadstrait

element

circuitselements

class kind frame

mq.l = 2.10 ; ! variableqf.k1 = 0.05 ; ! variableqd.k1 = -0.06 ; ! variablemq: quadrupole, l := mq.l; ! kindqf: mq , k1 := qf.k1; ! circuitqd: mq , k1 := qd.k1; ! circuitqf1: qf; ! elementqf->k1 = 0.06 ; ! BAD! no update of childrenvalue qf1->k1 ; ! print 0.05 (no lookup)

mq = quad { l = 2.10 } ! kindqf = mq { k1 = 0.05 } ! circuitqd = mq { k1 = -0.06 } ! circuitqf1 = qf {} ! elementqf.k1 = 0.06 ! update strength of ‘qf’ circuitprint(qf1.k1) ! print 0.06 (lookup)

Clone: parents are prototypes used to create children (chained) Read: attributes are sought in the chain of parents (if needed) Write: attributes are set/overridden only in elements (no lookup)

qf1qd1qf2qd2

Page 37: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

๏ MAD-X definition: ➡ children copy attributes

(share expressions, no dynamic lookup).

➡ global workspace.

๏ MAD definition: ➡ children inherit attributes

using dynamic lookup. ➡ structured lattice

description, no global. ➡ avoid the need for >90% of the deferred expressions and save many extra variables.

Object model (principle and deferred expressions)

!16

qf

mqqd

quadstrait

element

circuitselements

class kind frame

mq.l = 2.10 ; ! variableqf.k1 = 0.05 ; ! variableqd.k1 = -0.06 ; ! variablemq: quadrupole, l := mq.l; ! kindqf: mq , k1 := qf.k1; ! circuitqd: mq , k1 := qd.k1; ! circuitqf1: qf; ! elementqf->k1 = 0.06 ; ! BAD! no update of childrenvalue qf1->k1 ; ! print 0.05 (no lookup)

mq = quad { l = 2.10 } ! kindqf = mq { k1 = 0.05 } ! circuitqd = mq { k1 = -0.06 } ! circuitqf1 = qf {} ! elementqf.k1 = 0.06 ! update strength of ‘qf’ circuitprint(qf1.k1) ! print 0.06 (lookup)

Clone: parents are prototypes used to create children (chained) Read: attributes are sought in the chain of parents (if needed) Write: attributes are set/overridden only in elements (no lookup)

qf1qd1qf2qd2

Page 38: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

๏ MAD-X definition: ➡ children copy attributes

(share expressions, no dynamic lookup).

➡ global workspace.

๏ MAD definition: ➡ children inherit attributes

using dynamic lookup. ➡ structured lattice

description, no global. ➡ avoid the need for >90% of the deferred expressions and save many extra variables.

Object model (principle and deferred expressions)

!16

qf

mqqd

quadstrait

element

circuitselements

class kind frame

mq.l = 2.10 ; ! variableqf.k1 = 0.05 ; ! variableqd.k1 = -0.06 ; ! variablemq: quadrupole, l := mq.l; ! kindqf: mq , k1 := qf.k1; ! circuitqd: mq , k1 := qd.k1; ! circuitqf1: qf; ! elementqf->k1 = 0.06 ; ! BAD! no update of childrenvalue qf1->k1 ; ! print 0.05 (no lookup)

mq = quad { l = 2.10 } ! kindqf = mq { k1 = 0.05 } ! circuitqd = mq { k1 = -0.06 } ! circuitqf1 = qf {} ! elementqf.k1 = 0.06 ! update strength of ‘qf’ circuitprint(qf1.k1) ! print 0.06 (lookup)

Clone: parents are prototypes used to create children (chained) Read: attributes are sought in the chain of parents (if needed) Write: attributes are set/overridden only in elements (no lookup)

qf1qd1qf2qd2

3 variables + 4 elements + 3 deferred expressions

(+ 1 problem)

Page 39: BE Beams Department€¦ · BE Beams Department ch!2 PLAN 1. Overview: Survey, Track, Cofind, Twiss, Match, Plot Unification and (re)use of the command interfaces. 2. Survey command

BE Beams Department

Laur

ent D

enia

u, C

ER

N B

E/A

BP,

121

1 G

enev

a, la

uren

t.den

iau@

cern

.ch

๏ MAD-X definition: ➡ children copy attributes

(share expressions, no dynamic lookup).

➡ global workspace.

๏ MAD definition: ➡ children inherit attributes

using dynamic lookup. ➡ structured lattice

description, no global. ➡ avoid the need for >90% of the deferred expressions and save many extra variables.

Object model (principle and deferred expressions)

!16

qf

mqqd

quadstrait

element

circuitselements

class kind frame

mq.l = 2.10 ; ! variableqf.k1 = 0.05 ; ! variableqd.k1 = -0.06 ; ! variablemq: quadrupole, l := mq.l; ! kindqf: mq , k1 := qf.k1; ! circuitqd: mq , k1 := qd.k1; ! circuitqf1: qf; ! elementqf->k1 = 0.06 ; ! BAD! no update of childrenvalue qf1->k1 ; ! print 0.05 (no lookup)

mq = quad { l = 2.10 } ! kindqf = mq { k1 = 0.05 } ! circuitqd = mq { k1 = -0.06 } ! circuitqf1 = qf {} ! elementqf.k1 = 0.06 ! update strength of ‘qf’ circuitprint(qf1.k1) ! print 0.06 (lookup)

Clone: parents are prototypes used to create children (chained) Read: attributes are sought in the chain of parents (if needed) Write: attributes are set/overridden only in elements (no lookup)

qf1qd1qf2qd2

only 4 elements

3 variables + 4 elements + 3 deferred expressions

(+ 1 problem)