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, OutputModule const& om) :
33  actReg_(new ActivityRegistry),
34  preg_(new SignallingProductRegistry(preg)),
35  branchIDListHelper_(new BranchIDListHelper(branchIDListHelper)),
36  act_table_(),
37  processConfiguration_() {
38  for(ProductRegistry::ProductList::iterator it = preg_->productListUpdator().begin(), itEnd = preg_->productListUpdator().end(); it != itEnd; ++it) {
39  it->second.onDemand() = false;
40  it->second.produced() = false;
41  }
42 
43  // Mark dropped branches as dropped in the product registry.
44  std::set<BranchID> keptBranches;
45  Selections const& keptVectorR = om.keptProducts()[InRun];
46  for(Selections::const_iterator it = keptVectorR.begin(), itEnd = keptVectorR.end(); it != itEnd; ++it) {
47  keptBranches.insert((*it)->branchID());
48  }
49  Selections const& keptVectorL = om.keptProducts()[InLumi];
50  for(Selections::const_iterator it = keptVectorL.begin(), itEnd = keptVectorL.end(); it != itEnd; ++it) {
51  keptBranches.insert((*it)->branchID());
52  }
53  Selections const& keptVectorE = om.keptProducts()[InEvent];
54  for(Selections::const_iterator it = keptVectorE.begin(), itEnd = keptVectorE.end(); it != itEnd; ++it) {
55  keptBranches.insert((*it)->branchID());
56  }
57  for(ProductRegistry::ProductList::const_iterator it = preg_->productList().begin(), itEnd = preg_->productList().end(); it != itEnd; ++it) {
58  if(keptBranches.find(it->second.branchID()) == keptBranches.end()) {
59  it->second.setDropped();
60  }
61  }
62  }
63 
65  ScheduleItems::initServices(std::vector<ParameterSet>& pServiceSets,
66  ParameterSet& parameterSet,
67  ServiceToken const& iToken,
69  bool associate) {
70 
71  //create the services
72  ServiceToken token(ServiceRegistry::createSet(pServiceSets, iToken, iLegacy, associate));
73 
74  //see if any of the Services have to have their PSets stored
75  for(std::vector<ParameterSet>::const_iterator it = pServiceSets.begin(), itEnd = pServiceSets.end();
76  it != itEnd;
77  ++it) {
78  if(it->exists("@save_config")) {
79  parameterSet.addParameter(it->getParameter<std::string>("@service_type"), *it);
80  }
81  }
82  // Copy slots that hold all the registered callback functions like
83  // PostBeginJob into an ActivityRegistry
84  token.copySlotsTo(*actReg_);
85  return token;
86  }
87 
89  ScheduleItems::addCPRandTNS(ParameterSet const& parameterSet, ServiceToken const& token) {
90 
91  //add the ProductRegistry as a service ONLY for the construction phase
93  boost::shared_ptr<w_CPR>
94  reg(new w_CPR(std::auto_ptr<ConstProductRegistry>(new ConstProductRegistry(*preg_))));
96  token,
98 
99  // the next thing is ugly: pull out the trigger path pset and
100  // create a service and extra token for it
101 
102  typedef service::TriggerNamesService TNS;
104 
105  boost::shared_ptr<w_TNS> tnsptr
106  (new w_TNS(std::auto_ptr<TNS>(new TNS(parameterSet))));
107 
108  return ServiceRegistry::createContaining(tnsptr,
109  tempToken,
111  }
112 
113  boost::shared_ptr<CommonParams>
115  act_table_.reset(new ActionTable(parameterSet));
116  std::string processName = parameterSet.getParameter<std::string>("@process_name");
118  boost::shared_ptr<CommonParams>
119  common(new CommonParams(parameterSet.getUntrackedParameterSet(
120  "maxEvents", ParameterSet()).getUntrackedParameter<int>("input", -1),
121  parameterSet.getUntrackedParameterSet(
122  "maxLuminosityBlocks", ParameterSet()).getUntrackedParameter<int>("input", -1)));
123  return common;
124  }
125 
126  std::auto_ptr<Schedule>
128  ParameterSet const* subProcessPSet) {
129  std::auto_ptr<Schedule> schedule(
130  new Schedule(parameterSet,
131  ServiceRegistry::instance().get<service::TriggerNamesService>(),
132  *preg_,
134  *act_table_,
135  actReg_,
137  subProcessPSet));
138  return schedule;
139  }
140 
141  void
143  actReg_.reset();
144  preg_.reset();
145  branchIDListHelper_.reset();
146  processConfiguration_.reset();
147  }
148 }
149 
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
SelectionsArray const & keptProducts() const
Definition: OutputModule.h:61
std::unique_ptr< ActionTable const > act_table_
Definition: ScheduleItems.h:55
boost::shared_ptr< ProcessConfiguration > processConfiguration_
Definition: ScheduleItems.h:56
static ServiceToken createContaining(std::auto_ptr< T > iService)
create a service token that holds the service defined by iService
std::auto_ptr< Schedule > initSchedule(ParameterSet &parameterSet, ParameterSet const *subProcessPSet)
iterator end()
Definition: Selections.h:367
ParameterSet const & getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:145
void copySlotsTo(ActivityRegistry &)
copy our Service&#39;s slots to the argument&#39;s signals
Definition: ServiceToken.cc:76
static ServiceRegistry & instance()
std::unique_ptr< SignallingProductRegistry > preg_
Definition: ScheduleItems.h:53
iterator begin()
Definition: Selections.h:366
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)
boost::shared_ptr< ActivityRegistry > actReg_
Definition: ScheduleItems.h:52
boost::shared_ptr< BranchIDListHelper > branchIDListHelper_
Definition: ScheduleItems.h:54