# Requirements

## BDSIM https://bitbucket.org/jairhul/bdsim/
Is a Geant4 based accelerator code to simulate beam optics and particles
passing through matter. Description of the syntax of BDSIM files can be found
at http://www.pp.rhul.ac.uk/bdsim/manual/ To install download and compile

## pybdsim https://bitbucket.org/jairhul/pybdsim/src/master/
Is a python helper package to create BDSIM input files
To install "pip install pybdsim"

## pymadx https://bitbucket.org/jairhul/pymadx/src/master/
Is a python helper package to create MADX input files 
To install "pip install pymadx"

# VHEE files 
The following directories contain BDSIM input contain BDSIM input (gmad) files for each beamline configuration.

FEC1_Focused_1m_air
FEC1_Focused_1m_optics
FEC1_Focused_1m_target
FEC1_Focused_1m_window
FEC1_Pencil_5mm_air
FEC1_Pencil_5mm_optics
FEC1_Pencil_5mm_target
FEC1_Pencil_5mm_window

# BDSIM files
BDSIM input files are text input files which are syntactically similar to mad8
and madx input. These files are automatically created from a JSON description
of the accelerator. FEBE_BDSIM.py contains functions to convert the lattice
description files (.yaml) to BDSIM (.gmad) file format. The conversion is
included in jupyter notebook Conversion.ipynb

# Executing BDSIM
To execute BDSIM after installation (e.g. FEC1_Focused_1m_air configuration)

bdsim --file=FEC1_Focused_1m_focus1-air.gmad --outfile=FEC1_Focused_1m_focus1-air --batch --ngenerate=10000

will run bdsim with 10,000 primaries and produce a root file called
FEC1_Focused_1m_focus1-air.root without opening an interactive Qt session.
Removing the --batch flag will start an interactive BDSIM with an interface.

## Analysis of BDSIM output
Analysis of the BDSIM output is performed by functions contained in pyvhee.py
This analysis includes, calculation of the axial VHEE dose and FWHM
calculations presented in the paper. The final presentation of plots and
example usage of the functions in pyvhee.py can be found in Jupyter notebook
(Dose.ipynb)



