diff --git a/DDCore/include/DD4hep/Detector.h b/DDCore/include/DD4hep/Detector.h index 46a4c0d95..76d8b8021 100644 --- a/DDCore/include/DD4hep/Detector.h +++ b/DDCore/include/DD4hep/Detector.h @@ -194,7 +194,7 @@ namespace dd4hep { is not present. Otherwise an empty detector container is returned. */ virtual const std::vector& detectors(const std::string& type, - bool throw_exc=false) = 0; + bool throw_exc=false) const = 0; /// Access a set of subdetectors according to several sensitive types. virtual std::vector detectors(const std::string& type1, diff --git a/DDCore/include/DD4hep/DetectorImp.h b/DDCore/include/DD4hep/DetectorImp.h index 175940116..37dae4c5f 100644 --- a/DDCore/include/DD4hep/DetectorImp.h +++ b/DDCore/include/DD4hep/DetectorImp.h @@ -320,7 +320,7 @@ namespace dd4hep { - If throw_exc is set to true, an exception is thrown if the type is not present. Otherwise an empty detector container is returned. */ - virtual const std::vector& detectors(const std::string& type, bool throw_exc) override; + virtual const std::vector& detectors(const std::string& type, bool throw_exc) const override; /// Access a set of subdetectors according to several sensitive types. virtual std::vector detectors(const std::string& type1, diff --git a/DDCore/src/DetectorImp.cpp b/DDCore/src/DetectorImp.cpp index 9ab77d86d..7e5eeb4d3 100644 --- a/DDCore/src/DetectorImp.cpp +++ b/DDCore/src/DetectorImp.cpp @@ -572,7 +572,7 @@ vector DetectorImp::detectorTypes() const { } /// Access a set of subdetectors according to the sensitive type. -const vector& DetectorImp::detectors(const string& type, bool throw_exc) { +const vector& DetectorImp::detectors(const string& type, bool throw_exc) const { if ( m_manager->IsClosed() ) { DetectorTypeMap::const_iterator i=m_detectorTypes.find(type); if ( i != m_detectorTypes.end() ) return (*i).second;