File indexing completed on 2024-04-06 12:30:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "SimG4Core/SensitiveDetector/interface/sensitiveDetectorMakers.h"
0017 #include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h"
0018 #include "FWCore/PluginManager/interface/PluginManager.h"
0019 #include "FWCore/Utilities/interface/Exception.h"
0020
0021 namespace sim {
0022 std::unordered_map<std::string, std::unique_ptr<SensitiveDetectorMakerBase>> sensitiveDetectorMakers(
0023 edm::ParameterSet const& pset, edm::ConsumesCollector cc, std::vector<std::string> const& chosenMakers) {
0024 std::unordered_map<std::string, std::unique_ptr<SensitiveDetectorMakerBase>> retValue;
0025 if (chosenMakers.empty()) {
0026
0027 auto const& categoriesToInfo = edmplugin::PluginManager::get()->categoryToInfos();
0028 auto infosItr = categoriesToInfo.find(SensitiveDetectorPluginFactory::get()->category());
0029 if (infosItr == categoriesToInfo.end()) {
0030 throw cms::Exception("MissingPlugins")
0031 << "When trying to load all SensitiveDetectorMakerBase, no plugins found";
0032 } else {
0033 for (auto const& info : infosItr->second) {
0034 retValue[info.name_] = SensitiveDetectorPluginFactory::get()->create(info.name_, pset, cc);
0035 }
0036 }
0037 } else {
0038 for (auto const& name : chosenMakers) {
0039 retValue[name] = SensitiveDetectorPluginFactory::get()->create(name, pset, cc);
0040 }
0041 }
0042 return retValue;
0043 }
0044 }