CMS 3D CMS Logo

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:92
void putOrMerge(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: RunPrincipal.cc:47
unsigned int ProductResolverIndex
unsigned int transitionIndex_() const override
Definition: RunPrincipal.cc:58
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:501
unsigned int value() const
Definition: RunIndex.h:45
reader
Definition: DQM.py:105
assert(be >=bs)
ProcessHistoryID m_reducedHistoryID
Definition: RunPrincipal.h:93
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
RunIndex index() const
Definition: RunPrincipal.h:57
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
void put_(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: Principal.cc:955
edm::propagate_const< std::unique_ptr< MergeableRunProductMetadata > > mergeableRunProductMetadataPtr_
Definition: RunPrincipal.h:99
~RunPrincipal() override
Definition: RunPrincipal.cc:26
void put(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: RunPrincipal.cc:38
bool getMapped(ProcessHistoryID const &key, ProcessHistory &value) const
HLT enums.
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=nullptr)
Definition: RunPrincipal.cc:28
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:562
def move(src, dest)
Definition: eostools.py:511
DelayedReader * reader() const
Definition: Principal.h:187