## RIVET usage

RIVET is a toolkit for the validation of Monte Carlo event generators [Buc10]. It contains the results of many experimental analyses, so that generator output can easily be compared to data, as well as providing a framework to implement your own analyses. Although using PYTHIA with RIVET is not officially supported, some helpful hints are given below. The full RIVET manual is available online.

### Using PYTHIA with RIVET

The following assumes that you already have RIVET installed. Instructions for this may be found here.
Events are passed from PYTHIA to RIVET using the HepMC format. PYTHIA must be compiled with HepMC support, using the same version of HepMC used when compiling RIVET. This is setup through the PYTHIA `configure` script e.g.

      ./configure --with-hepmc=/path/to/HepMC --with-hepmcversion=HepMC.version.number

The PYTHIA library itself does not need to be recompiled.
The `examples/main42.cc` sample program can then be used to generate events in HepMC format (which `examples/main61.cc` and `examples/main62.cc` extends by allowing LHAPDF usage and subruns). When in the `examples` directory, the main program can be built and used as follows

      make main42
      ./main42 main42.cmnd main42.hepmc

The first argument is the input file which provides the options for event generation, while the second is the output file where the HepMC events should be written.
This HepMC file may now be read and processed by RIVET

      rivet --analysis=ANALYSIS_NAME main42.hepmc

where `ANALYSIS_NAME` is a built-in RIVET analysis, or one you have created yourself. The output of RIVET is in the form of `.aida` files, containing the histograms for the analysis, which can be processed further with RIVET (see the RIVET documentation for more details).
The above examples requires that (potentially large) HepMC events are stored to disk before being read by RIVET. It is possible, instead, to pass the events directly to RIVET as they are produced by using a `FIFO` pipe. This is done with the `mkfifo` command

      mkfifo my_fifo
      ./main42.exe main42.cmnd my_fifo &
      rivet --analysis=ANALYSIS_NAME my_fifo

Note that `main42` is run in the background.