CMS 3D CMS Logo

SubProcess.cc
Go to the documentation of this file.
2 
34 
35 #include "boost/range/adaptor/reversed.hpp"
36 
37 #include <cassert>
38 #include <string>
39 #include <vector>
40 
41 namespace edm {
42 
44  ParameterSet const& topLevelParameterSet,
45  std::shared_ptr<ProductRegistry const> parentProductRegistry,
46  std::shared_ptr<BranchIDListHelper const> parentBranchIDListHelper,
47  ThinnedAssociationsHelper const& parentThinnedAssociationsHelper,
48  SubProcessParentageHelper const& parentSubProcessParentageHelper,
50  ActivityRegistry& parentActReg,
51  ServiceToken const& token,
53  PreallocationConfiguration const& preallocConfig,
54  ProcessContext const* parentProcessContext) :
56  serviceToken_(),
57  parentPreg_(parentProductRegistry),
58  preg_(),
59  branchIDListHelper_(),
60  act_table_(),
61  processConfiguration_(),
62  historyLumiOffset_(preallocConfig.numberOfStreams()),
63  historyRunOffset_(historyLumiOffset_+preallocConfig.numberOfLuminosityBlocks()),
64  processHistoryRegistries_(historyRunOffset_+ preallocConfig.numberOfRuns()),
65  historyAppenders_(historyRunOffset_+preallocConfig.numberOfRuns()),
66  principalCache_(),
67  esp_(),
68  schedule_(),
69  parentToChildPhID_(),
70  subProcesses_(),
71  processParameterSet_(),
72  productSelectorRules_(parameterSet, "outputCommands", "OutputModule"),
73  productSelector_(),
74  wantAllEvents_(true) {
75 
76  //Setup the event selection
78 
79  ParameterSet selectevents =
80  parameterSet.getUntrackedParameterSet("SelectEvents", ParameterSet());
81 
82  selectevents.registerIt(); // Just in case this PSet is not registered
84  tns->getProcessName(),
86  selectors_,
88  std::map<std::string, std::vector<std::pair<std::string, int> > > outputModulePathPositions;
90  "",
91  outputModulePathPositions,
92  parentProductRegistry->anyProductProduced());
93 
94  std::map<BranchID, bool> keepAssociation;
95  selectProducts(*parentProductRegistry, parentThinnedAssociationsHelper, keepAssociation);
96 
97  std::string const maxEvents("maxEvents");
98  std::string const maxLumis("maxLuminosityBlocks");
99 
100  // propagate_const<T> has no reset() function
101  processParameterSet_ = std::unique_ptr<ParameterSet>(parameterSet.popParameterSet(std::string("process")).release());
102 
103  // if this process has a maxEvents or maxLuminosityBlocks parameter set, remove them.
104  if(processParameterSet_->exists(maxEvents)) {
105  processParameterSet_->popParameterSet(maxEvents);
106  }
107  if(processParameterSet_->exists(maxLumis)) {
108  processParameterSet_->popParameterSet(maxLumis);
109  }
110 
111  // if the top level process has a maxEvents or maxLuminosityBlocks parameter set, add them to this process.
112  if(topLevelParameterSet.exists(maxEvents)) {
113  processParameterSet_->addUntrackedParameter<ParameterSet>(maxEvents, topLevelParameterSet.getUntrackedParameterSet(maxEvents));
114  }
115  if(topLevelParameterSet.exists(maxLumis)) {
116  processParameterSet_->addUntrackedParameter<ParameterSet>(maxLumis, topLevelParameterSet.getUntrackedParameterSet(maxLumis));
117  }
118 
119  // If there are subprocesses, pop the subprocess parameter sets out of the process parameter set
120  auto subProcessVParameterSet = popSubProcessVParameterSet(*processParameterSet_);
121  bool hasSubProcesses = subProcessVParameterSet.size() != 0ull;
122 
123  ScheduleItems items(*parentProductRegistry, *this);
124  actReg_ = items.actReg_;
125 
126  ParameterSet const& optionsPset(processParameterSet_->getUntrackedParameterSet("options", ParameterSet()));
127  IllegalParameters::setThrowAnException(optionsPset.getUntrackedParameter<bool>("throwIfIllegalParameter", true));
128 
129  //initialize the services
130  ServiceToken iToken;
131 
132  // get any configured services.
133  auto serviceSets = processParameterSet_->popVParameterSet(std::string("services"));
134 
135  ServiceToken newToken = items.initServices(serviceSets, *processParameterSet_, token, iLegacy, false);
136  parentActReg.connectToSubProcess(*items.actReg_);
137  serviceToken_ = items.addCPRandTNS(*processParameterSet_, newToken);
138 
139 
140  //make the services available
142 
143  // intialize miscellaneous items
145 
146  // intialize the event setup provider
147  esp_ = esController.makeProvider(*processParameterSet_);
148 
150  updateBranchIDListHelper(parentBranchIDListHelper->branchIDLists());
151 
153  thinnedAssociationsHelper_->updateFromParentProcess(parentThinnedAssociationsHelper, keepAssociation, droppedBranchIDToKeptBranchID_);
154 
155  // intialize the Schedule
156  schedule_ = items.initSchedule(*processParameterSet_,hasSubProcesses,preallocConfig,&processContext_);
157 
158  // set the items
160  preg_ = items.preg();
161 
163  subProcessParentageHelper_->update(parentSubProcessParentageHelper, *parentProductRegistry);
164 
165  //CMS-THREADING this only works since Run/Lumis are synchronous so when principalCache asks for
166  // the reducedProcessHistoryID from a full ProcessHistoryID that registry will not be in use by
167  // another thread. We really need to change how this is done in the PrincipalCache.
169 
170 
173  processContext_.setParentProcessContext(parentProcessContext);
174 
176  for(unsigned int index = 0; index < preallocConfig.numberOfStreams(); ++index) {
177  auto ep = std::make_shared<EventPrincipal>(preg_,
182  index,
183  false /*not primary process*/);
185  }
186 
187  subProcesses_.reserve(subProcessVParameterSet.size());
188  for(auto& subProcessPSet : subProcessVParameterSet) {
189  subProcesses_.emplace_back(subProcessPSet,
190  topLevelParameterSet,
191  preg_,
193  *thinnedAssociationsHelper_,
195  esController,
196  *items.actReg_,
197  newToken,
198  iLegacy,
199  preallocConfig,
200  &processContext_);
201  }
202  }
203 
205 
206  void
208  this->beginJob();
209  }
210 
211  void
213  endJob();
214  }
215 
216 
217  void
219  // If event selection is being used, the SubProcess class reads TriggerResults
220  // object(s) in the parent process from the event. This next call is needed for
221  // getByToken to work properly. Normally, this is done by the worker, but since
222  // a SubProcess is not a module, it has no worker.
223  updateLookup(InEvent, *parentPreg_->productLookup(InEvent),false);
224 
225  if(!droppedBranchIDToKeptBranchID().empty()) {
227  }
230  //NOTE: this may throw
232  actReg_->preBeginJobSignal_(pathsAndConsumesOfModules_, processContext_);
233  schedule_->beginJob(*preg_);
234  for_all(subProcesses_, [](auto& subProcess){ subProcess.doBeginJob(); });
235  }
236 
237  void
240  ExceptionCollector c("Multiple exceptions were thrown while executing endJob. An exception message follows for each.");
241  schedule_->endJob(c);
242  for(auto& subProcess : subProcesses_) {
243  c.call([&subProcess](){ subProcess.doEndJob();});
244  }
245  if(c.hasThrown()) {
246  c.rethrow();
247  }
248  }
249 
250  void
252  ThinnedAssociationsHelper const& parentThinnedAssociationsHelper,
253  std::map<BranchID, bool>& keepAssociation) {
254  if(productSelector_.initialized()) return;
256 
257  // TODO: See if we can collapse keptProducts_ and productSelector_ into a
258  // single object. See the notes in the header for ProductSelector
259  // for more information.
260 
261  std::map<BranchID, BranchDescription const*> trueBranchIDToKeptBranchDesc;
262  std::vector<BranchDescription const*> associationDescriptions;
263  std::set<BranchID> keptProductsInEvent;
264 
265  for(auto const& it : preg.productList()) {
266  BranchDescription const& desc = it.second;
267  if(desc.transient()) {
268  // if the class of the branch is marked transient, output nothing
269  } else if(!desc.present() && !desc.produced()) {
270  // else if the branch containing the product has been previously dropped,
271  // output nothing
272  } else if(desc.unwrappedType() == typeid(ThinnedAssociation)) {
273  associationDescriptions.push_back(&desc);
274  } else if(productSelector_.selected(desc)) {
275  keepThisBranch(desc, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
276  }
277  }
278 
279  parentThinnedAssociationsHelper.selectAssociationProducts(associationDescriptions,
280  keptProductsInEvent,
281  keepAssociation);
282 
283  for(auto association : associationDescriptions) {
284  if(keepAssociation[association->branchID()]) {
285  keepThisBranch(*association, trueBranchIDToKeptBranchDesc, keptProductsInEvent);
286  }
287  }
288 
289  // Now fill in a mapping needed in the case that a branch was dropped while its EDAlias was kept.
290  ProductSelector::fillDroppedToKept(preg, trueBranchIDToKeptBranchDesc, droppedBranchIDToKeptBranchID_);
291  }
292 
294  std::map<BranchID, BranchDescription const*>& trueBranchIDToKeptBranchDesc,
295  std::set<BranchID>& keptProductsInEvent) {
296 
298  trueBranchIDToKeptBranchDesc);
299 
300  if(desc.branchType() == InEvent) {
301  if(desc.produced()) {
302  keptProductsInEvent.insert(desc.originalBranchID());
303  } else {
304  keptProductsInEvent.insert(desc.branchID());
305  }
306  }
308  InputTag{desc.moduleLabel(),
309  desc.productInstanceName(),
310  desc.processName()});
311 
312  // Now put it in the list of selected branches.
313  keptProducts_[desc.branchType()].push_back(std::make_pair(&desc, token));
314  }
315 
316  void
317  SubProcess::fixBranchIDListsForEDAliases(std::map<BranchID::value_type, BranchID::value_type> const& droppedBranchIDToKeptBranchID) {
318  // Check for branches dropped while an EDAlias was kept.
319  // Replace BranchID of each dropped branch with that of the kept alias.
320  for(BranchIDList& branchIDList : branchIDListHelper_->mutableBranchIDLists()) {
321  for(BranchID::value_type& branchID : branchIDList) {
322  std::map<BranchID::value_type, BranchID::value_type>::const_iterator iter = droppedBranchIDToKeptBranchID.find(branchID);
323  if(iter != droppedBranchIDToKeptBranchID.end()) {
324  branchID = iter->second;
325  }
326  }
327  }
328  for_all(subProcesses_, [&droppedBranchIDToKeptBranchID](auto& subProcess){ subProcess.fixBranchIDListsForEDAliases(droppedBranchIDToKeptBranchID); });
329  }
330 
331  void
333  EventPrincipal const& ep) {
335  /* BEGIN relevant bits from OutputModule::doEvent */
336  if(!wantAllEvents_) {
337  EventForOutput e(ep, ModuleDescription(), nullptr);
338  e.setConsumer(this);
339  if(!selectors_.wantEvent(e)) {
340  return;
341  }
342  }
343  processAsync(std::move(iHolder),ep);
344  /* END relevant bits from OutputModule::doEvent */
345  }
346 
347  void
349  EventPrincipal const& principal) {
350  EventAuxiliary aux(principal.aux());
351  aux.setProcessHistoryID(principal.processHistoryID());
352 
353  EventSelectionIDVector esids{principal.eventSelectionIDs()};
354  if (principal.productRegistry().anyProductProduced() || !wantAllEvents_) {
355  esids.push_back(selector_config_id_);
356  }
357 
359  auto & processHistoryRegistry = processHistoryRegistries_[principal.streamID().value()];
360  processHistoryRegistry.registerProcessHistory(principal.processHistory());
361  BranchListIndexes bli(principal.branchListIndexes());
362  branchIDListHelper_->fixBranchListIndexes(bli);
363  bool deepCopyRetriever = false;
365  processHistoryRegistry,
366  std::move(esids),
367  std::move(bli),
368  *(principal.productProvenanceRetrieverPtr()),//NOTE: this transfers the per product provenance
369  principal.reader(),
370  deepCopyRetriever);
372  propagateProducts(InEvent, principal, ep);
373 
374  WaitingTaskHolder finalizeEventTask( make_waiting_task(tbb::task::allocate_root(),
375  [this,&ep,iHolder](std::exception_ptr const* iPtr) mutable
376  {
377  ep.clearEventPrincipal();
378  if(iPtr) {
379  iHolder.doneWaiting(*iPtr);
380  } else {
381  iHolder.doneWaiting(std::exception_ptr());
382  }
383  }
384  )
385  );
386  WaitingTaskHolder afterProcessTask;
387  if(subProcesses_.empty()) {
388  afterProcessTask = std::move(finalizeEventTask);
389  } else {
390  afterProcessTask = WaitingTaskHolder(
391  make_waiting_task(tbb::task::allocate_root(),
392  [this,&ep,finalizeEventTask] (std::exception_ptr const* iPtr) mutable{
393  if(not iPtr) {
394  for(auto& subProcess: boost::adaptors::reverse(subProcesses_)) {
395  subProcess.doEventAsync(finalizeEventTask,ep);
396  }
397  } else {
398  finalizeEventTask.doneWaiting(*iPtr);
399  }
400  })
401  );
402  }
403 
404  schedule_->processOneEventAsync(std::move(afterProcessTask),
405  ep.streamID().value(),ep, esp_->eventSetup());
406  }
407 
408  void
411  beginRun(principal,ts);
412  }
413 
414  void
416  auto aux = std::make_shared<RunAuxiliary>(principal.aux());
417  aux->setProcessHistoryID(principal.processHistoryID());
418  auto rpp = std::make_shared<RunPrincipal>(aux, preg_, *processConfiguration_, &(historyAppenders_[historyRunOffset_+principal.index()]),principal.index(),false);
419  auto & processHistoryRegistry = processHistoryRegistries_[historyRunOffset_+principal.index()];
420  processHistoryRegistry.registerProcessHistory(principal.processHistory());
421  rpp->fillRunPrincipal(processHistoryRegistry, principal.reader());
422  principalCache_.insert(rpp);
423 
424  ProcessHistoryID const& parentInputReducedPHID = principal.reducedProcessHistoryID();
425  ProcessHistoryID const& inputReducedPHID = rpp->reducedProcessHistoryID();
426 
427  parentToChildPhID_.insert(std::make_pair(parentInputReducedPHID,inputReducedPHID));
428 
430  propagateProducts(InRun, principal, rp);
432  schedule_->processOneGlobal<Traits>(rp, esp_->eventSetupForInstance(ts));
433  for_all(subProcesses_, [&rp, &ts](auto& subProcess){ subProcess.doBeginRun(rp, ts); });
434  }
435 
436  void
437  SubProcess::doEndRun(RunPrincipal const& principal, IOVSyncValue const& ts, bool cleaningUpAfterException) {
439  endRun(principal,ts,cleaningUpAfterException);
440  }
441 
442  void
443  SubProcess::endRun(RunPrincipal const& principal, IOVSyncValue const& ts, bool cleaningUpAfterException) {
445  rp.setComplete();
446  propagateProducts(InRun, principal, rp);
448  schedule_->processOneGlobal<Traits>(rp, esp_->eventSetupForInstance(ts), cleaningUpAfterException);
449  for_all(subProcesses_, [&rp, &ts, cleaningUpAfterException](auto& subProcess){ subProcess.doEndRun(rp, ts, cleaningUpAfterException); });
450  }
451 
452  void
455  std::map<ProcessHistoryID, ProcessHistoryID>::const_iterator it = parentToChildPhID_.find(parentPhID);
456  assert(it != parentToChildPhID_.end());
457  auto const& childPhID = it->second;
458  schedule_->writeRun(principalCache_.runPrincipal(childPhID, runNumber), &processContext_);
459  for_all(subProcesses_, [&childPhID, runNumber](auto& subProcess){ subProcess.writeRun(childPhID, runNumber); });
460  }
461 
462  void
464  std::map<ProcessHistoryID, ProcessHistoryID>::const_iterator it = parentToChildPhID_.find(parentPhID);
465  assert(it != parentToChildPhID_.end());
466  auto const& childPhID = it->second;
467  principalCache_.deleteRun(childPhID, runNumber);
468  for_all(subProcesses_, [&childPhID, runNumber](auto& subProcess){ subProcess.deleteRunFromCache(childPhID, runNumber); });
469  }
470 
471  void
474  beginLuminosityBlock(principal,ts);
475  }
476 
477  void
479  auto aux = std::make_shared<LuminosityBlockAuxiliary>(principal.aux());
480  aux->setProcessHistoryID(principal.processHistoryID());
481  auto lbpp = std::make_shared<LuminosityBlockPrincipal>(aux, preg_, *processConfiguration_, &(historyAppenders_[historyLumiOffset_+principal.index()]),principal.index(),false);
482  auto & processHistoryRegistry = processHistoryRegistries_[historyLumiOffset_+principal.index()];
483  processHistoryRegistry.registerProcessHistory(principal.processHistory());
484  lbpp->fillLuminosityBlockPrincipal(processHistoryRegistry, principal.reader());
485  lbpp->setRunPrincipal(principalCache_.runPrincipalPtr());
486  principalCache_.insert(lbpp);
488  propagateProducts(InLumi, principal, lbp);
490  schedule_->processOneGlobal<Traits>(lbp, esp_->eventSetupForInstance(ts));
491  for_all(subProcesses_, [&lbp, &ts](auto& subProcess){ subProcess.doBeginLuminosityBlock(lbp, ts); });
492  }
493 
494  void
495  SubProcess::doEndLuminosityBlock(LuminosityBlockPrincipal const& principal, IOVSyncValue const& ts, bool cleaningUpAfterException) {
497  endLuminosityBlock(principal,ts,cleaningUpAfterException);
498  }
499 
500  void
501  SubProcess::endLuminosityBlock(LuminosityBlockPrincipal const& principal, IOVSyncValue const& ts, bool cleaningUpAfterException) {
503  lbp.setComplete();
504  propagateProducts(InLumi, principal, lbp);
506  schedule_->processOneGlobal<Traits>(lbp, esp_->eventSetupForInstance(ts), cleaningUpAfterException);
507  for_all(subProcesses_, [&lbp, &ts, cleaningUpAfterException](auto& subProcess){ subProcess.doEndLuminosityBlock(lbp, ts, cleaningUpAfterException); });
508  }
509 
510  void
511  SubProcess::writeLumi(ProcessHistoryID const& parentPhID, int runNumber, int lumiNumber) {
513  std::map<ProcessHistoryID, ProcessHistoryID>::const_iterator it = parentToChildPhID_.find(parentPhID);
514  assert(it != parentToChildPhID_.end());
515  auto const& childPhID = it->second;
516  schedule_->writeLumi(principalCache_.lumiPrincipal(childPhID, runNumber, lumiNumber), &processContext_);
517  for_all(subProcesses_, [&childPhID, runNumber, lumiNumber](auto& subProcess){ subProcess.writeLumi(childPhID, runNumber, lumiNumber); });
518  }
519 
520  void
521  SubProcess::deleteLumiFromCache(ProcessHistoryID const& parentPhID, int runNumber, int lumiNumber) {
522  std::map<ProcessHistoryID, ProcessHistoryID>::const_iterator it = parentToChildPhID_.find(parentPhID);
523  assert(it != parentToChildPhID_.end());
524  auto const& childPhID = it->second;
525  principalCache_.deleteLumi(childPhID, runNumber, lumiNumber);
526  for_all(subProcesses_, [&childPhID, runNumber, lumiNumber](auto& subProcess){ subProcess.deleteLumiFromCache(childPhID, runNumber, lumiNumber); });
527  }
528 
529  void
530  SubProcess::doBeginStream(unsigned int iID) {
532  schedule_->beginStream(iID);
533  for_all(subProcesses_, [iID](auto& subProcess){ subProcess.doBeginStream(iID); });
534  }
535 
536  void
537  SubProcess::doEndStream(unsigned int iID) {
539  schedule_->endStream(iID);
540  for_all(subProcesses_, [iID](auto& subProcess){ subProcess.doEndStream(iID); });
541  }
542 
543  void
544  SubProcess::doStreamBeginRun(unsigned int id, RunPrincipal const& principal, IOVSyncValue const& ts) {
546  {
549  schedule_->processOneStream<Traits>(id,rp, esp_->eventSetupForInstance(ts));
550  for_all(subProcesses_, [id, &rp, &ts](auto& subProcess){ subProcess.doStreamBeginRun(id,rp, ts); });
551  }
552  }
553  void
555  unsigned int id, RunPrincipal const& principal, IOVSyncValue const& ts) {
557 
559 
561 
562  beginStreamTransitionAsync<Traits>(std::move(iHolder),
563  *schedule_,
564  id,
565  rp,
566  ts,
567  esp_->eventSetupForInstance(ts),
568  subProcesses_);
569 
570  }
571 
572 
573  void
574  SubProcess::doStreamEndRun(unsigned int id, RunPrincipal const& principal, IOVSyncValue const& ts, bool cleaningUpAfterException) {
576  {
579  schedule_->processOneStream<Traits>(id,rp, esp_->eventSetupForInstance(ts),cleaningUpAfterException);
580  for_all(subProcesses_, [id, &rp, &ts, cleaningUpAfterException](auto& subProcess){ subProcess.doStreamEndRun(id,rp, ts,cleaningUpAfterException); });
581  }
582  }
583 
584  void
586  unsigned int id, RunPrincipal const& principal, IOVSyncValue const& ts, bool cleaningUpAfterException) {
590 
591  endStreamTransitionAsync<Traits>(std::move(iHolder),
592  *schedule_,
593  id,
594  rp,
595  ts,
596  esp_->eventSetupForInstance(ts),
598  cleaningUpAfterException);
599  }
600 
601  void
604  {
607  schedule_->processOneStream<Traits>(id,lbp, esp_->eventSetupForInstance(ts));
608  for_all(subProcesses_, [id, &lbp, &ts](auto& subProcess){ subProcess.doStreamBeginLuminosityBlock(id,lbp, ts); });
609  }
610  }
611  void
613  unsigned int id, LuminosityBlockPrincipal const& principal, IOVSyncValue const& ts) {
615 
617 
619 
620  beginStreamTransitionAsync<Traits>(std::move(iHolder),
621  *schedule_,
622  id,
623  lbp,
624  ts,
625  esp_->eventSetupForInstance(ts),
626  subProcesses_);
627  }
628 
629 
630 
631  void
632  SubProcess::doStreamEndLuminosityBlock(unsigned int id, LuminosityBlockPrincipal const& principal, IOVSyncValue const& ts, bool cleaningUpAfterException) {
634  {
637  schedule_->processOneStream<Traits>(id,lbp, esp_->eventSetupForInstance(ts),cleaningUpAfterException);
638  for_all(subProcesses_, [id, &lbp, &ts, cleaningUpAfterException](auto& subProcess){ subProcess.doStreamEndLuminosityBlock(id,lbp, ts,cleaningUpAfterException); });
639  }
640  }
641 
642  void
644  unsigned int id, LuminosityBlockPrincipal const& principal, IOVSyncValue const& ts, bool cleaningUpAfterException) {
646 
649  endStreamTransitionAsync<Traits>(std::move(iHolder),
650  *schedule_,
651  id,
652  lbp,
653  ts,
654  esp_->eventSetupForInstance(ts),
656  cleaningUpAfterException);
657  }
658 
659 
660  void
662  SelectedProducts const& keptVector = keptProducts()[type];
663  for(auto const& item : keptVector) {
664  BranchDescription const& desc = *item.first;
665  ProductResolverBase const* parentProductResolver = parentPrincipal.getProductResolver(desc.branchID());
666  if(parentProductResolver != nullptr) {
667  ProductResolverBase* productResolver = principal.getModifiableProductResolver(desc.branchID());
668  if(productResolver != nullptr) {
669  //Propagate the per event(run)(lumi) data for this product to the subprocess.
670  //First, the product itself.
671  productResolver->connectTo(*parentProductResolver, &parentPrincipal);
672  }
673  }
674  }
675  }
676 
678  branchIDListHelper_->updateFromParent(branchIDLists);
679  for_all(subProcesses_, [this](auto& subProcess){ subProcess.updateBranchIDListHelper(branchIDListHelper_->branchIDLists()); });
680  }
681 
682  // Call respondToOpenInputFile() on all Modules
683  void
686  schedule_->respondToOpenInputFile(fb);
687  for_all(subProcesses_, [&fb](auto& subProcess){ subProcess.respondToOpenInputFile(fb); });
688  }
689 
690  // free function
691  std::vector<ParameterSet>
693  std::vector<std::string> subProcesses = parameterSet.getUntrackedParameter<std::vector<std::string>>("@all_subprocesses");
694  if(!subProcesses.empty()) {
695  return parameterSet.popVParameterSet("subProcesses");
696  }
697  return {};
698  }
699 }
unsigned int historyRunOffset_
Definition: SubProcess.h:292
unsigned int historyLumiOffset_
Definition: SubProcess.h:291
ParameterSetID selector_config_id_
Definition: SubProcess.h:312
std::shared_ptr< ActivityRegistry > actReg_
Definition: ScheduleItems.h:68
void insert(std::shared_ptr< RunPrincipal > rp)
type
Definition: HCALResponse.h:21
ProductRegistry const & productRegistry() const
Definition: Principal.h:145
ProductResolverBase * getModifiableProductResolver(BranchID const &oid)
Definition: Principal.h:152
void doEventAsync(WaitingTaskHolder iHolder, EventPrincipal const &principal)
Definition: SubProcess.cc:332
T getUntrackedParameter(std::string const &, T const &) const
bool selected(BranchDescription const &desc) const
std::shared_ptr< EventSetupProvider > makeProvider(ParameterSet &)
void setLuminosityBlockPrincipal(std::shared_ptr< LuminosityBlockPrincipal > const &lbp)
EventSelectionIDVector const & eventSelectionIDs() const
void respondToOpenInputFile(FileBlock const &fb)
Definition: SubProcess.cc:684
void doStreamEndLuminosityBlock(unsigned int iID, LuminosityBlockPrincipal const &principal, IOVSyncValue const &ts, bool cleaningUpAfterException)
Definition: SubProcess.cc:632
BranchType const & branchType() const
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
ProcessHistoryID const & reducedProcessHistoryID() const
Definition: RunPrincipal.h:65
void doBeginRun(RunPrincipal const &principal, IOVSyncValue const &ts)
Definition: SubProcess.cc:409
void deleteLumi(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)
void writeLumi(ProcessHistoryID const &parentPhID, int runNumber, int lumiNumber)
Definition: SubProcess.cc:511
void doStreamBeginRunAsync(WaitingTaskHolder iHolder, unsigned int iID, RunPrincipal const &principal, IOVSyncValue const &ts)
Definition: SubProcess.cc:554
std::unique_ptr< ParameterSet > popParameterSet(std::string const &name)
static void fillDroppedToKept(ProductRegistry const &preg, std::map< BranchID, BranchDescription const * > const &trueBranchIDToKeptBranchDesc, std::map< BranchID::value_type, BranchID::value_type > &droppedBranchIDToKeptBranchID_)
void setNumberOfConcurrentPrincipals(PreallocationConfiguration const &)
std::unique_ptr< ExceptionToActionTable const > act_table_
Definition: ScheduleItems.h:73
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
Definition: SubProcess.h:273
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper() const
Definition: ScheduleItems.h:62
std::vector< ProcessHistoryRegistry > processHistoryRegistries_
Definition: SubProcess.h:293
edm::propagate_const< std::shared_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: SubProcess.h:283
std::vector< SubProcess > subProcesses_
Definition: SubProcess.h:299
Definition: Hash.h:43
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
void beginRun(RunPrincipal const &r, IOVSyncValue const &ts)
Definition: SubProcess.cc:415
void doStreamEndRunAsync(WaitingTaskHolder iHolder, unsigned int iID, RunPrincipal const &principal, IOVSyncValue const &ts, bool cleaningUpAfterException)
Definition: SubProcess.cc:585
PathsAndConsumesOfModules pathsAndConsumesOfModules_
Definition: SubProcess.h:288
virtual ~SubProcess()
Definition: SubProcess.cc:204
LuminosityBlockPrincipal & lumiPrincipal(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
void updateBranchIDListHelper(BranchIDLists const &)
Definition: SubProcess.cc:677
LuminosityBlockAuxiliary const & aux() const
SelectedProductsForBranchType const & keptProducts() const
Definition: SubProcess.h:70
std::string const & processName() const
LuminosityBlockIndex index() const
void doEndStream(unsigned int)
Definition: SubProcess.cc:537
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
void doStreamEndLuminosityBlockAsync(WaitingTaskHolder iHolder, unsigned int iID, LuminosityBlockPrincipal const &principal, IOVSyncValue const &ts, bool cleaningUpAfterException)
Definition: SubProcess.cc:643
void setParentProcessContext(ProcessContext const *parentProcessContext)
void doBeginLuminosityBlock(LuminosityBlockPrincipal const &principal, IOVSyncValue const &ts)
Definition: SubProcess.cc:472
std::map< BranchID::value_type, BranchID::value_type > const & droppedBranchIDToKeptBranchID()
Definition: SubProcess.h:269
BranchListIndexes const & branchListIndexes() const
edm::propagate_const< std::unique_ptr< Schedule > > schedule_
Definition: SubProcess.h:297
ProcessHistory const & processHistory() const
Definition: Principal.h:135
BranchType
Definition: BranchType.h:11
std::vector< EventSelectionID > EventSelectionIDVector
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< std::pair< BranchDescription const *, EDGetToken > > SelectedProducts
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:16
#define ull
Definition: vppc_sim_lib.h:15
ProductList const & productList() const
void selectAssociationProducts(std::vector< BranchDescription const * > const &associationDescriptions, std::set< BranchID > const &keptProductsInEvent, std::map< BranchID, bool > &keepAssociation) const
void initialize(Schedule const *, std::shared_ptr< ProductRegistry const >)
virtual void connectTo(ProductResolverBase const &, Principal const *)=0
ServiceToken serviceToken_
Definition: SubProcess.h:279
void deleteRunFromCache(ProcessHistoryID const &parentPhID, int runNumber)
Definition: SubProcess.cc:463
def principal(options)
std::vector< BranchListIndex > BranchListIndexes
void doneWaiting(std::exception_ptr iExcept)
void processAsync(WaitingTaskHolder iHolder, EventPrincipal const &e)
Definition: SubProcess.cc:348
std::string const & moduleLabel() const
unsigned int value_type
Definition: BranchID.h:16
std::string const & productInstanceName() const
ProcessHistoryID const & processHistoryID() const
Definition: Principal.h:139
std::shared_ptr< CommonParams > initMisc(ParameterSet &parameterSet)
std::shared_ptr< SubProcessParentageHelper > & subProcessParentageHelper()
Definition: ScheduleItems.h:64
SelectedProductsForBranchType keptProducts_
Definition: SubProcess.h:306
void selectProducts(ProductRegistry const &preg, ThinnedAssociationsHelper const &parentThinnedAssociationsHelper, std::map< BranchID, bool > &keepAssociation)
Definition: SubProcess.cc:251
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
static void setThrowAnException(bool v)
ProductSelectorRules productSelectorRules_
Definition: SubProcess.h:307
StreamID streamID() const
TypeID unwrappedTypeID() const
edm::propagate_const< std::shared_ptr< eventsetup::EventSetupProvider > > esp_
Definition: SubProcess.h:296
std::vector< BranchDescription const * > allBranchDescriptions() const
edm::propagate_const< std::unique_ptr< ParameterSet > > processParameterSet_
Definition: SubProcess.h:300
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector, ConsumesCollector &&iC)
BranchID const & branchID() const
TypeWithDict const & unwrappedType() const
RunAuxiliary const & aux() const
Definition: RunPrincipal.h:57
void keepThisBranch(BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc, std::set< BranchID > &keptProductsInEvent)
Definition: SubProcess.cc:293
ProductProvenanceRetriever const * productProvenanceRetrieverPtr() const
void beginLuminosityBlock(LuminosityBlockPrincipal const &lb, IOVSyncValue const &ts)
Definition: SubProcess.cc:478
void setProcessConfiguration(ProcessConfiguration const *processConfiguration)
EventPrincipal & eventPrincipal(unsigned int iStreamIndex) const
void doStreamBeginLuminosityBlockAsync(WaitingTaskHolder iHolder, unsigned int iID, LuminosityBlockPrincipal const &principal, IOVSyncValue const &ts)
Definition: SubProcess.cc:612
std::unique_ptr< ExceptionToActionTable const > act_table_
Definition: SubProcess.h:285
std::vector< ParameterSet > popSubProcessVParameterSet(ParameterSet &parameterSet)
Definition: SubProcess.cc:692
void setProcessHistoryRegistry(ProcessHistoryRegistry const &phr)
DelayedReader * reader() const
Definition: Principal.h:178
void doEndRun(RunPrincipal const &principal, IOVSyncValue const &ts, bool cleaningUpAfterException)
Definition: SubProcess.cc:437
std::shared_ptr< ProcessConfiguration const > processConfiguration() const
Definition: ScheduleItems.h:65
std::map< BranchID::value_type, BranchID::value_type > droppedBranchIDToKeptBranchID_
Definition: SubProcess.h:317
ProductSelector productSelector_
Definition: SubProcess.h:308
unsigned int value() const
Definition: StreamID.h:46
void checkForModuleDependencyCorrectness(edm::PathsAndConsumesOfModulesBase const &iPnC, bool iPrintDependencies)
detail::TriggerResultsBasedEventSelector selectors_
Definition: SubProcess.h:313
void doStreamBeginLuminosityBlock(unsigned int iID, LuminosityBlockPrincipal const &principal, IOVSyncValue const &ts)
Definition: SubProcess.cc:602
ServiceToken initServices(std::vector< ParameterSet > &servicePSets, ParameterSet &processPSet, ServiceToken const &iToken, serviceregistry::ServiceLegacy iLegacy, bool associate)
void doStreamEndRun(unsigned int iID, RunPrincipal const &principal, IOVSyncValue const &ts, bool cleaningUpAfterException)
Definition: SubProcess.cc:574
void connectToSubProcess(ActivityRegistry &iOther)
std::map< ProcessHistoryID, ProcessHistoryID > parentToChildPhID_
Definition: SubProcess.h:298
FunctorWaitingTask< F > * make_waiting_task(ALLOC &&iAlloc, F f)
Definition: WaitingTask.h:90
void deleteRun(ProcessHistoryID const &phid, RunNumber_t run)
std::shared_ptr< ActivityRegistry > actReg_
Definition: SubProcess.h:278
SubProcess(ParameterSet &parameterSet, ParameterSet const &topLevelParameterSet, std::shared_ptr< ProductRegistry const > parentProductRegistry, std::shared_ptr< BranchIDListHelper const > parentBranchIDListHelper, ThinnedAssociationsHelper const &parentThinnedAssociationsHelper, SubProcessParentageHelper const &parentSubProcessParentageHelper, eventsetup::EventSetupsController &esController, ActivityRegistry &parentActReg, ServiceToken const &token, serviceregistry::ServiceLegacy iLegacy, PreallocationConfiguration const &preallocConfig, ProcessContext const *parentProcessContext)
Definition: SubProcess.cc:43
void deleteLumiFromCache(ProcessHistoryID const &parentPhID, int runNumber, int lumiNumber)
Definition: SubProcess.cc:521
ServiceToken addCPRandTNS(ParameterSet const &parameterSet, ServiceToken const &token)
edm::propagate_const< std::shared_ptr< BranchIDListHelper > > branchIDListHelper_
Definition: SubProcess.h:282
std::shared_ptr< RunPrincipal > const & runPrincipalPtr(ProcessHistoryID const &phid, RunNumber_t run) const
void endRun(RunPrincipal const &r, IOVSyncValue const &ts, bool cleaningUpAfterException)
Definition: SubProcess.cc:443
RunIndex index() const
Definition: RunPrincipal.h:53
bool anyProductProduced() const
std::vector< HistoryAppender > historyAppenders_
Definition: SubProcess.h:294
std::vector< BranchID::value_type > BranchIDList
Definition: BranchIDList.h:18
std::vector< ParameterSet > popVParameterSet(std::string const &name)
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
void endLuminosityBlock(LuminosityBlockPrincipal const &lb, IOVSyncValue const &ts, bool cleaningUpAfterException)
Definition: SubProcess.cc:501
HLT enums.
bool initialized() const
std::vector< std::string > const & getAllTriggerNames()
void initialize(ProductSelectorRules const &rules, std::vector< BranchDescription const * > const &branchDescriptions)
void propagateProducts(BranchType type, Principal const &parentPrincipal, Principal &principal) const
Definition: SubProcess.cc:661
void doBeginStream(unsigned int)
Definition: SubProcess.cc:530
void setConsumer(EDConsumerBase const *iConsumer)
std::shared_ptr< ProductRegistry const > parentPreg_
Definition: SubProcess.h:280
std::shared_ptr< SignallingProductRegistry const > preg() const
Definition: ScheduleItems.h:58
std::shared_ptr< LuminosityBlockPrincipal > const & lumiPrincipalPtr(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
ConstProductResolverPtr getProductResolver(BranchID const &oid) const
Definition: Principal.cc:433
void fixBranchIDListsForEDAliases(std::map< BranchID::value_type, BranchID::value_type > const &droppedBranchIDToKeptBranchID)
Definition: SubProcess.cc:317
ProcessContext processContext_
Definition: SubProcess.h:287
void writeRun(ProcessHistoryID const &parentPhID, int runNumber)
Definition: SubProcess.cc:453
BranchID const & originalBranchID() const
void call(std::function< void(void)>)
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
Definition: ScheduleItems.h:60
ParameterSetID registerProperSelectionInfo(edm::ParameterSet const &iInitial, std::string const &iLabel, std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper() const
Definition: SubProcess.h:275
EventAuxiliary const & aux() const
std::unique_ptr< Schedule > initSchedule(ParameterSet &parameterSet, bool hasSubprocesses, PreallocationConfiguration const &iAllocConfig, ProcessContext const *)
ParameterSet const & registerIt()
std::shared_ptr< ProductRegistry const > preg_
Definition: SubProcess.h:281
PrincipalCache principalCache_
Definition: SubProcess.h:295
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
def move(src, dest)
Definition: eostools.py:510
void doStreamBeginRun(unsigned int iID, RunPrincipal const &principal, IOVSyncValue const &ts)
Definition: SubProcess.cc:544
edm::propagate_const< std::shared_ptr< SubProcessParentageHelper > > subProcessParentageHelper_
Definition: SubProcess.h:284
void doEndLuminosityBlock(LuminosityBlockPrincipal const &principal, IOVSyncValue const &ts, bool cleaningUpAfterException)
Definition: SubProcess.cc:495
static void checkForDuplicateKeptBranch(BranchDescription const &desc, std::map< BranchID, BranchDescription const * > &trueBranchIDToKeptBranchDesc)
std::shared_ptr< ProcessConfiguration const > processConfiguration_
Definition: SubProcess.h:286
RunPrincipal & runPrincipal(ProcessHistoryID const &phid, RunNumber_t run) const
def operate(timelog, memlog, json_f, num)