A prototype of a single straw drift simulation using GARFIELD++ lives in this repository. This wiki gives some information on this.

Current status

21/8/15 - Tom Stuttard

Have a basic working example of a single straw using GARFIELD++.

Still to do:

  • Understand different drift models (AvalancheMC, DriftLineRFK, AvalancheMicroscopic)
  • Try to resolve issues with DriftLineRFK (this is a GARFIELD++ bug, and affects the example projects too - I reported to developers who have released a fix, but this still doesn't seem to work)
  • Compare to fortran GARFIELD output
  • Make more more realistic
  • Add production experiment case (factor out beam, B field and gas toggles, etc)
  • The penning transfer stuff prints some error messages during init, so don't think it is actually working. Needs investigating.

The current prototype has only been run on SLF6. It might work on Mac, but I don't have one so it hasn't been tested.

Install GARFIELD++

Build warnings

For reference, I get many build warnings like:

Warning: Label at (1) is not in the same block as the GOTO statement at (2)

They don't seem to cause a problem.

Install prototype

The straw model prototype can be found in gm2-tracker-readout-daq/garfield.

Get gm2-tracker-readout-daq as described here:

You will need an environment file for your system. These should be added in gm2-tracker-readout-daq/garfield/c++/cfg. Copy the UCL example, renaming it to match your hostname:

cd gm2-tracker-readout-daq/garfield/c++/cfg
cp environment-`uname -n`.env

The change the paths within this file to match your system (e.g. your ROOT and GARFIELD++ installation locations).


First set up your environment (once per login):

cd gm2-tracker-readout-daq/garfield/c++

Build as follows:

make clean

Prototype overview

The straw model is implemented in the class GarfieldStrawModel, which includes geometry, gas, etc. The particle track is also defined here.

The model currently reflects the test beam configuration, e.g.

- Particle = 120GeV protons
- Gas = Ar:C02 (80:20)
- B = 0

The model is built into a library.

An example of using the model is provided in This is built as an executable.

RunGarfieldStrawModel instantiates the model, specifies the beam profile (a few options are provided, e.g. uniform scan, pencil, etc), and generates events.


First set up your environment (once per login):

cd gm2-tracker-readout-daq/garfield/c++

Run the model using RunGarfieldStrawModel.exe:

${GM2_GARFIELD_BIN}/RunGarfieldStrawModel.exe <num events>
e.g. for 100 events:
${GM2_GARFIELD_BIN}/RunGarfieldStrawModel.exe 100

The output is the ROOT file RunGarfieldStrawModel.root, which contains a tree of the event output data.

Analysing results

Compared to the fortran GARFIELD version, the default plots generated during a GARFIELD++ run are less useful and buggy. Some python scripts have been written to provide better plots.

Per event plots (e.g. plots generated for each track individually):

python $GM2_GARFIELD_ANA/ -i RunGarfieldStrawModel.root

Per run plots (e.g. plots with aggregated results from all events):

python $GM2_GARFIELD_ANA/ -i RunGarfieldStrawModel.root

For both cases, the scripts will pop-up a canvas for each plot as it gets to it. To progress to the next plot, close the canvas and press the Enter key on the command line.