# Creating EVGEN

HepSim is optimized to keep truth-level in the “archive” formats called ProMC or ProIO. It allows to keep data in a compact form optimized for data streaming over the network, together with logfiles which will help to identify the MC settings.

# Using Pythia8

Basic examples how to make ProMC and ProIO files from Pythia8 are given in HepSim-Org. See “pythia8promc” and “pythia8proio” repository.

# Singularity containers

Generally, you do not need to install Pythia8 to create ProMC files. You can run Pythia8 using the HepSim singularity container. This topic is described in HepSim singularity container section. Below we give the description how to use Pythia8 if you do not want to use HepSim docker container.

ProMC files can be created directly by Pythia8. Look at the example “examples/main46.cc” inside the Pythi8 distribution. To compile it, please install ProMC package first, before running configuration script of Pythia8. If the environmental variable “PROMC” was set, then you can compile “main46.cc” example.

# Using converters

You can convert files in the format “HEPMC”, “LHE”, “STDHEP” to ProMC as shown in the “example” directory of the installed ProMC package (look at the directory \$PROMC/examples). The converters are:

• hepmc2promc
• lhe2promc
• stdhep2promc
• txt2promc

Look at the ProMC manuals for more examples.

One useful example showing how to read a text file with Monte Carlo events and fill correct ProMC file is given by the example “txt2promc”. Simply run the script “README”.

To run MG5 with ProMC, please install ProMC package first. Then download MG5 package with preconfigured ProMC converter from package_mg14tev.tgz.

wget https://atlaswww.hep.anl.gov/hepsim/soft/package_mg14tev.tgz
tar -zvxf package_mg14tev.tgz

Now check that ProMC is correctly installed. You should be able to compile “stdhep2promc” converter.

cd package/stdhep2promc
make

If successful, then you should see the binary file “stdhep2promc”.

Now let compile and run “MG5”. Go to the directory “MG5_aMC_v2_3_2_2”. This directory has the standard MG5 package, a few useful bash scripts, and a few preconfigured jobs for 14 TeV pp collision. We assume 64bit Scientific Linux 6.5 computer. Setup gcc47. In the case of ATLAS setup, use:

source setup_gcc47.sh

To create multiple number of files in the ProMC format for “ttbar+jet”, run this script:

./A_RUN_ttbar_jet

It does the following: It runs the script “RUN_ttbar_jet_14tev” which creates promc files inside “out” directory. It also reset the seed for each jobs, and runs the promc converter. The number of output files are given inside the script A_RUN_ttbar_jet. You should reduce this number if you want to stop earlier.

All MG5 settings for this particular run are in the directory “run_ttbar_jet_14tev”. This is the standard MG5 directory. For example, the MG5 settings are given for this script are given in the directory “run_ttbar_jet_14tev/Cards”

To check the output ProMC file, look at the browser:

wget  http://atlaswww.hep.anl.gov/asc/promc/download/browser_promc.jar  # get GUI browser
java -jar browser_promc.jar out/file.promc 

where “file” is the name of the file being created. Typically, it takes 3h to create one file with 10,000 events.

You can host these files on your data storage, or send an email to “[email protected]” to relocated them to the OSG-grid file storage.

# Single-particle gun

ProMC files with single particles can be created using the ProMC. Download the recent ProMC package and look at the directory:

wget http://atlaswww.hep.anl.gov/asc/promc/download/current.php -O ProMC.tgz
tar -zvxf ProMC.tgz
cd examples/particle_gun
source setup.sh
javac promc_gun.java
java promc_gun pions.promc 100 211 1000 # E=0-100 GeV, PID=211, events=1000

This creates file “pions.promc” with 2 particles per event, with the maximum energy of 100 GeV (randomly distributed from 0 to 100). The particles are pions (pi+, pid=211). The total number of events 1000. The phi and theta distributions are flat After file creation, look at the events using the file browser. You can also modify the java code to change the single-particle events.

# Pileups mixing

One can mix events from a signal ProMC file with inelastic (minbias) events using a “pileup” mixing program. The next example assumes that either the hs-tools package or Jas4pp is installed.

hs-pileup pN signal.promc minbias.promc output.promc

Here “p” indicates that N events from minbias.promc will be mixed with every event from signal.promc using a Poisson distribution. If “p” is missing, then exactly N events from minbias.promc will be mixed with single event from signal.promc. Use large number of events in minbias.promc to minimise reuse of the same events from the minbias.promc. The barcode of particles inside output.promc indicates the event origin.

Here is an example to create events with pileup for the paper http://arxiv.org/abs/1504.08042 Phys. Rev. D 91, 114018 (2015): We mix h→ HH signal file with MinBias Pythia8 (A2 tune) sample using <mu>=200 (Poisson mean):

wget http://atlaswww.hep.anl.gov/asc/hepsim/soft/hs-toolkit.tgz -O - | tar -xz;
source hs-toolkit/setup.sh
wget http://mc.hep.anl.gov/asc/hepsim/events/pp/100tev/minbias_a2_pythia8_l3/tev100_pythia8_MinBias_l3__A2_001.promc
wget http://mc.hep.anl.gov/asc/hepsim/events/pp/100tev/s0higgshiggs_alltau/tev100_s0higgshiggs_alltau_0001.promc
hs-pileup p200 tev100_s0higgshiggs_alltau_0001.promc tev100_pythia8_MinBias_l3__A2_001.promc output.promc 

Look at the “output.promc” with the browser to see how events are filled. Now you can use DELPHES to create fast simulation files using events with pileup.

Note: pileup mixer is implemented in Java, therefore it uses 64bit zip. For C++ programs, please use ProMCBook(“file.promc”, “r”, true) to open ProMC files (notice “true” as a new argument). For example, for the Delphes program, change the line

inputFile = new ProMCBook(argv[i], "r");       # 32bit zip

inputFile = new ProMCBook(argv[i], "r", true); # 64bit zip