LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ModuleConfigInfo.cc
Go to the documentation of this file.
2 
4 
5 #include <algorithm>
6 #include <string>
7 
9  fhicl::ParameterSet const& procPS,
10  std::string const& label,
11  std::string const& configPath)
12  : label_(label)
13  , configPath_(configPath)
14  , moduleType_(calcConfigType_())
15  , modPS_(procPS.get<fhicl::ParameterSet>(configPath_ + '.' + label_))
16  , libSpec_(modPS_.get<std::string>("module_type"))
17 {}
18 
19 std::vector<std::string> const&
21 {
22  static const std::vector<std::string> s_allModulePathRoots = {
23  "physics.analyzers", "physics.filters", "outputs", "physics.producers"};
24  return s_allModulePathRoots;
25 }
26 
27 // Called from initializer: verify initialization order with member data
28 // use if altering this function!
31 {
32  auto const& paths = allModulePathRoots();
33  switch (std::find(paths.cbegin(), paths.cend(), configPath_) -
34  paths.cbegin()) {
35  case 0:
36  return ModuleType::ANALYZER;
37  case 1:
38  return ModuleType::FILTER;
39  case 2:
40  return ModuleType::OUTPUT;
41  case 3:
42  return ModuleType::PRODUCER;
43  default:
45  << "Unrecognized module path " << configPath_ << ".\n";
46  };
47 }
STL namespace.
ModuleConfigInfo(fhicl::ParameterSet const &procPS, std::string const &label, std::string const &configPath)
parameter set interface
static std::vector< std::string > const & allModulePathRoots()
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
ModuleType calcConfigType_() const
ModuleType
Definition: ModuleType.h:22