Skip to content

Commit

Permalink
HepMC3FileReader: fix loading of run info for RootTree HepMC3 input f…
Browse files Browse the repository at this point in the history
…ormat

This is done by actually reading an event instead of skipping one.
Skipping may be sufficient for the ASCII reader, however, RootTree reader does not perform a read on skip:
https://gitlab.cern.ch/hepmc/HepMC3/-/blob/master/rootIO/src/ReaderRootTree.cc#L76-80
  • Loading branch information
veprbl authored and andresailer committed Aug 31, 2023
1 parent 8715c52 commit ce7bfea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion DDG4/hepmc/HepMC3FileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ HEPMC3FileReader::HEPMC3FileReader(const std::string& nam)
m_reader = HepMC3::deduce_reader(nam);
#if HEPMC3_VERSION_CODE >= 3002006
// to get the runInfo in the Ascii reader we have to force HepMC to read the first event
m_reader->skip(1);
HepMC3::GenEvent dummy;
m_reader->read_event(dummy);
// then we get the run info (shared pointer)
auto runInfo = m_reader->run_info();
// and deallocate the reader
Expand Down

0 comments on commit ce7bfea

Please sign in to comment.