Importing HepMC3 files into Geant4

I would like to import primary event data written by pythia as an ascii hepmc3 file into my geant4 code.
It looks like the examples extended/eventgenerator/HepMC/HepMCEx01 and 02 should do this. However when I try to build them, I get an error message

undefined reference to `HepMC::IO_GenEvent::IO_GenEvent(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::_Ios_Openmode)’

which I think is because the examples are written for HepMC2 not HepMC3. I have tried a lot of things to get it working without success.

My questions are:

  1. Is there a simple way to get these examples working?
  2. Are there any other examples showing how to import hepmc files which work with HepMC3?
  3. If hepmc is not the way to go, is there a better way to transfer pythia output into geant4? Is there an example that will show how to do this?

Thanks

Geant4 Version: 10.5
Operating System: Linux centos7
Compiler/Version: gcc 6.3
CMake Version: 2.8.12.2

There is a Draft implementation of HepMC3 support contributed here: Update cmake files in the examples related to HepMC and event generators by andriish · Pull Request #45 · Geant4/geant4 · GitHub which might help, but note its still WIP.

1 Like

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