[430] | 1 | #include "madx.h" |
---|
| 2 | |
---|
| 3 | void |
---|
| 4 | pro_touschek(struct in_cmd* cmd) |
---|
| 5 | /* control for touschek module */ |
---|
| 6 | { |
---|
| 7 | struct command* keep_beam = current_beam; |
---|
| 8 | struct name_list* nl = current_touschek->par_names; |
---|
| 9 | struct command_parameter_list* pl = current_touschek->par; |
---|
| 10 | char *filename = NULL, *table_name = NULL; |
---|
| 11 | int pos, w_file; |
---|
| 12 | |
---|
| 13 | (void)cmd; |
---|
| 14 | if (twiss_table == NULL) |
---|
| 15 | warning("no TWISS table present","touschek command ignored"); |
---|
| 16 | else |
---|
| 17 | { |
---|
| 18 | |
---|
| 19 | if(get_option("centre")) |
---|
| 20 | { |
---|
| 21 | printf("Yes centre on \n"); |
---|
| 22 | } |
---|
| 23 | else |
---|
| 24 | { |
---|
| 25 | printf("NO centre off \n"); |
---|
| 26 | } |
---|
| 27 | if ((current_beam |
---|
| 28 | = find_command(twiss_table->org_sequ->name, beam_list)) == NULL) |
---|
| 29 | current_beam = find_command("default_beam", beam_list); |
---|
| 30 | if (probe_beam != NULL) delete_command(probe_beam); |
---|
| 31 | probe_beam = clone_command(current_beam); |
---|
| 32 | pos = name_list_pos("file", nl); |
---|
| 33 | if (nl->inform[pos]) |
---|
| 34 | { |
---|
| 35 | if ((filename = pl->parameters[pos]->string) == NULL) |
---|
| 36 | { |
---|
| 37 | if (pl->parameters[pos]->call_def != NULL) |
---|
| 38 | filename = pl->parameters[pos]->call_def->string; |
---|
| 39 | } |
---|
| 40 | if (filename == NULL) filename = permbuff("dummy"); |
---|
| 41 | w_file = 1; |
---|
| 42 | } |
---|
| 43 | else w_file = 0; |
---|
| 44 | set_option("touschek_table", &w_file); /* fill only if output */ |
---|
| 45 | if (w_file) |
---|
| 46 | { |
---|
| 47 | table_name = permbuff("touschek"); |
---|
| 48 | touschek_table = make_table(table_name, "touschek", touschek_table_cols, |
---|
| 49 | touschek_table_types, current_sequ->n_nodes); |
---|
| 50 | add_to_table_list(touschek_table, table_register); |
---|
| 51 | } |
---|
| 52 | adjust_probe(zero); /* sets correct gamma, beta, etc. */ |
---|
| 53 | touschek_(); |
---|
| 54 | if (w_file) out_table(table_name, touschek_table, filename); |
---|
| 55 | if (probe_beam) probe_beam = delete_command(probe_beam); |
---|
| 56 | current_beam = keep_beam; |
---|
| 57 | } |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | |
---|