HepMC3 event record library
IO-related classes and interfaces

This module contains interfaces for different IO formats, including an adapter for older version of HepMC files. To link rootIO engine in your code use libHepMC3rootIO.so (libHepMC3rootIO.dylib) library.


Optionally the I/O capabilities can be implemented as plugin Reader/Writer classes compiled separately into dynamically loadable libraries and used via RearedPlugin and WriterPlugin classes. Please note that all required libraries/dlls should be loadable. See examples for details.

In some cases the fine tuning of the Reader/Writer classes behavior can be done using a map of string "options"

void Reader::set_options(const std::map<std::string, std::string>& options)
std::map<std::string, std::string> Reader::get_options() const

The options for ReaderAsciiHepMC2 "disable_pad_cross_sections" "pad_cross_section_value"/"pad_cross_section_error" If "disable_pad_cross_sections" is present the reader will keep a single cross-section per event, just in the HepMC2 style. This is pre-3.2.6 default behaviour. Otherwise, the cross-section vector will be expanded to the size of event weights. This is 3.2.6+ default behaviour. If present, "pad_cross_section_value"/"pad_cross_section_error" values will be inserted into the cross-section vector. Otherwise, the cross-sections and errors will be filled with zeros.

"particle_flows_are_separated" "event_random_states_are_separated" "vertex_weights_are_separated" "particle_flows_are_separated" Regulate if the corresponding information from IO_GenEvent would be stored into multiple attributes as individual numbers, i.e. "separated" or as a single std::vector. The former behavior is used if the corresponding option name is present in the list of options, regardless of the option value. The later behavior is the default one.

The option for WriterAscii and WriterAsciiHepMC2

"float_printf_specifier"

specifies the float printf specifier used for the output format of the floats. Two first characters from the option value are used. The default behavior is equivalent to setting this option to "e" and results in the output formatted as " %.*e". To save the disk space one can use the "g" option, e.g.

WriterAscii outputA("someoutput.hepmc");
auto optionsA = outputA.get_options();
optionsA["float_printf_specifier"] = "g";
outputA.set_options(optionsA);

This option will be the default on in the future. Last update 12 Jun 2021