Fix Booster Lattice in C++

The source code can be downloaded here:

git clone


Builds on MacOSX 10.8.x and LINUX on CLX cluster are supported

The requirements are much less than fitit
but since fixlattice is useless without fitit, the lesser requirements are not stated here.


Edit the Makefile to put in the appropriate paths if necessary. The Makefile has been set up so that it knows whether it is run on a Mac or on the CLX cluster.



fixlattice should be created. Move fixlattice to your local path.

A pre-built version of fixlattice for MacOSX or CLX LINUX can be requested from the author:


fixlattice assumes the same file directory structure as fitit. The options can be changed in .loco

Checking the configuration

fixlattice -h

The output should look something like this

fixlattice version 1.0-15-gda40301-16
config file: /export/home1/cytan/.loco
command line options and their DEFAULT values
         plots dir = ./plots
         common dir = ./common
         results dir = ./results
         magnet settings = MagnetSettings.txt
         machine params vs t = machine_params_vs_t.sdds

generic options :
  -h [ --help ]                         this message
  -t [ --tq ] arg (=0.0024889999999999999)
                                        TQ (integrated gradient/amp)
  -c [ --config ] arg (=/export/home1/cytan/.loco)
                                        LOCO configuration file
  -Q [ --aveQ ]                         enable adding of ave(Q) + ave(dQ) to 
                                        LOCO QS,QL
  -T [ --Tstart ] arg (=0)              start time of correction in ms
  -S [ --Tstop ] arg (=1000)            start time of correction in ms
  -i [ --interp ]                       interpolate currents between tstart and
  -R [ --TRange ] arg                   range of time ranges to correct. e.g. 
                                        2,3:18,19 for correcting 2ms to 3ms, 
                                        and 18 to 19 ms
  -f [ --fraction ] arg (=1)            fraction of correction to be applied. 
                                        0<= fraction <=1.
  -d [ --debug ]                        enable debugging
  -v [ --version ]                      print version

config file options:
  --fitit.gnufont arg                   gnuplot font
  --fitit.plots_dir arg (=./plots)      plot directory
  --fitit.common_dir arg (=./common)    common directory
  --fitit.results_dir arg (=./results)  results directory
  --fitit.magnet_settings arg (=MagnetSettings.txt)
                                        magnet settings up the ramp file
  --fitit.machine_params_vs_t arg (=machine_params_vs_t.sdds)
                                        machine params vs t results file

Creating NewQLRamps.txt and NewQSRamps.txt files and plots

The requirements are that you have the following files:

  • machine_params_vs_t.sdds that was generated by fitit in the results directory.
  • MagnetSettings.txt the Booster ramp file in the common directory.
fixlattice can be run with plots and with the betatron tunes fixed to be the same as before correction:
fixlattice -d -Q

If fixes are only required up to transition and starting at 2.5 ms
fixlattice -d -T 2.5 -S 18 -Q

If fixes are only required up to transition and starting at 2.5 ms and only 25% fix
fixlattice -d -T 2.5 -S 18 -Q -f 0.25

If the fix between 2.5 ms and 4.7 ms have to be interpolated between the start and end slots
fixlattice  -d -T 2.5 -S 4.7 -Q -i

A range of slots that need to be fixed can also be specified. In the example below, fixes are between 2.5ms to 3.5 ms and 4.5ms to 4.7ms
  1. interpolation has not been tested for TRange.
  2. the argument to the -R option must not have any spaces.
    fixlattice -d -R 2.5,3.5:4.5,4.7 -Q

The files that are generated are:

  • NewQLRamps.txt and NewQSRamps.txt in the results directory.
  • new_rescaled_quad_ramps.png, newdI.png, new_quad_ramps.png and skew_quad.png in the plots directory.