![]() |
Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
|
Garfield++ is a toolkit for the detailed simulation of detectors which use gases or semi-conductors as sensitive medium. The main area of application is currently in micropattern gaseous detectors.
Garfield++ shares functionality with Garfield. The main differences are the more up-to-date treatment of electron transport in gases, the inclusion of semiconductor detectors and the user interface, which is derived from ROOT.
GARFIELD_WITH_CUDA: Build CUDA code if possible OFF by default
GARFIELD_CUDA_USE_FLOAT: Use float with CUDA code (for some performances issues on some hardware)" <tt>double</tt> by default <tt>GARFIELD_WITH_DEGRADE</tt>: Build Degrade <tt>ON</tt> by default <tt>GARFIELD_WITH_EXAMPLES</tt>: Build Garfield++ examples <tt>ON</tt> by default <tt>GARFIELD_WITH_TESTS</tt>: Build Garfield++ tests <tt>ON</tt> by default For simplicity, we define an environment variable <tt>\$GARFIELD_HOME</tt> pointing to the directory to which we cloned the repository. Assuming that <tt>\$GARFIELD_HOME</tt> is your current working directory, you can build and install Garfield++ as follows: @icode{bash} mkdir build cd build cmake [-DCMAKE_INSTALL_PREFIX=<installdir>] [-DGARFIELD_WITH_DOC=ON] [-DGARFIELD_WITH_EXAMPLES=ON] <path to sources> make -j<number of cores on your machine> make install @endicode If <tt>CMAKE_INSTALL_PREFIX</tt> is not provided in the configuration command, <tt>\$GARFIELD_HOME/install</tt> will be used as installation prefix. The <tt>GARFIELD_WITH_DOC</tt> variable is optional, and should be passed if you wish to build the Doxygen based API documentation. Please note that this requires an existing installation of <a href="http://www.doxygen.org/index.html" >Doxygen</a>. If CMake cannot locate Doxygen, its install location should be added into <tt>CMAKE_PREFIX_PATH</tt>. For further details please have a look at <a href="http://www.cmake.org/cmake-tutorial/" >the CMake tutorial.
The documentation of the project is based on doxygen. To build the documentation, the project must have been configured with GARFIELD_WITH_DOC enabled, as described earlier. It can then be built and installed:
By default, this installs the documentation into <installdir>/share/doc/HSFTEMPLATE/share/doc.
You can run the examples from the build directory (if WITH_EXAMPLES has been turned on) but you need to setup a running environment defining some variables, in particular for the HEED database.
In the following lines we use the GEM example (assuming that the build folder is our current working directory):
Alternatively, thanks to PyROOT, you can use the Garfield++ classes from Python`. Assuming again that the build folder is our current working directory we can run the GEM example like this:
Make sure that all required environment variables are set by sourcing the script setupGarfield.sh:
To get started, it can be useful to copy one of the examples to a local directory, modify it, build it against an installed version of Garfield and run it.
If you want to build your own project against Garfield, CMake may be the best option for you. Just add its location to CMAKE_PREFIX_PATH and call find_package(Garfield) within your CMakeLists.txt.