CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RunPrincipal.cc
Go to the documentation of this file.
2 
8 
9 namespace edm {
11  std::shared_ptr<RunAuxiliary> aux,
12  std::shared_ptr<ProductRegistry const> reg,
13  ProcessConfiguration const& pc,
14  HistoryAppender* historyAppender,
15  unsigned int iRunIndex) :
16  Base(reg, reg->productLookup(InRun), pc, InRun, historyAppender),
17  aux_(aux), index_(iRunIndex), complete_(false) {
18  }
19 
20  void
22  complete_ = false;
23 
24  m_reducedHistoryID = processHistoryRegistry.reducedProcessHistoryID(aux_->processHistoryID());
25  fillPrincipal(aux_->processHistoryID(), processHistoryRegistry, reader);
26 
27  for(auto const& prod : *this) {
28  prod->setProcessHistory(processHistory());
29  }
30  }
31 
32  void
34  BranchDescription const& bd,
35  std::unique_ptr<WrapperBase> edp) {
36 
37  // Assert commented out for LHESource.
38  // assert(bd.produced());
39  if(edp.get() == nullptr) {
40  throw edm::Exception(edm::errors::InsertFailure,"Null Pointer")
41  << "put: Cannot put because unique_ptr to product is null."
42  << "\n";
43  }
45  assert(phb);
46  // ProductHolder assumes ownership
47  putOrMerge(std::move(edp), phb);
48  }
49 
50  void
52  for(auto const& prod : *this) {
53  ProductHolderBase const& phb = *prod;
54  if(phb.singleProduct() && !phb.branchDescription().produced()) {
55  if(!phb.productUnavailable()) {
57  }
58  }
59  }
60  }
61 
62  void
64  if(phb.branchDescription().produced()) return; // nothing to do.
65  if(!reader()) return; // nothing to do.
66 
67  // must attempt to load from persistent store
68  BranchKey const bk = BranchKey(phb.branchDescription());
69  std::unique_ptr<WrapperBase> edp(reader()->getProduct(bk, this));
70 
71  // Now fix up the ProductHolder
72  if(edp.get() != nullptr) {
73  putOrMerge(std::move(edp), &phb);
74  }
75  }
76 
77  unsigned int
79  return index().value();
80  }
81 
82 }
void putOrMerge(std::unique_ptr< WrapperBase > prod, ProductHolderBase const *productHolder) const
Definition: Principal.cc:852
RunPrincipal(std::shared_ptr< RunAuxiliary > aux, std::shared_ptr< ProductRegistry const > reg, ProcessConfiguration const &pc, HistoryAppender *historyAppender, unsigned int iRunIndex)
Definition: RunPrincipal.cc:10
virtual unsigned int transitionIndex_() const override
Definition: RunPrincipal.cc:78
assert(m_qm.get())
T const * getProduct(RefCore const &ref)
Definition: RefCoreGet.h:41
unsigned int value() const
Definition: RunIndex.h:50
void put(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp)
Definition: RunPrincipal.cc:33
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
Definition: RunPrincipal.cc:21
ProcessHistory const & processHistory() const
Definition: Principal.h:142
void readImmediate() const
Definition: RunPrincipal.cc:51
ProcessHistoryID m_reducedHistoryID
Definition: RunPrincipal.h:114
std::shared_ptr< RunAuxiliary > aux_
Definition: RunPrincipal.h:113
bool singleProduct() const
Definition: ProductHolder.h:96
BranchDescription const & branchDescription() const
Definition: ProductHolder.h:93
def move
Definition: eostools.py:510
void resolveProductImmediate(ProductHolderBase const &phb) const
Definition: RunPrincipal.cc:63
BranchID const & branchID() const
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
DelayedReader * reader() const
Definition: Principal.h:176
RunIndex index() const
Definition: RunPrincipal.h:53
volatile std::atomic< bool > shutdown_flag false
void fillPrincipal(ProcessHistoryID const &hist, ProcessHistoryRegistry const &phr, DelayedReader *reader)
Definition: Principal.cc:342
ProductHolderBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:398
bool productUnavailable() const
Definition: ProductHolder.h:72