Mission statement
GENIE collaboration
Policy documents
GENIE products
Copyright notices
Citing GENIE

Public releases
Global fits & physics tunes
Naming conventions
Associated data releases

User forum
Project incubator

Physics & user manual
Document database

Slack workspace

User mailing list
Developer mailing list

GitHub organization page

Get started
GENIE course

Get started with the GENIE/Generator

This page includes a basic descriptions of the steps required to obtain the GENIE/Generator source code (and the required 3rd party software packages), configure it, build it, and run a few simple post-installation tests. For more details, please see the GENIE Physics & User manual. Please report any problems to the authors.

Obtaining the GENIE/Generator source code
You can obtain the GENIE/Generator source code from its official repository in the GENIE GitHub organization. Detailed instructions are provided in the GENIE GitHub page. For example, to obtain the GENIE trunk (master) version, type:

shell% git clone https://github.com/GENIE-MC/Generator.git

Third-party software packages
This section contains information for building 3rd party (external) software used by GENIE. If you encounter problems building the 3rd party software please contact the package authors or your local system administrators.

For a typical GENIE installation you need:

Installation of external packages in UNIX (incl. LINUX, MAC OS X)

Description: Message/Error logging library for C++
Recommended version:
Web-site: http://sourceforge.net/projects/log4cpp

Installing development version from source:
Get the source code from the sourceforge.net CVS repository:
shell$ cd /your/software/area/
shell$ cvs -d :pserver:anonymous@log4cpp.cvs.sourceforge.net:/cvsroot/log4cpp login
(passwd: just press enter)
shell$ cvs -d :pserver:anonymous@log4cpp.cvs.sourceforge.net:/cvsroot/log4cpp -z3 co log4cpp
shell$ cd log4cpp
shell$ ./autogen.sh
shell$ ./configure --prefix=[location]
shell$ gmake
shell$ gmake install

