BMAD based g-2 tracking code

g2_tracking is a program that is used to explore beam dynamics of the g-2 storage ring. It is based on the Bmad library of accelerator modeling routines, and field maps computed with Opera, Poisson, FEMME, etc. The layout of the injection channel and ring are defined in the Bmad lattice file(s). The lattice file is traditionally named bmad_< stuff >. The geometry of the ring, dipole field, length and locations of inflector, quads and kickers, collimators, apertures, fiber_harps and calorimeters are defined in the lattice file(s). Beam parameters, such as emittance, energy spread, temporal distribution, position and momentum offsets, field index, inflector field, etc. are defined in a file named input.dat

Running g2_tracking

To run the g2_tracking program you will need the executable, field files, lattice file and input file.


Acquisition Within Wilson Lab of code from the Wilson accelerator code repository


  1. If you have not done this already, make a directory for your local copy of the Bmad (g-2) distribution, programs, etc. Henceforth this directory will be referred to as < DIR >. A possible name might be: "root_dir". Substitute the appropriate directory name for " < DIR >" in the following steps.

  2. To make a local copy of a directory, the commands:

       cd < DIR >
       svn co https://accserv.lepp.cornell.edu/svn/<REPOS_PATH>.

    To find the correct < REPOS_PATH >, use the repository web viewer. For example. to make a local copy of the bmad library, use the commands:


      cd <DIR>
      svn co https://accserv.lepp.cornell.edu/svn/trunk/src/g-2

    This will create the directory <DIR>/g-2

  3. To update your local copy of a library and/or executable so that it has all the revisions that have been introduced into the repository, go to the directory containing the library and/or executable and use the command:

       svn update

  4. To compile the library: (see Environment Variables)

    cd <DIR>/g-2
    mk          # Produces production libraries and/or executables


    Or use "mkd" instead of "mk" if you want to the debug versions of the libraries and/or executables.

    Production libraries and executables are put in the directory:

    <DIR>/production

    and debug libraries and executables are put in:

    <DIR>/debug


For offsite acquisition and installation see

Offsite Bmad Setup

g-2/ directory tree


<DIR>
/g-2
CMakelists.txt - list of cmake files for building various executables Subdirectories of g-2/ include: code  documentation   files   finalfocus   magneticfield   plotting_scripts  programs ering

The executables are: g2_tracking, analyze_harp, EnergyDispersion, fieldmap_test, read_quad_grid, and a few others  

Executables


Environment Variables

In order for the code to build and link various environment variables must be defined. They are for the most part telling the linker where to find the BMAD library subroutines. The easiest way to get these variables is on linux from your home directory to

cp /home/dlr/.bashrc_g2 .bashrc

Before you do this you might want to rename your own .bashrc file so that it is not overwritten and then combine the two.


Structures

For reference
The BMAD structures are defined in
bmad_struct.f90
The g-2 structures are defined in muon_mod.f90

References

  1. Evolution of the Muon Distribution in the g-2 Ring June, 2016
  2. Analysis of Phase Space Matching with RF Quad December 2015
  3. Multiple Scattering in Inflector End Coils April, 2014
  4. Inflector Acceptance and Twiss Parameters September, 2013
  5. Matching Dispersion into the Ring June, 2013
  6. Tracking Through the Injection Channel April, 2013
  7. Inflector Acceptance June, 2012