CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RunPrincipal.cc
Go to the documentation of this file.
2 
9 
10 namespace edm {
11  RunPrincipal::RunPrincipal(std::shared_ptr<RunAuxiliary> aux,
12  std::shared_ptr<ProductRegistry const> reg,
13  ProcessConfiguration const& pc,
14  HistoryAppender* historyAppender,
15  unsigned int iRunIndex,
16  bool isForPrimaryProcess,
17  MergeableRunProductProcesses const* mergeableRunProductProcesses)
18  : Base(reg, reg->productLookup(InRun), pc, InRun, historyAppender, isForPrimaryProcess),
19  aux_(aux),
20  index_(iRunIndex) {
21  if (mergeableRunProductProcesses) { // primary RunPrincipals of EventProcessor
22  mergeableRunProductMetadataPtr_ = (std::make_unique<MergeableRunProductMetadata>(*mergeableRunProductProcesses));
23  }
24  }
25 
27 
29  m_reducedHistoryID = processHistoryRegistry.reducedProcessHistoryID(aux_->processHistoryID());
30  auto history = processHistoryRegistry.getMapped(aux_->processHistoryID());
31  fillPrincipal(aux_->processHistoryID(), history, reader);
32 
33  for (auto& prod : *this) {
34  prod->setMergeableRunProductMetadata(mergeableRunProductMetadataPtr_.get());
35  }
36  }
37 
38  void RunPrincipal::put(BranchDescription const& bd, std::unique_ptr<WrapperBase> edp) const {
39  put_(bd, std::move(edp));
40  }
41 
42  void RunPrincipal::put(ProductResolverIndex index, std::unique_ptr<WrapperBase> edp) const {
43  auto phb = getProductResolverByIndex(index);
44  dynamic_cast<ProductPutterBase const*>(phb)->putProduct(std::move(edp));
45  }
46 
47  void RunPrincipal::putOrMerge(BranchDescription const& bd, std::unique_ptr<WrapperBase> prod) const {
48  if (prod.get() == nullptr) {
49  throw edm::Exception(edm::errors::InsertFailure, "Null Pointer")
50  << "putOrMerge: Cannot put because unique_ptr to product is null."
51  << "\n";
52  }
53  auto phb = getExistingProduct(bd.branchID());
54  assert(phb);
55  dynamic_cast<ProductPutOrMergerBase const*>(phb)->putOrMergeProduct(std::move(prod));
56  }
57 
58  unsigned int RunPrincipal::transitionIndex_() const { return index().value(); }
59 
62  mergeableRunProductMetadataPtr_->preReadFile();
63  }
64  }
65 
66 } // namespace edm
void fillPrincipal(DelayedReader *reader)
Definition: Principal.cc:402
edm::propagate_const< std::shared_ptr< RunAuxiliary > > aux_
Definition: RunPrincipal.h:88
unsigned int ProductResolverIndex
bool getMapped(ProcessHistoryID const &key, ProcessHistory &value) const
unsigned int transitionIndex_() const override
Definition: RunPrincipal.cc:58
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:501
void put(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: RunPrincipal.cc:38
unsigned int value() const
Definition: RunIndex.h:45
assert(be >=bs)
ProcessHistoryID m_reducedHistoryID
Definition: RunPrincipal.h:89
RunPrincipal(std::shared_ptr< RunAuxiliary > aux, std::shared_ptr< ProductRegistry const > reg, ProcessConfiguration const &pc, HistoryAppender *historyAppender, unsigned int iRunIndex, bool isForPrimaryProcess=true, MergeableRunProductProcesses const *mergeableRunProductProcesses=nullptr)
Definition: RunPrincipal.cc:11
def move
Definition: eostools.py:511
tuple reader
Definition: DQM.py:105
BranchID const & branchID() const
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
DelayedReader * reader() const
Definition: Principal.h:187
edm::propagate_const< std::unique_ptr< MergeableRunProductMetadata > > mergeableRunProductMetadataPtr_
Definition: RunPrincipal.h:95
~RunPrincipal() override
Definition: RunPrincipal.cc:26
RunIndex index() const
Definition: RunPrincipal.h:57
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:562
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=nullptr)
Definition: RunPrincipal.cc:28
void putOrMerge(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: RunPrincipal.cc:47
void put_(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: Principal.cc:927