Home | News | Documentation | Download

.hepmc to .root conversion

I generated MC events using Pythia8 interface of Madgraph5. But the output format of the file is .hepmc which I can’t load to ROOT for my analysis. So how to convert it to .root format.

Hi,

would this solution work for you? HepMC to root

Cheers,
D

Thanks for the message. However, Its not working. I am getting an error message:

krunal@krunal-Inspiron-5737:~/Downloads$ cd test
krunal@krunal-Inspiron-5737:~/Downloads/test$ ls
Classes.h go LinkDef.h readEvt.cc writeEvt.cc
krunal@krunal-Inspiron-5737:~/Downloads/test$ ./go
In file included from input_line_12:6:
./Classes.h:1:10: fatal error: ‘HepMC/SimpleVector.h’ file not found
#include “HepMC/SimpleVector.h”
^
Error: rootcint: compilation failure (./HepMCDictc565779476_dictUmbrella.h)
g++: error: HepMCDict.cxx: No such file or directory
g++: fatal error: no input files
compilation terminated.
g++: error: HepMCDict.o: No such file or directory
g++: error: /home/krunal/hepmc/lib/libHepMC.a: No such file or directory
In file included from /opt/root/include/RtypesCore.h:24:0,
from /opt/root/include/Rtypes.h:24,
from /opt/root/include/TObject.h:18,
from /opt/root/include/TBuffer.h:25,
from /opt/root/include/TDirectory.h:25,
from /opt/root/include/TROOT.h:29,
from writeEvt.cc:4:
/opt/root/include/RConfig.h:41:3: error: #error “ROOT requires support for C++11 or higher.”

error “ROOT requires support for C++11 or higher.”

^
/opt/root/include/RConfig.h:43:4: error: #error “Pass -std=c++11 as compiler argument.”

error “Pass -std=c++11 as compiler argument.”

^

In file included from /usr/include/c++/5/atomic:38:0,
from /opt/root/include/Rtypes.h:37,
from /opt/root/include/TObject.h:18,
from /opt/root/include/TBuffer.h:25,
from /opt/root/include/TDirectory.h:25,
from /opt/root/include/TROOT.h:29,
from writeEvt.cc:4:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support
^
writeEvt.cc:9:28: fatal error: HepMC/GenEvent.h: No such file or directory
compilation terminated.
gcc: error: libClassesDict.so: No such file or directory

I tried out with the version available on HepMC website as well (http://hepmcanalysistool.desy.de/) but I get the same error again.

You need modify the first line of the ‘go’ script:

export HEPMCPATH=$HOME/hepmc

to point to your installation of hepmc.

Cheers,
Philippe.

Thank you for the reply. But I am still getting the installation error:
krunal@krunal-Inspiron-5737:~/Downloads$ export PATH=$HOME/hepmc
krunal@krunal-Inspiron-5737:~/Downloads$ cd test
krunal@krunal-Inspiron-5737:~/Downloads/test$ ./go
./go: line 4: rootcint: command not found
./go: line 6: g++: command not found
./go: line 7: g++: command not found
./go: line 9: gcc: command not found
./go: line 14: gcc: command not found

And if I use “krunal@krunal-Inspiron-5737:~/Downloads$ export HEPMCPATH=$HOME/hepmc”,
I get the same error I stated above.

Also, what we are doing is just the installation I guess. What command should I use to convert the .hepmc to .root file?
Thank you in advance!

export PATH=$HOME/hepmc

This wipes you path, you meant

export PATH=$HOME/hepmc:${PATH}

Also, what we are doing is just the installation I guess. What command should I use to convert the .hepmc to .root file?

Use the resulting writeEvt

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.