CMS 3D CMS Logo

ScheduleItems.cc
Go to the documentation of this file.
2 
22 
23 #include <set>
24 
25 namespace edm {
27  actReg_(std::make_shared<ActivityRegistry>()),
28  preg_(std::make_shared<SignallingProductRegistry>()),
29  branchIDListHelper_(std::make_shared<BranchIDListHelper>()),
30  thinnedAssociationsHelper_(std::make_shared<ThinnedAssociationsHelper>()),
31  subProcessParentageHelper_(),
32  act_table_(),
33  processConfiguration_() {
34  }
35 
37  actReg_(std::make_shared<ActivityRegistry>()),
38  preg_(std::make_shared<SignallingProductRegistry>(preg)),
42  act_table_(),
44 
45  for(auto& item : preg_->productListUpdator()) {
46  BranchDescription& prod = item.second;
47  prod.setOnDemand(false);
48  prod.setProduced(false);
49  }
50 
51  // Mark dropped branches as dropped in the product registry.
52  std::set<BranchID> keptBranches;
53  SelectedProducts const& keptVectorR = om.keptProducts()[InRun];
54  for(auto const& item : keptVectorR) {
55  BranchDescription const& desc = *item.first;
56  keptBranches.insert(desc.branchID());
57  }
58  SelectedProducts const& keptVectorL = om.keptProducts()[InLumi];
59  for(auto const& item : keptVectorL) {
60  BranchDescription const& desc = *item.first;
61  keptBranches.insert(desc.branchID());
62  }
63  SelectedProducts const& keptVectorE = om.keptProducts()[InEvent];
64  for(auto const& item : keptVectorE) {
65  BranchDescription const& desc = *item.first;
66  keptBranches.insert(desc.branchID());
67  }
68  for(auto& item : preg_->productListUpdator()) {
69  BranchDescription& prod = item.second;
70  if(keptBranches.find(prod.branchID()) == keptBranches.end()) {
71  prod.setDropped(true);
72  }
73  }
74  }
75 
77  ScheduleItems::initServices(std::vector<ParameterSet>& pServiceSets,
79  ServiceToken const& iToken,
81  bool associate) {
82 
83  //create the services
84  ServiceToken token(ServiceRegistry::createSet(pServiceSets, iToken, iLegacy, associate));
85 
86  //see if any of the Services have to have their PSets stored
87  for(auto const& item : pServiceSets) {
88  if(item.exists("@save_config")) {
89  parameterSet.addParameter(item.getParameter<std::string>("@service_type"), item);
90  }
91  }
92  // Copy slots that hold all the registered callback functions like
93  // PostBeginJob into an ActivityRegistry
94  token.copySlotsTo(*actReg_);
95  return token;
96  }
97 
100 
101  //add the ProductRegistry as a service ONLY for the construction phase
103  auto reg = std::make_shared<w_CPR>(std::make_unique<ConstProductRegistry>(*preg_));
105  token,
107 
108  // the next thing is ugly: pull out the trigger path pset and
109  // create a service and extra token for it
110 
111  typedef service::TriggerNamesService TNS;
113 
114  auto tnsptr = std::make_shared<w_TNS>(std::make_unique<TNS>(parameterSet));
115 
116  return ServiceRegistry::createContaining(tnsptr,
117  tempToken,
119  }
120 
121  std::shared_ptr<CommonParams>
123  act_table_.reset(new ExceptionToActionTable(parameterSet));
124  std::string processName = parameterSet.getParameter<std::string>("@process_name");
125  processConfiguration_ = std::make_shared<ProcessConfiguration>(processName, getReleaseVersion(), getPassID()); // propagate_const<T> has no reset() function
126  auto common = std::make_shared<CommonParams>(
127  parameterSet.getUntrackedParameterSet(
128  "maxEvents").getUntrackedParameter<int>("input"),
129  parameterSet.getUntrackedParameterSet(
130  "maxLuminosityBlocks").getUntrackedParameter<int>("input"),
131  parameterSet.getUntrackedParameterSet(
132  "maxSecondsUntilRampdown").getUntrackedParameter<int>("input"));
133  return common;
134  }
135 
136  std::unique_ptr<Schedule>
138  bool hasSubprocesses,
140  ProcessContext const* processContext) {
141  return std::make_unique<Schedule>(
142  parameterSet,
144  *preg_,
148  *act_table_,
149  actReg_,
151  hasSubprocesses,
152  config,
153  processContext);
154  }
155 
156  void
158  // propagate_const<T> has no reset() function
159  actReg_ = nullptr;
160  preg_ = nullptr;
161  branchIDListHelper_ = nullptr;
162  thinnedAssociationsHelper_ = nullptr;
163  processConfiguration_ = nullptr;
164  }
165 }
std::shared_ptr< ActivityRegistry > actReg_
Definition: ScheduleItems.h:68
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string getPassID()
Definition: GetPassID.h:8
std::unique_ptr< ExceptionToActionTable const > act_table_
Definition: ScheduleItems.h:73
edm::propagate_const< std::shared_ptr< SignallingProductRegistry > > preg_
Definition: ScheduleItems.h:69
void setOnDemand(bool isOnDemand)
SelectedProductsForBranchType const & keptProducts() const
Definition: SubProcess.h:71
edm::propagate_const< std::shared_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: ScheduleItems.h:71
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
Definition: config.py:1
std::vector< std::pair< BranchDescription const *, EDGetToken > > SelectedProducts
config
Definition: looper.py:289
edm::propagate_const< std::shared_ptr< BranchIDListHelper > > branchIDListHelper_
Definition: ScheduleItems.h:70
std::shared_ptr< CommonParams > initMisc(ParameterSet &parameterSet)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:143
void copySlotsTo(ActivityRegistry &)
copy our Service&#39;s slots to the argument&#39;s signals
Definition: ServiceToken.cc:75
static ServiceRegistry & instance()
static ServiceToken createContaining(std::unique_ptr< T > iService)
create a service token that holds the service defined by iService
BranchID const & branchID() const
void setDropped(bool isDropped)
static ServiceToken createSet(std::vector< ParameterSet > &)
std::string getReleaseVersion()
Definition: common.py:1
edm::propagate_const< std::shared_ptr< ProcessConfiguration > > processConfiguration_
Definition: ScheduleItems.h:74
std::shared_ptr< ProcessConfiguration const > processConfiguration() const
Definition: ScheduleItems.h:65
ServiceToken initServices(std::vector< ParameterSet > &servicePSets, ParameterSet &processPSet, ServiceToken const &iToken, serviceregistry::ServiceLegacy iLegacy, bool associate)
edm::propagate_const< std::shared_ptr< SubProcessParentageHelper > > subProcessParentageHelper_
Definition: ScheduleItems.h:72
ServiceToken addCPRandTNS(ParameterSet const &parameterSet, ServiceToken const &token)
HLT enums.
std::shared_ptr< SignallingProductRegistry const > preg() const
Definition: ScheduleItems.h:58
void setProduced(bool isProduced)
std::unique_ptr< Schedule > initSchedule(ParameterSet &parameterSet, bool hasSubprocesses, PreallocationConfiguration const &iAllocConfig, ProcessContext const *)
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11