Skip to content

Commit

Permalink
feat: add m_detectorTypes[""]={} to return on failed lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
wdconinc committed Jul 26, 2023
1 parent ad3c96d commit 4c26c03
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion DDCore/src/DetectorImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ Material DetectorImp::material(const string& name) const {

/// Internal helper to map detector types once the geometry is closed
void DetectorImp::mapDetectorTypes() {
m_detectorTypes[""] = {};
for( const auto& i : m_detectors ) {
DetElement det(i.second);
if ( det.parent().isValid() ) { // Exclude 'world'
Expand Down Expand Up @@ -579,7 +580,7 @@ const vector<DetElement>& DetectorImp::detectors(const string& type, bool throw_
throw runtime_error("detectors("+type+"): Detectors of this type do not exist in the current setup!");
}
// return empty vector instead of exception
return m_detectorTypes[ type ] ;
return m_detectorTypes.at("") ;
}
throw runtime_error("detectors("+type+"): Detectors can only selected by type once the geometry is closed!");
}
Expand Down

0 comments on commit 4c26c03

Please sign in to comment.