Skip to content

Commit

Permalink
HepMCFileReader: set_run_info only in latest HepMC
Browse files Browse the repository at this point in the history
  • Loading branch information
andresailer committed Jul 24, 2023
1 parent 76f2454 commit 54dcf46
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions DDG4/hepmc/HepMC3FileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "DDG4/RunParameters.h"

#include <HepMC3/ReaderFactory.h>
#include <HepMC3/Version.h>

/// Namespace for the AIDA detector description toolkit
namespace dd4hep {
Expand Down Expand Up @@ -127,6 +128,7 @@ HEPMC3FileReader::HEPMC3FileReader(const std::string& nam)
{
printout(INFO,"HEPMC3FileReader","Created file reader. Try to open input %s", nam.c_str());
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);
// then we get the run info (shared pointer)
Expand All @@ -137,6 +139,7 @@ HEPMC3FileReader::HEPMC3FileReader(const std::string& nam)
m_reader = HepMC3::deduce_reader(nam);
// and set the run info object now
m_reader->set_run_info(runInfo);
#endif
m_directAccess = false;
}

Expand Down

0 comments on commit 54dcf46

Please sign in to comment.