CMS 3D CMS Logo

sensitiveDetectorMakers.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SimG4Core/SensitiveDetector
4 // Class : sensitiveDetectorMakers
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Christopher Jones
10 // Created: Mon, 07 Jun 2021 19:48:40 GMT
11 //
12 
13 // system include files
14 
15 // user include files
20 
21 namespace sim {
22  std::unordered_map<std::string, std::unique_ptr<SensitiveDetectorMakerBase>> sensitiveDetectorMakers(
23  edm::ParameterSet const& pset, edm::ConsumesCollector cc, std::vector<std::string> const& chosenMakers) {
24  std::unordered_map<std::string, std::unique_ptr<SensitiveDetectorMakerBase>> retValue;
25  if (chosenMakers.empty()) {
26  //load all
27  auto const& categoriesToInfo = edmplugin::PluginManager::get()->categoryToInfos();
28  auto infosItr = categoriesToInfo.find(SensitiveDetectorPluginFactory::get()->category());
29  if (infosItr == categoriesToInfo.end()) {
30  throw cms::Exception("MissingPlugins")
31  << "When trying to load all SensitiveDetectorMakerBase, no plugins found";
32  } else {
33  for (auto const& info : infosItr->second) {
34  retValue[info.name_] = SensitiveDetectorPluginFactory::get()->create(info.name_, pset, cc);
35  }
36  }
37  } else {
38  for (auto const& name : chosenMakers) {
39  retValue[name] = SensitiveDetectorPluginFactory::get()->create(name, pset, cc);
40  }
41  }
42  return retValue;
43  }
44 } // namespace sim
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:82
static const TGPicture * info(bool iBackgroundIsBlack)
std::unordered_map< std::string, std::unique_ptr< SensitiveDetectorMakerBase > > sensitiveDetectorMakers(edm::ParameterSet const &, edm::ConsumesCollector, std::vector< std::string > const &chosenMakers)
#define get
static PluginManager * get()