From ce7bfea294a4daa5bfeb590852fabe3ca87353c4 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Wed, 30 Aug 2023 15:27:56 -0400 Subject: [PATCH] HepMC3FileReader: fix loading of run info for RootTree HepMC3 input format 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 --- DDG4/hepmc/HepMC3FileReader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DDG4/hepmc/HepMC3FileReader.cpp b/DDG4/hepmc/HepMC3FileReader.cpp index 9e0f36daf..d2711c817 100644 --- a/DDG4/hepmc/HepMC3FileReader.cpp +++ b/DDG4/hepmc/HepMC3FileReader.cpp @@ -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