CMS 3D CMS Logo

RunPrincipal.cc
Go to the documentation of this file.
2 
9 
10 namespace edm {
11  RunPrincipal::RunPrincipal(std::shared_ptr<ProductRegistry const> reg,
12  ProcessConfiguration const& pc,
13  HistoryAppender* historyAppender,
14  unsigned int iRunIndex,
15  bool isForPrimaryProcess,
16  MergeableRunProductProcesses const* mergeableRunProductProcesses)
17  : Base(reg, reg->productLookup(InRun), pc, InRun, historyAppender, isForPrimaryProcess), index_(iRunIndex) {
18  if (mergeableRunProductProcesses) { // primary RunPrincipals of EventProcessor
19  mergeableRunProductMetadataPtr_ = (std::make_unique<MergeableRunProductMetadata>(*mergeableRunProductProcesses));
20  }
21  }
22 
24 
27  auto history = processHistoryRegistry.getMapped(aux_.processHistoryID());
29 
30  for (auto& prod : *this) {
31  prod->setMergeableRunProductMetadata(mergeableRunProductMetadataPtr_.get());
32  }
33  }
34 
35  void RunPrincipal::put(BranchDescription const& bd, std::unique_ptr<WrapperBase> edp) const {
36  put_(bd, std::move(edp));
37  }
38 
39  void RunPrincipal::put(ProductResolverIndex index, std::unique_ptr<WrapperBase> edp) const {
40  auto phb = getProductResolverByIndex(index);
41  dynamic_cast<ProductPutterBase const*>(phb)->putProduct(std::move(edp));
42  }
43 
44  void RunPrincipal::putOrMerge(BranchDescription const& bd, std::unique_ptr<WrapperBase> prod) const {
45  if (prod.get() == nullptr) {
46  throw edm::Exception(edm::errors::InsertFailure, "Null Pointer")
47  << "putOrMerge: Cannot put because unique_ptr to product is null."
48  << "\n";
49  }
50  auto phb = getExistingProduct(bd.branchID());
51  assert(phb);
52  dynamic_cast<ProductPutOrMergerBase const*>(phb)->putOrMergeProduct(std::move(prod));
53  }
54 
55  unsigned int RunPrincipal::transitionIndex_() const { return index().value(); }
56 
59  mergeableRunProductMetadataPtr_->preReadFile();
60  }
61  }
62 
63 } // namespace edm
void fillPrincipal(DelayedReader *reader)
Definition: Principal.cc:406
void putOrMerge(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: RunPrincipal.cc:44
unsigned int ProductResolverIndex
unsigned int transitionIndex_() const override
Definition: RunPrincipal.cc:55
RunPrincipal(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
BranchID const & branchID() const
ProcessHistoryID const & processHistoryID() const
Definition: RunAuxiliary.h:24
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:505
unsigned int value() const
Definition: RunIndex.h:45
RunAuxiliary aux_
Definition: RunPrincipal.h:92
reader
Definition: DQM.py:105
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const noexcept
Definition: Principal.cc:566
assert(be >=bs)
ProcessHistoryID m_reducedHistoryID
Definition: RunPrincipal.h:93
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
RunIndex index() const
Definition: RunPrincipal.h:56
void put_(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: Principal.cc:865
edm::propagate_const< std::unique_ptr< MergeableRunProductMetadata > > mergeableRunProductMetadataPtr_
Definition: RunPrincipal.h:99
~RunPrincipal() override
Definition: RunPrincipal.cc:23
void put(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: RunPrincipal.cc:35
bool getMapped(ProcessHistoryID const &key, ProcessHistory &value) const
HLT enums.
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=nullptr)
Definition: RunPrincipal.cc:25
def move(src, dest)
Definition: eostools.py:511
DelayedReader * reader() const
Definition: Principal.h:181