- log4cpp may already exist in your system (look for a liblog4cpp library)
- Precompiled binaries are also readily available on LINUX (eg using yum: `yum install log4cpp') and MAC OS X (eg. using DarwinPorts: `sudo port install log4cpp').

Description: XML parser.
Recommended version: any reasonably new
Web-site: http://www.xmlsoft.org

Installing development version from source:
shell$ cd /your/software/area/
shell$ svn co https://svn.gnome.org/svn/libxml2/trunk libxml2
shell$ cd libxml2
shell$ ./autogen.sh --prefix=[location]
shell$ gmake
shell$ gmake install

- libxml2 is most likely already installed at your system (look for a libxml2 library)
- Precompiled binaries are also readily available on LINUX (eg using yum: `yum install libxml2') and MAC OS X (eg. using DarwinPorts: `sudo port install libxml2').

Description: The Les Houches Accord PDF Interface
Recommended version: Optional in v3.0.0 and above
Web-site: http://projects.hepforge.org/lhapdf/

Installing version x.y.z from source:
shell$ cd /your/software/area/
shell$ wget http://www.hepforge.org/archive/lhapdf/lhapdf-x.y.z.tar.gz
shell$ tar xzvf lhapdf-x.y.z.tar.gz
shell$ cd lhapdf
shell$ ./configure --prefix=[location]
shell$ gmake
shell$ gmake install

PYTHIA6 and ROOT/PYTHIA thin wrapper library
Description: LUND Monte Carlo (used by GENIE for hadronizing the high-W fraction of neutrino events)
Recommended version: Do not use the precompiled PYTHIA version that comes with CERNLIB.
Web-site: http://www.thep.lu.se/~torbjorn/Pythia.html

Installing from source:
There is a number of steps in order to build PYTHIA for GENIE. Downloading, tweaking and building PYTHIA is automated using Robert Hatcher's build_pythia6.sh script. Please read the script documentation. It would download all the required source files, modify them as needed and build them. So you only need to do:
shell$ cd /your/software/area/
shell$ source build_pythia6.sh

- build_pythia6.shneeds to access the internet to download the source code. If you access the internet through a proxy server and not directly then remember to set the http_proxy environmental variable.
- build_pythia6.sh accepts a PYTHIA6 version as an argument. For example, in order to build v6.4.12 then type: `source build_pythia6.sh 6412'. Read the script documentation for details.
- If you are using a recent version of ROOT and have problems with undefined pytune_ symbols, then move to a recent version of PYTHIA6.

ROOT Class Libraries
Recommended version: Please get a recent ROOT6 version. ROOT5 should still work but is no longer supported by GENIE.
Web-site: http://root.cern.ch

Detailed installation instructions are given in http://root.cern.ch/root/Install.html

For a standard GENIE installation the only extra ROOT configuration options you need are the ones required for enabling GSL (via MathMore) and the ROOT/PYTHIA interface. When configuring ROOT, add: `--enable-pythia6', `--enable-mathmore' and `--with-pythia6-libdir=/path/to/pythia/lib'

Configuring and building GENIE
If all external dependencies are installed, then in order to configure and build GENIE you just need to:
shell% configure [options]
shell% gmake
shell% gmake install (*optional*, see below)

--prefix installation location (for 'gmake install') /usr/local

enable/disable options with either --enable- or --disable- (eg --enable-lhapdf --disable-flux-drivers)

profiler GENIE code profiling using Google perftools default: disabled
doxygen-doc Generate doxygen documentation at build time default: disabled
dylibversion Adds version number in dynamic lib names default: enabled (recommended)
lowlevel-mesg Disable (rather than filter out at run time) some prolific debug/info level messages known to slow GENIE down default: disabled
debug Adds -g in the compiler options to request debug info default: disabled
lhapdf Use the LHAPDF parton density function library, requires libLHAPDF default: enabled
cernlib Use the PDFLIB parton density function library, requires CERNLIB default: disabled (LHAPDF is preferred)
flux-drivers Built-in flux drivers default: enabled
geom-drivers Built-in detector geometry drivers default: enabled
mueloss Muon energy loss modeling (for atm. upgoing muon sim.) default: enabled
vle-extension GENIE very low energy (1 MeV - 100 MeV) extension default: disabled (experimental)
validation-tools GENIE physics model validation tools default: disabled
test Test programs default: disabled
t2k Enables T2K-specific generation app default: disabled
fnal Enables FNAL experiment-specific event generation app default: disabled
atmo Atmospheric neutrino event generation app default: disabled
nucleon-decay Nucleon decay event generation app default: disabled
masterclass GENIE neutrino masterclass app default: disabled (in devel)

with options for 3rd party software, prefix with --with- (eg --with-lhapdf-lib=/some/path/)
optimiz-level Compiler optimization level (O,O2,O3,OO,Os) default: O2
profiler-lib Path to profiler library needed if you --enable-profiler
doxygen-path Doxygen binary path needed if you --enable-doxygen
pythia6-lib PYTHIA6 library path always needed / auto-detected afterchecking for $PYTHIA6 env.var.
cern-lib CERN libraries path needed if you --enable-cern / auto-detected after checking for $CERNLIB env.var.
lhapdf-inc Path to LHAPDF includes needed if you --enable-lhapdf / auto-detected after checking for $LHAPDF_INC env.var.
lhapdf-lib Path to LHAPDF libraries needed if you --enable-lhapdf / auto-detected after checking for $LHAPDF_LIB env.var.
libxml2-inc Path to libxml2 includes always needed / auto-detected
libxml2-lib Path to libxml2 library always needed / auto-detected
log4cpp-inc Path to log4cpp includes always needed / auto-detected
log4cpp-lib Path to log4cpp library always needed / auto-detected

Below, is an example of how I typically build the GENIE/Generator:
shell% cd $GENIE
shell% ./configure
shell% gmake

Further notes:

What to do next - Testing your installation

If the installation was successfull you should find a bunch of libraries in $GENIE/lib and some applications in $GENIE/bin. Here is a set of instructions, for running a few simple apps, and making sure there is no major issue with your GENIE installation.

First, download pre-computed cross-sections, from nu_mu+O^16 interactions, from here . Download datafiles corresponding to the version of GENIE and the physics tune you plan on using. If you want to generate these cross-sections by yourself, see the GENIE User and Physics manual.

Generate a 100k event sample of nu_mu+O^16 interactions between 0 and 10 GeV using a simple analytical (x*exp(-x)) numu flux description (Note: pdg_code(nu_mu)=14, pdg_code(O^16)=1000080160):
shell& gevgen -n 100000 -p 14 -t 1000080160 -e 0,10 -f 'x*exp(-x)' --run 1000 --seed 1721827 --cross-sections /path/to/downladed/cross_sections.xml --tune tune_name

Print-out the first 50 events from the GHEP (GENIE's native event format) event file generated during the previous step (there should be a file named `gntp.1000.ghep.root'):
shell& gevdump -n 50 -f gntp.1000.ghep.root

Generate a 10k event sample of pi^{+}+16O interactions for pi^{+}'s of 200 MeV kinetic energy:
shell& gevgen_hadron -n 10000 -p 211 -t 1000080160 -k 0.2 --seed 65431

If everything seems to work then the GENIE is really out of the bottle. Read the Physics and User manual for further instructions and information on GENIE tools. Have fun...