-
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.
### Briefly, what does this PR introduce? Backports DD4hep PR 1106 to v1.25.1
- Loading branch information
Showing
2 changed files
with
41 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
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,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; | ||
} |