CMS 3D CMS Logo

ScheduleItems.cc
Go to the documentation of this file.
2 
23 
24 #include <memory>
25 
26 #include <set>
27 
28 namespace edm {
30  : actReg_(std::make_shared<ActivityRegistry>()),
31  preg_(std::make_shared<SignallingProductRegistry>()),
32  branchIDListHelper_(std::make_shared<BranchIDListHelper>()),
33  thinnedAssociationsHelper_(std::make_shared<ThinnedAssociationsHelper>()),
34  subProcessParentageHelper_(),
35  act_table_(),
36  processConfiguration_() {}
37 
39  SubProcess const& om,
40  SubProcessBlockHelper& subProcessBlockHelper,
41  ProcessBlockHelperBase const& parentProcessBlockHelper)
42  : actReg_(std::make_shared<ActivityRegistry>()),
43  preg_(std::make_shared<SignallingProductRegistry>(preg)),
44  branchIDListHelper_(std::make_shared<BranchIDListHelper>()),
45  thinnedAssociationsHelper_(std::make_shared<ThinnedAssociationsHelper>()),
46  subProcessParentageHelper_(std::make_shared<SubProcessParentageHelper>()),
47  act_table_(),
48  processConfiguration_() {
49  for (auto& item : preg_->productListUpdator()) {
50  BranchDescription& prod = item.second;
51  prod.setOnDemand(false);
52  prod.setProduced(false);
53  }
54 
55  // Mark dropped branches as dropped in the product registry.
56  std::set<BranchID> keptBranches;
57  SelectedProducts const& keptVectorP = om.keptProducts()[InProcess];
58  for (auto const& item : keptVectorP) {
59  BranchDescription const& desc = *item.first;
60  keptBranches.insert(desc.branchID());
61  }
62  SelectedProducts const& keptVectorR = om.keptProducts()[InRun];
63  for (auto const& item : keptVectorR) {
64  BranchDescription const& desc = *item.first;
65  keptBranches.insert(desc.branchID());
66  }
67  SelectedProducts const& keptVectorL = om.keptProducts()[InLumi];
68  for (auto const& item : keptVectorL) {
69  BranchDescription const& desc = *item.first;
70  keptBranches.insert(desc.branchID());
71  }
72  SelectedProducts const& keptVectorE = om.keptProducts()[InEvent];
73  for (auto const& item : keptVectorE) {
74  BranchDescription const& desc = *item.first;
75  keptBranches.insert(desc.branchID());
76  }
77  for (auto& item : preg_->productListUpdator()) {
78  BranchDescription& prod = item.second;
79  if (keptBranches.find(prod.branchID()) == keptBranches.end()) {
80  prod.setDropped(true);
81  }
82  }
83  subProcessBlockHelper.updateFromParentProcess(parentProcessBlockHelper, *preg_);
84  }
85 
86  ServiceToken ScheduleItems::initServices(std::vector<ParameterSet>& pServiceSets,
88  ServiceToken const& iToken,
90  bool associate) {
91  //create the services
92  ServiceToken token(ServiceRegistry::createSet(pServiceSets, iToken, iLegacy, associate));
93 
94  //see if any of the Services have to have their PSets stored
95  for (auto const& item : pServiceSets) {
96  if (item.exists("@save_config")) {
97  parameterSet.addParameter(item.getParameter<std::string>("@service_type"), item);
98  }
99  }
100  // Copy slots that hold all the registered callback functions like
101  // PostBeginJob into an ActivityRegistry
102  token.copySlotsTo(*actReg_);
103  return token;
104  }
105 
107  //add the ProductRegistry as a service ONLY for the construction phase
109  auto reg = std::make_shared<w_CPR>(std::make_unique<ConstProductRegistry>(*preg_));
111 
112  // the next thing is ugly: pull out the trigger path pset and
113  // create a service and extra token for it
114 
115  typedef service::TriggerNamesService TNS;
117 
118  auto tnsptr = std::make_shared<w_TNS>(std::make_unique<TNS>(parameterSet));
119 
121  }
122 
123  std::shared_ptr<CommonParams> ScheduleItems::initMisc(ParameterSet& parameterSet) {
124  act_table_ = std::make_unique<ExceptionToActionTable>(parameterSet);
126  processConfiguration_ = std::make_shared<ProcessConfiguration>(
127  processName, getReleaseVersion(), getPassID()); // propagate_const<T> has no reset() function
128  auto common = std::make_shared<CommonParams>(
130  parameterSet.getUntrackedParameterSet("maxLuminosityBlocks").getUntrackedParameter<int>("input"),
131  parameterSet.getUntrackedParameterSet("maxSecondsUntilRampdown").getUntrackedParameter<int>("input"));
132  return common;
133  }
134 
136  bool hasSubprocesses,
138  ProcessContext const* processContext,
139  ProcessBlockHelperBase& processBlockHelper) {
141  auto ret = std::make_unique<Schedule>(
142  parameterSet, tns, *preg_, *act_table_, actReg_, processConfiguration(), config, processContext);
143  ret->finishSetup(parameterSet,
144  tns,
145  *preg_,
147  processBlockHelper,
150  actReg_,
152  hasSubprocesses,
153  config,
154  processContext);
155  return ret;
156  }
157 
159  service::TriggerNamesService const& tns,
161  ProcessContext const* processContext) {
162  return MadeModules(std::make_unique<Schedule>(
163  parameterSet, tns, *preg_, *act_table_, actReg_, processConfiguration(), config, processContext));
164  }
165 
166  std::unique_ptr<Schedule> ScheduleItems::finishSchedule(MadeModules madeModules,
168  service::TriggerNamesService const& tns,
169  bool hasSubprocesses,
171  ProcessContext const* processContext,
172  ProcessBlockHelperBase& processBlockHelper) {
173  auto sched = std::move(madeModules.m_schedule);
174  sched->finishSetup(parameterSet,
175  tns,
176  *preg_,
178  processBlockHelper,
181  actReg_,
183  hasSubprocesses,
184  config,
185  processContext);
186  return sched;
187  }
188 
189 } // namespace edm
std::shared_ptr< ActivityRegistry > actReg_
std::unique_ptr< Schedule > initSchedule(ParameterSet &parameterSet, bool hasSubprocesses, PreallocationConfiguration const &iAllocConfig, ProcessContext const *, ProcessBlockHelperBase &processBlockHelper)
std::string getPassID()
Definition: GetPassID.h:7
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SelectedProductsForBranchType const & keptProducts() const
Definition: SubProcess.h:80
std::unique_ptr< ExceptionToActionTable const > act_table_
ret
prodAgent to be discontinued
edm::propagate_const< std::shared_ptr< SignallingProductRegistry > > preg_
edm::propagate_const< std::shared_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
Definition: config.py:1
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
void updateFromParentProcess(ProcessBlockHelperBase const &parentProcessBlockHelper, ProductRegistry const &)
std::vector< std::pair< BranchDescription const *, EDGetToken > > SelectedProducts
T getUntrackedParameter(std::string const &, T const &) const
std::shared_ptr< ProcessConfiguration const > processConfiguration() const
Definition: ScheduleItems.h:97
edm::propagate_const< std::shared_ptr< BranchIDListHelper > > branchIDListHelper_
std::shared_ptr< CommonParams > initMisc(ParameterSet &parameterSet)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
static ServiceRegistry & instance()
static ServiceToken createContaining(std::unique_ptr< T > iService)
create a service token that holds the service defined by iService
static ServiceToken createSet(std::vector< ParameterSet > &)
std::string getReleaseVersion()
Definition: common.py:1
edm::propagate_const< std::shared_ptr< ProcessConfiguration > > processConfiguration_
ServiceToken initServices(std::vector< ParameterSet > &servicePSets, ParameterSet &processPSet, ServiceToken const &iToken, serviceregistry::ServiceLegacy iLegacy, bool associate)
std::unique_ptr< Schedule > m_schedule
Definition: ScheduleItems.h:64
edm::propagate_const< std::shared_ptr< SubProcessParentageHelper > > subProcessParentageHelper_
config
parse the configuration file
ServiceToken addCPRandTNS(ParameterSet const &parameterSet, ServiceToken const &token)
MadeModules initModules(ParameterSet &parameterSet, service::TriggerNamesService const &tns, PreallocationConfiguration const &iAllocConfig, ProcessContext const *)
HLT enums.
def move(src, dest)
Definition: eostools.py:511
std::unique_ptr< Schedule > finishSchedule(MadeModules, ParameterSet &parameterSet, service::TriggerNamesService const &tns, bool hasSubprocesses, PreallocationConfiguration const &iAllocConfig, ProcessContext const *, ProcessBlockHelperBase &processBlockHelper)