CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ScheduleItems.cc
Go to the documentation of this file.
2 
20 
21 #include <set>
22 
23 namespace edm {
25  actReg_(new ActivityRegistry),
26  preg_(new SignallingProductRegistry),
27  branchIDListHelper_(new BranchIDListHelper()),
28  act_table_(),
29  processConfiguration_() {
30  }
31 
32  ScheduleItems::ScheduleItems(ProductRegistry const& preg, BranchIDListHelper const& branchIDListHelper, SubProcess const& om) :
33  actReg_(new ActivityRegistry),
34  preg_(new SignallingProductRegistry(preg)),
35  branchIDListHelper_(new BranchIDListHelper(branchIDListHelper)),
36  act_table_(),
37  processConfiguration_() {
38 
39  for(auto& item : preg_->productListUpdator()) {
40  BranchDescription& prod = item.second;
41  prod.setOnDemand(false);
42  prod.setProduced(false);
43  }
44 
45  // Mark dropped branches as dropped in the product registry.
46  std::set<BranchID> keptBranches;
47  SelectedProducts const& keptVectorR = om.keptProducts()[InRun];
48  for(auto const& item : keptVectorR) {
49  keptBranches.insert(item->branchID());
50  }
51  SelectedProducts const& keptVectorL = om.keptProducts()[InLumi];
52  for(auto const& item : keptVectorL) {
53  keptBranches.insert(item->branchID());
54  }
55  SelectedProducts const& keptVectorE = om.keptProducts()[InEvent];
56  for(auto const& item : keptVectorE) {
57  keptBranches.insert(item->branchID());
58  }
59  for(auto& item : preg_->productListUpdator()) {
60  BranchDescription& prod = item.second;
61  if(keptBranches.find(prod.branchID()) == keptBranches.end()) {
62  prod.setDropped(true);
63  }
64  }
65  }
66 
68  ScheduleItems::initServices(std::vector<ParameterSet>& pServiceSets,
70  ServiceToken const& iToken,
72  bool associate) {
73 
74  //create the services
75  ServiceToken token(ServiceRegistry::createSet(pServiceSets, iToken, iLegacy, associate));
76 
77  //see if any of the Services have to have their PSets stored
78  for(auto const& item : pServiceSets) {
79  if(item.exists("@save_config")) {
80  parameterSet.addParameter(item.getParameter<std::string>("@service_type"), item);
81  }
82  }
83  // Copy slots that hold all the registered callback functions like
84  // PostBeginJob into an ActivityRegistry
85  token.copySlotsTo(*actReg_);
86  return token;
87  }
88 
91 
92  //add the ProductRegistry as a service ONLY for the construction phase
94  boost::shared_ptr<w_CPR>
95  reg(new w_CPR(std::auto_ptr<ConstProductRegistry>(new ConstProductRegistry(*preg_))));
97  token,
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  boost::shared_ptr<w_TNS> tnsptr
107  (new w_TNS(std::auto_ptr<TNS>(new TNS(parameterSet))));
108 
109  return ServiceRegistry::createContaining(tnsptr,
110  tempToken,
112  }
113 
114  boost::shared_ptr<CommonParams>
116  act_table_.reset(new ExceptionToActionTable(parameterSet));
117  std::string processName = parameterSet.getParameter<std::string>("@process_name");
119  boost::shared_ptr<CommonParams>
120  common(new CommonParams(parameterSet.getUntrackedParameterSet(
121  "maxEvents", ParameterSet()).getUntrackedParameter<int>("input", -1),
122  parameterSet.getUntrackedParameterSet(
123  "maxLuminosityBlocks", ParameterSet()).getUntrackedParameter<int>("input", -1)));
124  return common;
125  }
126 
127  std::auto_ptr<Schedule>
129  ParameterSet const* subProcessPSet,
131  ProcessContext const* processContext) {
132  std::auto_ptr<Schedule> schedule(
133  new Schedule(parameterSet,
134  ServiceRegistry::instance().get<service::TriggerNamesService>(),
135  *preg_,
137  *act_table_,
138  actReg_,
140  subProcessPSet,
141  config,
142  processContext));
143  return schedule;
144  }
145 
146  void
148  actReg_.reset();
149  preg_.reset();
150  branchIDListHelper_.reset();
151  processConfiguration_.reset();
152  }
153 }
154 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
boost::shared_ptr< CommonParams > initMisc(ParameterSet &parameterSet)
std::string getPassID()
Definition: GetPassID.h:8
std::unique_ptr< ExceptionToActionTable const > act_table_
Definition: ScheduleItems.h:60
void setOnDemand(bool isOnDemand)
SelectedProductsForBranchType const & keptProducts() const
Definition: SubProcess.h:55
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
boost::shared_ptr< ProcessConfiguration > processConfiguration_
Definition: ScheduleItems.h:61
static ServiceToken createContaining(std::auto_ptr< T > iService)
create a service token that holds the service defined by iService
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:142
void copySlotsTo(ActivityRegistry &)
copy our Service&#39;s slots to the argument&#39;s signals
Definition: ServiceToken.cc:75
static ServiceRegistry & instance()
std::unique_ptr< SignallingProductRegistry > preg_
Definition: ScheduleItems.h:58
BranchID const & branchID() const
void setDropped(bool isDropped)
static ServiceToken createSet(std::vector< ParameterSet > &)
std::string getReleaseVersion()
ServiceToken initServices(std::vector< ParameterSet > &servicePSets, ParameterSet &processPSet, ServiceToken const &iToken, serviceregistry::ServiceLegacy iLegacy, bool associate)
ServiceToken addCPRandTNS(ParameterSet const &parameterSet, ServiceToken const &token)
std::vector< BranchDescription const * > SelectedProducts
boost::shared_ptr< ActivityRegistry > actReg_
Definition: ScheduleItems.h:57
preg
Definition: Schedule.cc:362
std::auto_ptr< Schedule > initSchedule(ParameterSet &parameterSet, ParameterSet const *subProcessPSet, PreallocationConfiguration const &iAllocConfig, ProcessContext const *)
void setProduced(bool isProduced)
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
boost::shared_ptr< BranchIDListHelper > branchIDListHelper_
Definition: ScheduleItems.h:59