Skip to content

Commit

Permalink
dd4hep: PR1106 patch (#446)
Browse files Browse the repository at this point in the history
### Briefly, what does this PR introduce?
Backports DD4hep PR 1106 to v1.25.1
  • Loading branch information
wdconinc committed May 31, 2023
1 parent 3773438 commit 24b1316
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/dd4hep/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class Dd4hep(BuiltinDd4hep):
sha256="d84db1f3a8eb3e8b9398db9aab3753569855bc5753f9f15faf62bfdbe28f8f5c",
when="@1.24:1.25.1",
)
patch(
"pr1106-1-25-1.patch",
sha256="73932633e95272f77c1f6ad8edf06d426b198c30a9c9467167c04f3a3f7f5d12",
when="@1.25.1",
)
patch(
"https://github.com/AIDASoft/DD4hep/commit/8693a29669d03dec5e06b61e6df7cc0df1e0aa5c.patch",
sha256="28fb1c17eb1c06c24b304511308fd3b0af708f2ba3aec3e4cb13d7da6abbc51c",
Expand Down
36 changes: 36 additions & 0 deletions packages/dd4hep/pr1106-1-25-1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/DDCore/src/DetectorImp.cpp b/DDCore/src/DetectorImp.cpp
index 12262bb7..c938ad6a 100644
--- a/DDCore/src/DetectorImp.cpp
+++ b/DDCore/src/DetectorImp.cpp
@@ -631,17 +631,22 @@ vector<DetElement> DetectorImp::detectors(const string& type1,
}

Handle<NamedObject> DetectorImp::getRefChild(const HandleMap& e, const string& name, bool do_throw) const {
- HandleMap::const_iterator i = e.find(name);
- if (i != e.end()) {
- return (*i).second;
+ HandleMap::const_iterator it = e.find(name);
+ if (it != e.end()) {
+ return it->second;
}
if (do_throw) {
- int cnt = 0;
- cout << "GetRefChild: Failed to find child with name: " << name
- << " Map contains " << e.size() << " elements." << endl;
- for(i=e.begin(); i!=e.end(); ++i)
- cout << " " << cnt << " " << (*i).first << endl;
- throw runtime_error("Cannot find a child with the reference name:" + name);
+ std::stringstream err;
+ err << "getRefChild: Failed to find child with name: " << name
+ << " Map contains " << e.size() << " elements: {";
+ for (it = e.begin(); it != e.end(); ++it) {
+ if (it != e.begin()) {
+ err << ", " << endl;
+ }
+ err << it->first << endl;
+ }
+ err << "}";
+ throw runtime_error(err.str());
}
return 0;
}

0 comments on commit 24b1316

Please sign in to comment.