First get the (precompiled) HepMC2 package:
> mkdir HepMC
> cd HepMC
> wget http://lcgapp.cern.ch/project/simu/HepMC/download/HepMC-2.06.08-x86_64-> slc6-gcc45-opt.tar.gz
> tar -xvzf HepMC-2.06.08-x86_64-slc6-gcc45-opt.tar.gz
> pwd (/home/potter/HepMC/x86_64-slc6-gcc45-opt)
Go to your pythia8 directory and clean the previous Pythia8 installation:
> cd /home/potter/pythia8235/
> make clean
Now modify the Makefile.inc file to include HepMC2:
# HEPMC2 configuration.
HEPMC2_USE=true
HEPMC2_BIN=
HEPMC2_INCLUDE=/home/potter/HepMC/x86_64-slc6-gcc45-opt/include
HEPMC2_LIB=/home/potter/HepMC/x86_64-slc6-gcc45-opt/lib
And make again, this time including HepMC2 through the Makefile.inc file:
>make
Go to the examples directory to try a test to see if it's working:
> cd examples
> make main41
> ./main41
> ls hepmcout41.dat
It should run and produce the hepmcout41.dat file, which DelphesHepMC executable can read. Try it with the CMS detector card!
> cp hepmcout41.dat /home/potter/Delphes-3.4.1/
> cd /home/potter/Delphes-3.4.1/
> ./DelphesHepMC cards/delphes_card_CMS.tcl test.delphes.root hepmcout41.dat
Now let's start on the Tevatron project. Go back to the Pythia8 directory and make a dedicated directory:
> cd /home/potter/pythia8235/
> mkdir tevatron
> cd tevatron
> cp ../examples/Makefile .
> cp ../examples/Makefile.inc .
Now modify Makefile to include a a project called mainTevatron:
# HEPMC2.
mainTevatron main41 main42 main43 main85 main86 main87 main88 main89: $$@.cc\
Open up a file called mainTevatron.cc and put some code in there (see below). Then make the executable and run it:
> make mainTevatron
> ./mainTevatron
> cp ttbar_tevatron.hepmc /home/potter/Delphes-3.4.1/
> cd /home/potter/Delphes-3.4.1/
> ./DelphesHepMC cards/delphes_card_CMS.tcl ttbar_tevatron.root ttbar_tevatron.hepmc
Now open up ttbar_tevatron.root in a TBrowser and enjoy!
> root -l ttbar_tevatron.root
The file mainTevatron.cc should contain:
#include "Pythia8/Pythia.h"
#include "Pythia8Plugins/HepMC2.h"
using namespace Pythia8;
int main() {
// Interface for conversion from Pythia8::Event to HepMC event.
HepMC::Pythia8ToHepMC ToHepMC;
// Specify file where HepMC events will be stored.
HepMC::IO_GenEvent ascii_io("ttbar_tevatron.hepmc", std::ios::out);
Pythia pythia;
pythia.readString("Beams:eCM = 1800.");
pythia.readString("Top:gg2ttbar=on");
pythia.readString("Top:qqbar2ttbar=on");
pythia.init();
for (int iEvent = 0; iEvent < 10000; ++iEvent) {
if (!pythia.next()) continue;
// Construct new empty HepMC event and fill it.
HepMC::GenEvent* hepmcevt = new HepMC::GenEvent();
ToHepMC.fill_next_event( pythia, hepmcevt );
// Write the HepMC event to file. Done with it.
ascii_io << hepmcevt;
delete hepmcevt;
}
pythia.stat();
return 0;
}