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 
36  : actReg_(std::make_shared<ActivityRegistry>()),
37  preg_(std::make_shared<SignallingProductRegistry>(preg)),
41  act_table_(),
43  for (auto& item : preg_->productListUpdator()) {
44  BranchDescription& prod = item.second;
45  prod.setOnDemand(false);
46  prod.setProduced(false);
47  }
48 
49  // Mark dropped branches as dropped in the product registry.
50  std::set<BranchID> keptBranches;
51  SelectedProducts const& keptVectorR = om.keptProducts()[InRun];
52  for (auto const& item : keptVectorR) {
53  BranchDescription const& desc = *item.first;
54  keptBranches.insert(desc.branchID());
55  }
56  SelectedProducts const& keptVectorL = om.keptProducts()[InLumi];
57  for (auto const& item : keptVectorL) {
58  BranchDescription const& desc = *item.first;
59  keptBranches.insert(desc.branchID());
60  }
61  SelectedProducts const& keptVectorE = om.keptProducts()[InEvent];
62  for (auto const& item : keptVectorE) {
63  BranchDescription const& desc = *item.first;
64  keptBranches.insert(desc.branchID());
65  }
66  for (auto& item : preg_->productListUpdator()) {
67  BranchDescription& prod = item.second;
68  if (keptBranches.find(prod.branchID()) == keptBranches.end()) {
69  prod.setDropped(true);
70  }
71  }
72  }
73 
74  ServiceToken ScheduleItems::initServices(std::vector<ParameterSet>& pServiceSets,
76  ServiceToken const& iToken,
78  bool associate) {
79  //create the services
80  ServiceToken token(ServiceRegistry::createSet(pServiceSets, iToken, iLegacy, associate));
81 
82  //see if any of the Services have to have their PSets stored
83  for (auto const& item : pServiceSets) {
84  if (item.exists("@save_config")) {
85  parameterSet.addParameter(item.getParameter<std::string>("@service_type"), item);
86  }
87  }
88  // Copy slots that hold all the registered callback functions like
89  // PostBeginJob into an ActivityRegistry
90  token.copySlotsTo(*actReg_);
91  return token;
92  }
93 
95  //add the ProductRegistry as a service ONLY for the construction phase
97  auto reg = std::make_shared<w_CPR>(std::make_unique<ConstProductRegistry>(*preg_));
99 
100  // the next thing is ugly: pull out the trigger path pset and
101  // create a service and extra token for it
102 
103  typedef service::TriggerNamesService TNS;
105 
106  auto tnsptr = std::make_shared<w_TNS>(std::make_unique<TNS>(parameterSet));
107 
109  }
110 
111  std::shared_ptr<CommonParams> ScheduleItems::initMisc(ParameterSet& parameterSet) {
112  act_table_.reset(new ExceptionToActionTable(parameterSet));
113  std::string processName = parameterSet.getParameter<std::string>("@process_name");
114  processConfiguration_ = std::make_shared<ProcessConfiguration>(
115  processName, getReleaseVersion(), getPassID()); // propagate_const<T> has no reset() function
116  auto common = std::make_shared<CommonParams>(
117  parameterSet.getUntrackedParameterSet("maxEvents").getUntrackedParameter<int>("input"),
118  parameterSet.getUntrackedParameterSet("maxLuminosityBlocks").getUntrackedParameter<int>("input"),
119  parameterSet.getUntrackedParameterSet("maxSecondsUntilRampdown").getUntrackedParameter<int>("input"));
120  return common;
121  }
122 
124  bool hasSubprocesses,
126  ProcessContext const* processContext) {
127  return std::make_unique<Schedule>(parameterSet,
129  *preg_,
133  *act_table_,
134  actReg_,
136  hasSubprocesses,
137  config,
138  processContext);
139  }
140 
142  // propagate_const<T> has no reset() function
143  actReg_ = nullptr;
144  preg_ = nullptr;
145  branchIDListHelper_ = nullptr;
146  thinnedAssociationsHelper_ = nullptr;
147  processConfiguration_ = nullptr;
148  }
149 } // namespace edm
std::shared_ptr< ActivityRegistry > actReg_
Definition: ScheduleItems.h:73
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string getPassID()
Definition: GetPassID.h:7
std::unique_ptr< ExceptionToActionTable const > act_table_
Definition: ScheduleItems.h:78
edm::propagate_const< std::shared_ptr< SignallingProductRegistry > > preg_
Definition: ScheduleItems.h:74
void setOnDemand(bool isOnDemand)
SelectedProductsForBranchType const & keptProducts() const
Definition: SubProcess.h:71
edm::propagate_const< std::shared_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: ScheduleItems.h:76
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:291
edm::propagate_const< std::shared_ptr< BranchIDListHelper > > branchIDListHelper_
Definition: ScheduleItems.h:75
std::shared_ptr< CommonParams > initMisc(ParameterSet &parameterSet)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:125
void copySlotsTo(ActivityRegistry &)
copy our Service&#39;s slots to the argument&#39;s signals
Definition: ServiceToken.cc:69
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:79
std::shared_ptr< ProcessConfiguration const > processConfiguration() const
Definition: ScheduleItems.h:68
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:77
ServiceToken addCPRandTNS(ParameterSet const &parameterSet, ServiceToken const &token)
HLT enums.
std::shared_ptr< SignallingProductRegistry const > preg() const
Definition: ScheduleItems.h:53
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