Chapter 13 Fast Detector Simulation and External Analysis
Events from a Monte Carlo event generator are further used in an analysis, most often combined with a detector simulation. Event files from the generator are then classified whether they are (i) parton level (coming from the hard matrix element) for which mostly LHE or HepMC event formats are used, particle level (after parton shower and hadronization) - usually in HepMC or LCIO format -, or detector level objects. The latter is the realm of packages like ROOT or specific software from the experimental software frameworks. While detailed experimental studies take into account the best-possible detector description in a so-called full simulation via Geant which takes several seconds per event, fast studies are made with parameterized fast detector simulations like in Delphes or SGV. In the following, we discuss the options to interface external packages for these purposes or to pipe events from WHIZARD to such external packages.
13.1 Interfacing ROOT
One of the most distributed analysis framework is ROOT . In WHIZARD for the moment there is no direct interface to the ROOT framework. The easiest way to write out particle-level events in the ROOT or RootTree format is to use WHIZARD’s interface to HepMC3: this modern incarnation of the HepMC format has different writer classes, where the writer class for ROOT and RootTree files is supported by WHIZARD’s HepMC3 interface. For this to work, one only has to make sure that HepMC3 has been built with ROOT support, and that the WHIZARD configure has to detect the ROOT setup on the computing environment. For more details cf. the installation section 2.2.9. If this has been successfully linked, then WHIZARD can use its own HepMC3 interface to write out ROOT or RootTree formats.
This can be done by setting the following options in the SINDARIN files:
For more details cf. the ROOT manual and documentation therein.
13.2 Interfacing RIVET
Rivet  is a very mighty analysis framework which has been developed to make experimental analyses from the LHC experiments available for non-collaboration members. It can be easily used to analyze events and produce high-quality plots for differential distributions and experimental observables. Since version 3  there is now also a lot of functionality that comes very handy for plotting differential distributions at fixed order in NLO calculations, e.g. negative weights in bins or how to treat imperfectly balanced events and counterevents close to bin boundaries etc. For the moment, WHIZARD does not have a dedicated interface to Rivet, so the preferred method is to write out events, best in the HepMC or HepMC3 format and then read them into Rivet. A more sophisticated interface is foreseen for a future version of WHIZARD, while there are already development versions where WHIZARD detects all the Rivet infrastructure and libraries. But they are not yet used.
For more details and practical examples cf. the Rivet manual. This describes in detail especially the Rivet installation. A typical error that occurs on systems where no ROOT is installed (cf. Sec. 13.1) is the one these Missing TPython.h missing headers. Then Rivet can nevertheless be easily built without ROOT support by setting
in the rivet-bootstrap script. For an installation of Rivet it is favorable to include the location of the Rivet Python scripts in the PYTHONPATH environment variable. They can be accessed from the Rivet configuration script as
If the Python path is not known within the environment variables, then one commonly encounters error like No module named rivet or Import error: no module named yoda when running Rivet scripts like e.g. yodamerge.
If you use a Rivet version older than v3.1.1 there is no support for HepMC3 yet, so when using HepMC3 with WHIZARD please use the backwards compatibility mode of HepMC3in the SINDARIN file:
When using MPI parallelized runs of WHIZARD there will a large number of different .hepmc files (also if some grid architecture has produced these event files in junks). Then one has to first merge these event files.
Here, we quickly explain how to steer Rivet for your own analysis. For more details, please confer the Rivet manual.
Clearly, this gives only a rough sketch on how to use Rivet for an analysis. For more details, please consult the Rivet webpage and the Rivet manual.
13.3 Fast Detector Simulation with DELPHES
Fast detector simulation allows relatively quick checks whether experimental analyses actually work in a semi-realistic detector study. There are some older tools for fast simulation like e.g. PGS (which is no longer actively maintained) and SGV which is default fast simulation for ILC studies. For LHC and general future hadron collider studies, Delphes  is the most commonly used tool for fast detector simulation.
The details on how to obtain and build Delphes can be obtained from their webpage, https://cp3.irmp.ucl.ac.be/projects/delphes. It depends both on Tcl/Tk as well as ROOT (cf. Sec. 13.1. Interfacing any Monte Carlo event generator with a fast detector simulation like Delphes is rather trivial: Delphes ships with up to five executables
DelphesPythia8 is a direct interface between PYTHIA8 and Delphes, so detector-level events are directly produced via an API interface between PYTHIA8 and Delphes. This is the most convenient method which is foreseen for WHIZARD, however not yet implemented. The other four binaries take input files in the HepMC, LHE, STDHEP and ROOT format, apply a fast detector simulation according to the chosen input file and give a ROOT detector-level event file as output.
Executing one of the binaries above without options, the following message will be displayed:
Using Delphes with HepMC event files then works as
For STDHEP files which are directly by WHIZARD without external packages (only assuming that the XDR C libraries are present on the system), execute
For LHE files as input, use
and for ROOT (particle-level) files use
In the Delphes cards directory, there is a long list of supported input files for existing and future detectors, a few of which we have displayed here.
Delphes detector-level output files can then be analyzed with ROOT as described in the Delphes manual.