CMS 3D CMS Logo

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