Skip to content

npsim support for gzipped hepmc files

HepMC does not support gzipped files directly. That is provided by external packages: e.g. zstr wrapper for fstream in rivet at https://gitlab.com/hepcedar/rivet/-/commit/4cd4728ae78a721498514c69aab0db11d30307f8 (zstr is MIT licensed).

Here's the relevant snipped:

      #ifdef HAVE_LIBZ
      // NB. zstr auto-detects if file is deflated or plain-text
      _istr.reset(new zstr::ifstream(evtfile.c_str()));
      #else
      _istr.reset(new std::fstream(evtfile.c_str(), std::ios::in));
      #endif
      _io.reset(new HepMC::IO_GenEvent(*_istr));
Edited by Wouter Deconinck