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 
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 
35  actReg_(new ActivityRegistry),
36  preg_(new SignallingProductRegistry(preg)),
37  branchIDListHelper_(new BranchIDListHelper),
38  thinnedAssociationsHelper_(new ThinnedAssociationsHelper),
39  act_table_(),
40  processConfiguration_() {
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  keptBranches.insert(item->branchID());
53  }
54  SelectedProducts const& keptVectorL = om.keptProducts()[InLumi];
55  for(auto const& item : keptVectorL) {
56  keptBranches.insert(item->branchID());
57  }
58  SelectedProducts const& keptVectorE = om.keptProducts()[InEvent];
59  for(auto const& item : keptVectorE) {
60  keptBranches.insert(item->branchID());
61  }
62  for(auto& item : preg_->productListUpdator()) {
63  BranchDescription& prod = item.second;
64  if(keptBranches.find(prod.branchID()) == keptBranches.end()) {
65  prod.setDropped(true);
66  }
67  }
68  }
69 
71  ScheduleItems::initServices(std::vector<ParameterSet>& pServiceSets,
73  ServiceToken const& iToken,
75  bool associate) {
76 
77  //create the services
78  ServiceToken token(ServiceRegistry::createSet(pServiceSets, iToken, iLegacy, associate));
79 
80  //see if any of the Services have to have their PSets stored
81  for(auto const& item : pServiceSets) {
82  if(item.exists("@save_config")) {
83  parameterSet.addParameter(item.getParameter<std::string>("@service_type"), item);
84  }
85  }
86  // Copy slots that hold all the registered callback functions like
87  // PostBeginJob into an ActivityRegistry
88  token.copySlotsTo(*actReg_);
89  return token;
90  }
91 
94 
95  //add the ProductRegistry as a service ONLY for the construction phase
97  auto reg = std::make_shared<w_CPR>(std::auto_ptr<ConstProductRegistry>(new ConstProductRegistry(*preg_)));
99  token,
101 
102  // the next thing is ugly: pull out the trigger path pset and
103  // create a service and extra token for it
104 
105  typedef service::TriggerNamesService TNS;
107 
108  auto tnsptr = std::make_shared<w_TNS>(std::auto_ptr<TNS>(new TNS(parameterSet)));
109 
110  return ServiceRegistry::createContaining(tnsptr,
111  tempToken,
113  }
114 
115  std::shared_ptr<CommonParams>
117  act_table_.reset(new ExceptionToActionTable(parameterSet));
118  std::string processName = parameterSet.getParameter<std::string>("@process_name");
120  auto common = std::make_shared<CommonParams>(
121  parameterSet.getUntrackedParameterSet(
122  "maxEvents", ParameterSet()).getUntrackedParameter<int>("input", -1),
123  parameterSet.getUntrackedParameterSet(
124  "maxLuminosityBlocks", ParameterSet()).getUntrackedParameter<int>("input", -1),
125  parameterSet.getUntrackedParameterSet(
126  "maxSecondsUntilRampdown", ParameterSet()).getUntrackedParameter<int>("input", -1));
127  return common;
128  }
129 
130  std::auto_ptr<Schedule>
132  ParameterSet const* subProcessPSet,
134  ProcessContext const* processContext) {
135  std::auto_ptr<Schedule> schedule(
136  new Schedule(parameterSet,
137  ServiceRegistry::instance().get<service::TriggerNamesService>(),
138  *preg_,
141  *act_table_,
142  actReg_,
144  subProcessPSet,
145  config,
146  processContext));
147  return schedule;
148  }
149 
150  void
152  actReg_.reset();
153  preg_.reset();
154  branchIDListHelper_.reset();
156  processConfiguration_.reset();
157  }
158 }
std::shared_ptr< ActivityRegistry > actReg_
Definition: ScheduleItems.h:56
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:60
void setOnDemand(bool isOnDemand)
SelectedProductsForBranchType const & keptProducts() const
Definition: SubProcess.h:64
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
std::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
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()
std::shared_ptr< SignallingProductRegistry > preg_
Definition: ScheduleItems.h:57
BranchID const & branchID() const
void setDropped(bool isDropped)
static ServiceToken createSet(std::vector< ParameterSet > &)
std::shared_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper_
Definition: ScheduleItems.h:59
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::shared_ptr< BranchIDListHelper > branchIDListHelper_
Definition: ScheduleItems.h:58
std::vector< BranchDescription const * > SelectedProducts
preg
Definition: Schedule.cc:370
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