From 216f6e092f899a3a7d266da2f850285976d10cf9 Mon Sep 17 00:00:00 2001 From: JoschD <26184899+JoschD@users.noreply.github.com> Date: Thu, 9 Jun 2022 19:21:07 +0200 Subject: [PATCH 1/4] macro additions * added px, py to elements and model * added macro to print out IPs with few columns * used macro in best knowledge --- madx/lib/beta_beat.macros.madx | 26 ++++++++++++++++++++-- model/accelerators/lhc/best_knowledge.madx | 4 ++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/madx/lib/beta_beat.macros.madx b/madx/lib/beta_beat.macros.madx index 3937a4b46..11277e7b7 100644 --- a/madx/lib/beta_beat.macros.madx +++ b/madx/lib/beta_beat.macros.madx @@ -8,7 +8,7 @@ select_monitors(): macro = { select, flag=twiss, clear; select, flag=twiss, pattern="^BPM.*B[12]$", column=name, s, betx, alfx, bety, alfy, - mux, muy, dx, dy, dpx, dpy, x, y, + mux, muy, dx, dy, dpx, dpy, x, y, px, py, k1l, k1sl, k2l, k3l, k4l, wx, wy, phix, phiy, dmux, dmuy, keyword, dbx, dby, r11, r12, r21, r22; @@ -21,7 +21,7 @@ select_monitors(): macro = { select_elements(): macro = { select, flag=twiss, clear; select, flag=twiss, class=monitor, column=name, s, betx, alfx, bety, alfy, - mux, muy, dx, dy, dpx, dpy, x, y, + mux, muy, dx, dy, dpx, dpy, x, y, px, py, k1l, k1sl, k2l, k3l, k4l, wx, wy, phix, phiy, dmux, dmuy, keyword, dbx, dby, r11, r12, r21, r22; @@ -40,6 +40,16 @@ select_elements(): macro = { select, flag=twiss, class=drift; } +/* +* Selects the LHC IPs only and only important columns. +*/ +select_lhc_ips_few_columns(): macro = { + select, flag=twiss, clear; + select, flag=twiss, pattern = "^IP[1-8]$", column=name, s, x, y, px, py, + betx, alfx, bety, alfy, + mux, muy, dx, dy, dpx, dpy; +} + /* * Simple twiss file output with only monitors. @@ -67,6 +77,18 @@ do_twiss_elements(use_sequence, output_file, dpp): macro = { }; +/* +* Simple twiss file output with only the LHC IPs and few important columns. +* @param sequence: name of the sequence to use. +* @param output_file: path to the file to write, it has to be input in "" to +* preserve upper case characters. +* @param dpp: delta p / p to use in the twiss command. +*/ +do_twiss_lhc_ips_few_columns(use_sequence, output_file, dpp): macro = { + exec, select_lhc_ips(); + twiss, chrom, sequence=use_sequence, deltap=dpp, file=output_file; +}; + /* * Transform the coupling given in R-matrix in MAD-X to f terms. diff --git a/model/accelerators/lhc/best_knowledge.madx b/model/accelerators/lhc/best_knowledge.madx index 1f56dec29..2e2b4f9c9 100644 --- a/model/accelerators/lhc/best_knowledge.madx +++ b/model/accelerators/lhc/best_knowledge.madx @@ -30,3 +30,7 @@ call, file = "%(PATH)s/extracted_mqts.str"; exec, do_twiss_monitors(LHCB%(NUM_BEAM)i, "%(PATH)s/twiss_best_knowledge.dat", %(DPP)s); exec, do_twiss_elements(LHCB%(NUM_BEAM)i, "%(PATH)s/twiss_elements_best_knowledge.dat", %(DPP)s); + +! check the values at the IPs, to see that knob extraction worked. +exec, do_twiss_lhc_ips_few_columns(LHCB%(NUM_BEAM)i, "%(PATH)s/twiss_ips_best_knowledge.dat", %(DPP)s); +system, "cat twiss_ips_best_knowledge.dat"; \ No newline at end of file From 8e1553b8331849b31fca875298d4e6445b99ce2f Mon Sep 17 00:00:00 2001 From: JoschD <26184899+JoschD@users.noreply.github.com> Date: Thu, 9 Jun 2022 19:25:39 +0200 Subject: [PATCH 2/4] call correct macro --- madx/lib/beta_beat.macros.madx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/madx/lib/beta_beat.macros.madx b/madx/lib/beta_beat.macros.madx index 11277e7b7..90de97f03 100644 --- a/madx/lib/beta_beat.macros.madx +++ b/madx/lib/beta_beat.macros.madx @@ -85,7 +85,7 @@ do_twiss_elements(use_sequence, output_file, dpp): macro = { * @param dpp: delta p / p to use in the twiss command. */ do_twiss_lhc_ips_few_columns(use_sequence, output_file, dpp): macro = { - exec, select_lhc_ips(); + exec, select_lhc_ips_few_columns(); twiss, chrom, sequence=use_sequence, deltap=dpp, file=output_file; }; From 9e641994bf2b77413cd85f5420f0b74a312d1711 Mon Sep 17 00:00:00 2001 From: JoschD <26184899+JoschD@users.noreply.github.com> Date: Thu, 9 Jun 2022 19:35:52 +0200 Subject: [PATCH 3/4] full path --- model/accelerators/lhc/best_knowledge.madx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/accelerators/lhc/best_knowledge.madx b/model/accelerators/lhc/best_knowledge.madx index 2e2b4f9c9..0f1e5a6ae 100644 --- a/model/accelerators/lhc/best_knowledge.madx +++ b/model/accelerators/lhc/best_knowledge.madx @@ -33,4 +33,4 @@ exec, do_twiss_elements(LHCB%(NUM_BEAM)i, "%(PATH)s/twiss_elements_best_knowledg ! check the values at the IPs, to see that knob extraction worked. exec, do_twiss_lhc_ips_few_columns(LHCB%(NUM_BEAM)i, "%(PATH)s/twiss_ips_best_knowledge.dat", %(DPP)s); -system, "cat twiss_ips_best_knowledge.dat"; \ No newline at end of file +system, "cat %(PATH)s/twiss_ips_best_knowledge.dat"; \ No newline at end of file From ad326055c7f5c23a08c5d6527cb0d757e92d413d Mon Sep 17 00:00:00 2001 From: JoschD <26184899+JoschD@users.noreply.github.com> Date: Thu, 9 Jun 2022 20:56:30 +0200 Subject: [PATCH 4/4] also added twiss_ips to nominal --- model/accelerators/lhc/best_knowledge.madx | 2 +- model/accelerators/lhc/nominal.madx | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/model/accelerators/lhc/best_knowledge.madx b/model/accelerators/lhc/best_knowledge.madx index 0f1e5a6ae..d9d3aa8d1 100644 --- a/model/accelerators/lhc/best_knowledge.madx +++ b/model/accelerators/lhc/best_knowledge.madx @@ -33,4 +33,4 @@ exec, do_twiss_elements(LHCB%(NUM_BEAM)i, "%(PATH)s/twiss_elements_best_knowledg ! check the values at the IPs, to see that knob extraction worked. exec, do_twiss_lhc_ips_few_columns(LHCB%(NUM_BEAM)i, "%(PATH)s/twiss_ips_best_knowledge.dat", %(DPP)s); -system, "cat %(PATH)s/twiss_ips_best_knowledge.dat"; \ No newline at end of file +system, "cat %(PATH)s/twiss_ips_best_knowledge.dat"; diff --git a/model/accelerators/lhc/nominal.madx b/model/accelerators/lhc/nominal.madx index 66b2dc1b8..d8418ce4a 100644 --- a/model/accelerators/lhc/nominal.madx +++ b/model/accelerators/lhc/nominal.madx @@ -31,3 +31,7 @@ if(%(USE_ACD)s == 1){ }else if(%(USE_ADT)s == 1){ exec, twiss_adt(%(QX)s, %(QY)s, %(QDX)s, %(QDY)s, %(NUM_BEAM)i, "%(PATH)s/twiss_adt.dat", %(DPP)s); } + +! check the values at the IPs, to see that knob extraction worked. +exec, do_twiss_lhc_ips_few_columns(LHCB%(NUM_BEAM)i, "%(PATH)s/twiss_ips.dat", %(DPP)s); +system, "cat %(PATH)s/twiss_ips.dat";