CMS 3D CMS Logo

ProcessDesc.cc
Go to the documentation of this file.
4 
5 namespace edm {
6 
7  ProcessDesc::ProcessDesc(std::shared_ptr<ParameterSet> pset)
8  : pset_(pset), services_(pset_->popVParameterSet(std::string("services"))) {}
9 
10  ProcessDesc::ProcessDesc(std::unique_ptr<ParameterSet> pset)
11  : pset_(std::move(pset)), services_(pset_->popVParameterSet(std::string("services"))) {}
12 
13  ProcessDesc::ProcessDesc(std::string const&) : pset_(new ParameterSet), services_{} {
14  throw Exception(errors::Configuration, "Old config strings no longer accepted");
15  }
16 
18 
20  // The standard services should be initialized first.
21  services_.insert(services_.begin(), pset);
22  }
23 
25  ParameterSet newpset;
26  newpset.addParameter<std::string>("@service_type", service);
27  addService(newpset);
28  }
29 
31  for (auto it = services_.begin(), itEnd = services_.end(); it != itEnd; ++it) {
32  std::string name = it->getParameter<std::string>("@service_type");
33  if (name == service) {
34  // Use the configured service. Don't add a default.
35  // However, the service needs to be moved to the front because it is a standard service.
36  ParameterSet pset = *it;
37  services_.erase(it);
39  return;
40  }
41  }
43  }
44 
46  for (auto it = services_.begin(), itEnd = services_.end(); it != itEnd; ++it) {
47  std::string name = it->getParameter<std::string>("@service_type");
48  if (name == service) {
49  // Remove the configured service before adding the default.
50  services_.erase(it);
51  break;
52  }
53  }
55  }
56 
57  void ProcessDesc::addServices(std::vector<std::string> const& defaultServices,
58  std::vector<std::string> const& forcedServices) {
59  // Add the default services to services_.
60  for (auto const& service : defaultServices) {
62  }
63  // Add the forced services to services_.
64  for (auto const& service : forcedServices) {
66  }
67  }
68 
70  std::string out = pset_->dump();
71  for (auto const& service : services_) {
72  out += service.dump();
73  }
74  return out;
75  }
76 } // namespace edm
service
Definition: service.py:1
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ProcessDesc::addServices
void addServices(std::vector< std::string > const &defaultServices, std::vector< std::string > const &forcedServices=std::vector< std::string >())
add some default services and forced services
Definition: ProcessDesc.cc:57
edm::ProcessDesc::services_
std::vector< ParameterSet > services_
Definition: ProcessDesc.h:47
EDMException.h
ProcessDesc.h
edm::ParameterSet
Definition: ParameterSet.h:47
edm::ParameterSet::addParameter
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ProcessDesc::addForcedService
void addForcedService(std::string const &service)
add a service and replace it if it's already there
Definition: ProcessDesc.cc:45
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
Exception
Definition: hltDiff.cc:245
edm::ProcessDesc::~ProcessDesc
~ProcessDesc()
Definition: ProcessDesc.cc:17
edm::ProcessDesc::addService
void addService(ParameterSet &pset)
Definition: ProcessDesc.cc:19
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ProcessDesc::dump
std::string dump() const
Definition: ProcessDesc.cc:69
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ParameterSet.h
edm::ProcessDesc::addDefaultService
void addDefaultService(std::string const &service)
add a service if it's not already there
Definition: ProcessDesc.cc:30
edm::ProcessDesc::pset_
edm::propagate_const< std::shared_ptr< ParameterSet > > pset_
Definition: ProcessDesc.h:46
edm::errors::Configuration
Definition: EDMException.h:36
edm::ProcessDesc::ProcessDesc
ProcessDesc(std::shared_ptr< ParameterSet > pset)
Definition: ProcessDesc.cc:7
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27