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
edm::RunPrincipal::mergeableRunProductMetadataPtr_
edm::propagate_const< std::unique_ptr< MergeableRunProductMetadata > > mergeableRunProductMetadataPtr_
Definition: RunPrincipal.h:95
edm::RunPrincipal::putOrMerge
void putOrMerge(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: RunPrincipal.cc:47
ProductResolverBase.h
edm::ProductResolverIndex
unsigned int ProductResolverIndex
Definition: ProductResolverIndex.h:8
edm::Principal::put_
void put_(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: Principal.cc:923
edm
HLT enums.
Definition: AlignableModifier.h:19
deep_tau::DeepTauBase::BasicDiscriminator
BasicDiscriminator
Definition: DeepTauBase.h:115
ProductPutOrMergerBase.h
cms::cuda::assert
assert(be >=bs)
edm::Principal
Definition: Principal.h:56
ProcessHistoryRegistry.h
ProductRegistry.h
edm::InRun
Definition: BranchType.h:11
edm::Principal::getProductResolverByIndex
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:562
edm::RunPrincipal::put
void put(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: RunPrincipal.cc:38
DQM.reader
reader
Definition: DQM.py:105
edm::RunPrincipal::aux_
edm::propagate_const< std::shared_ptr< RunAuxiliary > > aux_
Definition: RunPrincipal.h:88
edm::Principal::reader
DelayedReader * reader() const
Definition: Principal.h:187
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
edm::errors::InsertFailure
Definition: EDMException.h:35
ProductPutterBase.h
edm::RunPrincipal::m_reducedHistoryID
ProcessHistoryID m_reducedHistoryID
Definition: RunPrincipal.h:89
edm::RunPrincipal::index
RunIndex index() const
Definition: RunPrincipal.h:57
edm::RunPrincipal::transitionIndex_
unsigned int transitionIndex_() const override
Definition: RunPrincipal.cc:58
edm::Principal::fillPrincipal
void fillPrincipal(DelayedReader *reader)
Definition: Principal.cc:402
RunPrincipal.h
printConversionInfo.aux
aux
Definition: printConversionInfo.py:19
edm::Principal::getExistingProduct
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:501
edm::HistoryAppender
Definition: HistoryAppender.h:13
edm::ProcessHistoryRegistry::reducedProcessHistoryID
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
Definition: ProcessHistoryRegistry.cc:23
edm::RunPrincipal::fillRunPrincipal
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=nullptr)
Definition: RunPrincipal.cc:28
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::RunPrincipal::RunPrincipal
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
MergeableRunProductMetadata.h
Exception
Definition: hltDiff.cc:245
edm::ProcessHistoryRegistry::getMapped
bool getMapped(ProcessHistoryID const &key, ProcessHistory &value) const
Definition: ProcessHistoryRegistry.cc:29
edm::RunPrincipal::~RunPrincipal
~RunPrincipal() override
Definition: RunPrincipal.cc:26
edm::DelayedReader
Definition: DelayedReader.h:29
edm::ProcessHistoryRegistry
Definition: ProcessHistoryRegistry.h:18
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::BranchDescription
Definition: BranchDescription.h:32
edm::RunIndex::value
unsigned int value() const
Definition: RunIndex.h:45
edm::ProcessConfiguration
Definition: ProcessConfiguration.h:14
edm::RunPrincipal::preReadFile
void preReadFile()
Definition: RunPrincipal.cc:60
edm::MergeableRunProductProcesses
Definition: MergeableRunProductProcesses.h:11