Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions madx/lib/beta_beat.macros.madx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -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_few_columns();
twiss, chrom, sequence=use_sequence, deltap=dpp, file=output_file;
};


/*
* Transform the coupling given in R-matrix in MAD-X to f terms.
Expand Down
4 changes: 4 additions & 0 deletions model/accelerators/lhc/best_knowledge.madx
Original file line number Diff line number Diff line change
Expand Up @@ -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 %(PATH)s/twiss_ips_best_knowledge.dat";
4 changes: 4 additions & 0 deletions model/accelerators/lhc/nominal.madx
Original file line number Diff line number Diff line change
Expand Up @@ -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";