-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dd4hep: patch 1.26 to enable HepMC3FileReader XRootD reading again (#527
) ### Briefly, what does this PR introduce? This patches DD4hep-1.26 to enable the HepMC3FileReader to read XRootD files again. Ref: AIDASoft/DD4hep#1156.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
diff --git a/DDG4/hepmc/HepMC3FileReader.cpp b/DDG4/hepmc/HepMC3FileReader.cpp | ||
index b94897ab..07b5505f 100644 | ||
--- a/DDG4/hepmc/HepMC3FileReader.cpp | ||
+++ b/DDG4/hepmc/HepMC3FileReader.cpp | ||
@@ -129,16 +129,18 @@ 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) | ||
- auto runInfo = m_reader->run_info(); | ||
- // and close the reader | ||
- m_reader->close(); | ||
- // so we can open the file again from the start | ||
- m_reader = HepMC3::deduce_reader(nam); | ||
- // and set the run info object now | ||
- m_reader->set_run_info(runInfo); | ||
+ if (nam.rfind(".root") != nam.size() - 5) { | ||
+ // 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) | ||
+ auto runInfo = m_reader->run_info(); | ||
+ // and close the reader | ||
+ m_reader->close(); | ||
+ // so we can open the file again from the start | ||
+ m_reader = HepMC3::deduce_reader(nam); | ||
+ // and set the run info object now | ||
+ m_reader->set_run_info(runInfo); | ||
+ } | ||
#endif | ||
m_directAccess = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters