# This is an example input file for the Python based SAD to Bmad conversion script: # util_programs/sad_to_bmad/sad_to_bmad.py # This file is at: # util_programs/sad_to_bmad/sad_to_bmad.params # To use, copy this file to your working directory and modify appropriately. # Please see the util_programs/sad_to_bmad/DOC file for known limitations of the translation. # # To run the script, use the command: # path-to-sad_to_bmad-directory/sad_to_bmad.py # The argument defaults to: # sad_to_bmad.params # If not set on the command line, the defaults to the setting of sad_lattice_file set below. sad_lattice_file = "sler_1689.sad" # Put here the name of the SAD lattice file. bmad_lattice_file = "" # If blank then add .bmad suffix to the sad lattice file name. lattice_geometry = "closed" # Set to 'open' or 'closed' to set the lattice geometry. # In tracking, SAD puts an "fshift" to shift a particle's z-position through every element. # This is done so that the closed orbit will have pz approximately zero. # [pz shifts would show up in SuperKEKB where the reference orbit is through the center # of the solenoid but the on-energy particle orbit is displaced due to the crossing angle.] # To mimic this, the translation program can insert Bmad patch elements just before RF cavities. # These patches have a t_offset to shift the time. patch_for_fshift = "MAYBE" # "MAYBE" => Insert patches only if fshift is defined and nonzero in the sad file. # Set to "TRUE" to insert patches irregardless. Set "FALSE" to not insert. # If there is an "fshift" defined in the sad lattice, the value of this needs to be modified # to take into account small variations in tracking between Bmad/PTC and SAD. In this case, the # program sad_to_bmad_postprocess needs to be run. import os.path if os.path.isfile("../../production/bin/sad_to_bmad_postprocess"): sad_to_bmad_postprocess_exe = "../../production/bin/sad_to_bmad_postprocess" else: sad_to_bmad_postprocess_exe = "$ACC_ROOT_DIR/production/bin/sad_to_bmad_postprocess" # What the time shifts are needed depend upon whether PTC or Bmad will be used for # any simulations. calc_fshift_for = 'ptc' # Or 'bmad' # SAD mark elements which have an offset are translated to a marker element that # is superimposed on the lattice. The ignore_marker_offsets switch means # that the offset is ignored and no superposition is done. ignore_marker_offsets = False # Header_lines is for putting in custom stuff into the Bmad lattice file. # For example, setting particle_start[...], etc. header_lines = ''' ''' footer_lines = ''' '''