CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
edm::Principal Class Reference

#include <Principal.h>

Inheritance diagram for edm::Principal:
edm::EDProductGetter edm::EventPrincipal edm::LuminosityBlockPrincipal edm::RunPrincipal

Public Types

typedef std::vector< BasicHandleBasicHandleVec
 
typedef unsigned long CacheIdentifier_t
 
typedef boost::filter_iterator< FilledProductPtr, ProductResolverCollection::const_iterator > const_iterator
 
typedef ProductResolverBase const * ConstProductResolverPtr
 
typedef boost::filter_iterator< FilledProductPtr, ProductResolverCollection::iterator > iterator
 
typedef std::string ProcessName
 
typedef ProcessHistory::const_iterator ProcessNameConstIterator
 
typedef std::vector< propagate_const< std::shared_ptr< ProductResolverBase > > > ProductResolverCollection
 
typedef std::shared_ptr< ProductResolverBaseSharedProductPtr
 
typedef ProductResolverCollection::size_type size_type
 

Public Member Functions

void adjustIndexesAfterProductRegistryAddition ()
 
bool adjustToNewProductRegistry (ProductRegistry const &reg)
 
iterator begin ()
 
const_iterator begin () const
 
BranchType const & branchType () const
 
CacheIdentifier_t cacheIdentifier () const
 
void clearPrincipal ()
 
void deleteProduct (BranchID const &id) const
 
iterator end ()
 
const_iterator end () const
 
void fillPrincipal (ProcessHistoryID const &hist, ProcessHistory const *phr, DelayedReader *reader)
 
ProductData const * findProductByTag (TypeID const &typeID, InputTag const &tag, ModuleCallingContext const *mcc) const
 
void getAllProvenance (std::vector< Provenance const * > &provenances) const
 
void getAllStableProvenance (std::vector< StableProvenance const * > &provenances) const
 
BasicHandle getByLabel (KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
BasicHandle getByLabel (KindOfType kindOfType, TypeID const &typeID, std::string const &label, std::string const &instance, std::string const &process, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
BasicHandle getByToken (KindOfType kindOfType, TypeID const &typeID, ProductResolverIndex index, bool skipCurrentProcess, bool &ambiguous, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
void getManyByType (TypeID const &typeID, BasicHandleVec &results, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
ProductResolverBasegetModifiableProductResolver (BranchID const &oid)
 
ConstProductResolverPtr getProductResolver (BranchID const &oid) const
 
ConstProductResolverPtr getProductResolverByIndex (ProductResolverIndex const &oid) const
 
Provenance getProvenance (BranchID const &bid, ModuleCallingContext const *mcc) const
 
std::vector< unsigned int > const & lookupProcessOrder () const
 
void prefetchAsync (WaitingTask *waitTask, ProductResolverIndex index, bool skipCurrentProcess, ServiceToken const &token, ModuleCallingContext const *mcc) const
 
 Principal (std::shared_ptr< ProductRegistry const > reg, std::shared_ptr< ProductResolverIndexHelper const > productLookup, ProcessConfiguration const &pc, BranchType bt, HistoryAppender *historyAppender, bool isForPrimaryProcess=true)
 
ProcessConfiguration const & processConfiguration () const
 
ProcessHistory const & processHistory () const
 
ProcessHistoryID const & processHistoryID () const
 
EDProductGetter const * prodGetter () const
 
ProductResolverIndexHelper const & productLookup () const
 
ProductRegistry const & productRegistry () const
 
void readAllFromSourceAndMergeImmediately (MergeableRunProductMetadata const *mergeableRunProductMetadata=nullptr)
 
DelayedReaderreader () const
 
void recombine (Principal &other, std::vector< BranchID > const &bids)
 
void setupUnscheduled (UnscheduledConfigurator const &)
 
size_t size () const
 
 ~Principal () override
 
- Public Member Functions inherited from edm::EDProductGetter
 EDProductGetter ()
 
 EDProductGetter (EDProductGetter const &)=delete
 
EDProductGetter const & operator= (EDProductGetter const &)=delete
 
unsigned int transitionIndex () const
 
virtual ~EDProductGetter ()
 

Protected Member Functions

void addProduct_ (std::unique_ptr< ProductResolverBase > phb)
 
void addProductOrThrow (std::unique_ptr< ProductResolverBase > phb)
 
template<typename F >
void applyToResolvers (F iFunc)
 
ProductResolverBasegetExistingProduct (BranchID const &branchID)
 
ProductResolverBase const * getExistingProduct (BranchID const &branchID) const
 
ProductResolverBase const * getExistingProduct (ProductResolverBase const &phb) const
 
void putOrMerge (BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
 

Private Member Functions

void addAliasedProduct (std::shared_ptr< BranchDescription const > bd)
 
void addInputProduct (std::shared_ptr< BranchDescription const > bd)
 
void addParentProcessProduct (std::shared_ptr< BranchDescription const > bd)
 
void addScheduledProduct (std::shared_ptr< BranchDescription const > bd)
 
void addSourceProduct (std::shared_ptr< BranchDescription const > bd)
 
void addSwitchAliasProduct (std::shared_ptr< BranchDescription const > bd)
 
void addSwitchProducerProduct (std::shared_ptr< BranchDescription const > bd)
 
void addUnscheduledProduct (std::shared_ptr< BranchDescription const > bd)
 
virtual void changedIndexes_ ()
 
ProductData const * findProductByLabel (KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumer, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
ProductData const * findProductByLabel (KindOfType kindOfType, TypeID const &typeID, std::string const &label, std::string const &instance, std::string const &process, EDConsumerBase const *consumer, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
void findProducts (std::vector< ProductResolverBase const * > const &holders, TypeID const &typeID, BasicHandleVec &results, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
WrapperBase const * getIt (ProductID const &) const override
 
WrapperBase const * getThinnedProduct (ProductID const &, unsigned int &) const override
 
void getThinnedProducts (ProductID const &, std::vector< WrapperBase const * > &, std::vector< unsigned int > &) const override
 
void putOrMerge (std::unique_ptr< WrapperBase > prod, ProductResolverBase const *productResolver) const
 

Private Attributes

BranchType branchType_
 
CacheIdentifier_t cacheIdentifier_
 
edm::propagate_const< HistoryAppender * > historyAppender_
 
std::vector< unsigned int > lookupProcessOrder_
 
ProcessHistoryID orderProcessHistoryID_
 
std::shared_ptr< ProductRegistry const > preg_
 
ProcessConfiguration const * processConfiguration_
 
ProcessHistoryID processHistoryID_
 
ProcessHistoryID processHistoryIDBeforeConfig_
 
std::shared_ptr< ProcessHistory const > processHistoryPtr_
 
std::shared_ptr< ProductResolverIndexHelper const > productLookup_
 
ProductResolverCollection productResolvers_
 
DelayedReaderreader_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProductGetter
static void assignEDProductGetter (EDProductGetter const *&)
 
static EDProductGetter const * switchProductGetter (EDProductGetter const *)
 These can only be used internally by the framework. More...
 

Detailed Description

Definition at line 57 of file Principal.h.

Member Typedef Documentation

◆ BasicHandleVec

Definition at line 64 of file Principal.h.

◆ CacheIdentifier_t

typedef unsigned long edm::Principal::CacheIdentifier_t

Definition at line 182 of file Principal.h.

◆ const_iterator

typedef boost::filter_iterator<FilledProductPtr, ProductResolverCollection::const_iterator> edm::Principal::const_iterator

Definition at line 60 of file Principal.h.

◆ ConstProductResolverPtr

Definition at line 63 of file Principal.h.

◆ iterator

typedef boost::filter_iterator<FilledProductPtr, ProductResolverCollection::iterator> edm::Principal::iterator

Definition at line 61 of file Principal.h.

◆ ProcessName

typedef std::string edm::Principal::ProcessName

Definition at line 68 of file Principal.h.

◆ ProcessNameConstIterator

Definition at line 62 of file Principal.h.

◆ ProductResolverCollection

Definition at line 59 of file Principal.h.

◆ SharedProductPtr

Definition at line 67 of file Principal.h.

◆ size_type

typedef ProductResolverCollection::size_type edm::Principal::size_type

Definition at line 65 of file Principal.h.

Constructor & Destructor Documentation

◆ Principal()

edm::Principal::Principal ( std::shared_ptr< ProductRegistry const >  reg,
std::shared_ptr< ProductResolverIndexHelper const >  productLookup,
ProcessConfiguration const &  pc,
BranchType  bt,
HistoryAppender historyAppender,
bool  isForPrimaryProcess = true 
)

Definition at line 121 of file Principal.cc.

127  : EDProductGetter(),
133  preg_(reg),
136  reader_(),
137  branchType_(bt),
138  historyAppender_(historyAppender),
140  productResolvers_.resize(reg->getNextIndexValue(bt));
141  //Now that these have been set, we can create the list of Branches we need.
142  std::string const source("source");
143  ProductRegistry::ProductList const& prodsList = reg->productList();
144  // The constructor of an alias product holder takes as an argument the product holder for which it is an alias.
145  // So, the non-alias product holders must be created first.
146  // Therefore, on this first pass, skip current EDAliases.
147  bool hasAliases = false;
148  bool hasSwitchAliases = false;
149  for (auto const& prod : prodsList) {
150  BranchDescription const& bd = prod.second;
151  if (bd.branchType() == branchType_) {
152  if (isForPrimaryProcess or bd.processName() == pc.processName()) {
153  if (bd.isAlias()) {
154  hasAliases = true;
155  } else if (bd.isSwitchAlias()) {
156  hasSwitchAliases = true;
157  } else {
158  auto cbd = std::make_shared<BranchDescription const>(bd);
159  if (bd.produced()) {
160  if (bd.moduleLabel() == source) {
161  addSourceProduct(cbd);
162  } else if (bd.onDemand()) {
165  } else {
166  addScheduledProduct(cbd);
167  }
168  } else {
169  addInputProduct(cbd);
170  }
171  }
172  } else {
173  //We are in a SubProcess and this branch is from the parent
174  auto cbd = std::make_shared<BranchDescription const>(bd);
176  }
177  }
178  }
179  // Now process any EDAliases
180  if (hasAliases) {
181  for (auto const& prod : prodsList) {
182  BranchDescription const& bd = prod.second;
183  if (bd.isAlias() && bd.branchType() == branchType_) {
184  addAliasedProduct(std::make_shared<BranchDescription const>(bd));
185  }
186  }
187  }
188  // Finally process any SwitchProducer aliases
189  if (hasSwitchAliases) {
190  for (auto const& prod : prodsList) {
191  BranchDescription const& bd = prod.second;
192  if (bd.isSwitchAlias() && bd.branchType() == branchType_) {
194  auto cbd = std::make_shared<BranchDescription const>(bd);
195  // Need different implementation for SwitchProducers not
196  // in any Path (onDemand) and for those in a Path in order
197  // to prevent the switch-aliased-for EDProducers from
198  // being run when the SwitchProducer is in a Path after a
199  // failing EDFilter.
200  if (bd.onDemand()) {
202  } else {
204  }
205  }
206  }
207  }
208 
209  // Now create the ProductResolvers that search in reverse process
210  // order and are used for queries where the process name is the
211  // empty string
212  std::vector<std::string> const& lookupProcessNames = productLookup_->lookupProcessNames();
213  std::vector<ProductResolverIndex> matchingHolders(lookupProcessNames.size(), ProductResolverIndexInvalid);
214  std::vector<bool> ambiguous(lookupProcessNames.size(), false);
215  unsigned int beginElements = productLookup_->beginElements();
216  std::vector<TypeID> const& sortedTypeIDs = productLookup_->sortedTypeIDs();
217  std::vector<ProductResolverIndexHelper::Range> const& ranges = productLookup_->ranges();
218  std::vector<ProductResolverIndexHelper::IndexAndNames> const& indexAndNames = productLookup_->indexAndNames();
219  std::vector<char> const& processNamesCharArray = productLookup_->processNames();
220 
221  unsigned int numberOfMatches = 0;
223  if (!sortedTypeIDs.empty()) {
224  ProductResolverIndex productResolverIndex = ProductResolverIndexInvalid;
225  for (unsigned int k = 0, kEnd = sortedTypeIDs.size(); k < kEnd; ++k) {
227  for (unsigned int i = range.begin(); i < range.end(); ++i) {
228  ProductResolverIndexHelper::IndexAndNames const& product = indexAndNames.at(i);
229  if (product.startInProcessNames() == 0) {
230  if (productResolverIndex != ProductResolverIndexInvalid) {
231  if ((numberOfMatches == 1) and (lastMatchIndex != ProductResolverIndexAmbiguous)) {
232  //only one choice so use a special resolver
233  productResolvers_.at(productResolverIndex) =
234  std::make_shared<SingleChoiceNoProcessProductResolver>(lastMatchIndex);
235  } else {
236  bool productMadeAtEnd = false;
237  //Need to know if the product from this processes is added at end of transition
238  for (unsigned int j = 0; j < matchingHolders.size(); ++j) {
239  if ((not ambiguous[j]) and ProductResolverIndexInvalid != matchingHolders[j] and
240  productResolvers_[matchingHolders[j]]->branchDescription().availableOnlyAtEndTransition()) {
241  productMadeAtEnd = true;
242  break;
243  }
244  }
245  std::shared_ptr<ProductResolverBase> newHolder =
246  std::make_shared<NoProcessProductResolver>(matchingHolders, ambiguous, productMadeAtEnd);
247  productResolvers_.at(productResolverIndex) = newHolder;
248  }
249  matchingHolders.assign(lookupProcessNames.size(), ProductResolverIndexInvalid);
250  ambiguous.assign(lookupProcessNames.size(), false);
251  numberOfMatches = 0;
252  lastMatchIndex = ProductResolverIndexInvalid;
253  }
254  productResolverIndex = product.index();
255  } else {
256  std::string process(&processNamesCharArray.at(product.startInProcessNames()));
257  auto iter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), process);
258  assert(iter != lookupProcessNames.end());
259  ProductResolverIndex iMatchingIndex = product.index();
260  lastMatchIndex = iMatchingIndex;
261  assert(iMatchingIndex != ProductResolverIndexInvalid);
262  ++numberOfMatches;
263  if (iMatchingIndex == ProductResolverIndexAmbiguous) {
264  assert(k >= beginElements);
265  ambiguous.at(iter - lookupProcessNames.begin()) = true;
266  } else {
267  matchingHolders.at(iter - lookupProcessNames.begin()) = iMatchingIndex;
268  }
269  }
270  }
271  }
272  //Need to know if the product from this processes is added at end of transition
273  if ((numberOfMatches == 1) and (lastMatchIndex != ProductResolverIndexAmbiguous)) {
274  //only one choice so use a special resolver
275  productResolvers_.at(productResolverIndex) =
276  std::make_shared<SingleChoiceNoProcessProductResolver>(lastMatchIndex);
277  } else {
278  bool productMadeAtEnd = false;
279  for (unsigned int i = 0; i < matchingHolders.size(); ++i) {
280  if ((not ambiguous[i]) and ProductResolverIndexInvalid != matchingHolders[i] and
281  productResolvers_[matchingHolders[i]]->branchDescription().availableOnlyAtEndTransition()) {
282  productMadeAtEnd = true;
283  break;
284  }
285  }
286  std::shared_ptr<ProductResolverBase> newHolder =
287  std::make_shared<NoProcessProductResolver>(matchingHolders, ambiguous, productMadeAtEnd);
288  productResolvers_.at(productResolverIndex) = newHolder;
289  }
290  }
291  }

References addAliasedProduct(), addInputProduct(), addParentProcessProduct(), addScheduledProduct(), addSourceProduct(), addSwitchAliasProduct(), addSwitchProducerProduct(), addUnscheduledProduct(), cms::cuda::assert(), edm::BranchDescription::branchType(), branchType_, spr::find(), mps_fire::i, edm::ProductResolverIndexHelper::IndexAndNames::index(), edm::InEvent, edm::BranchDescription::isAlias(), edm::BranchDescription::isSwitchAlias(), dqmiolumiharvest::j, dqmdumpme::k, edm::BranchDescription::moduleLabel(), edm::BranchDescription::onDemand(), or, LaserDQM_cfg::process, edm::ProcessConfiguration::processName(), edm::BranchDescription::processName(), dumpMFGeometry_cfg::prod, edm::BranchDescription::produced(), productLookup_, edm::ProductResolverIndexAmbiguous, edm::ProductResolverIndexInvalid, productResolvers_, FastTimerService_cff::range, diffTwoXMLs::ranges, edm::source(), edm::ProductResolverIndexHelper::IndexAndNames::startInProcessNames(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~Principal()

edm::Principal::~Principal ( )
override

Definition at line 293 of file Principal.cc.

293 {}

Member Function Documentation

◆ addAliasedProduct()

void edm::Principal::addAliasedProduct ( std::shared_ptr< BranchDescription const >  bd)
private

Definition at line 344 of file Principal.cc.

344  {
345  ProductResolverIndex index = preg_->indexFrom(bd->originalBranchID());
347 
348  addProductOrThrow(std::make_unique<AliasProductResolver>(
349  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
350  }

References addProductOrThrow(), cms::cuda::assert(), eostools::move(), preg_, edm::ProductResolverIndexInvalid, and productResolvers_.

Referenced by Principal().

◆ addInputProduct()

void edm::Principal::addInputProduct ( std::shared_ptr< BranchDescription const >  bd)
private

Definition at line 336 of file Principal.cc.

336  {
337  addProductOrThrow(std::make_unique<InputProductResolver>(std::move(bd)));
338  }

References addProductOrThrow(), and eostools::move().

Referenced by adjustIndexesAfterProductRegistryAddition(), and Principal().

◆ addParentProcessProduct()

void edm::Principal::addParentProcessProduct ( std::shared_ptr< BranchDescription const >  bd)
private

Definition at line 368 of file Principal.cc.

368  {
369  addProductOrThrow(std::make_unique<ParentProcessProductResolver>(std::move(bd)));
370  }

References addProductOrThrow(), and eostools::move().

Referenced by Principal().

◆ addProduct_()

void edm::Principal::addProduct_ ( std::unique_ptr< ProductResolverBase phb)
protected

Definition at line 502 of file Principal.cc.

502  {
503  BranchDescription const& bd = productResolver->branchDescription();
504  assert(!bd.className().empty());
505  assert(!bd.friendlyClassName().empty());
506  assert(!bd.moduleLabel().empty());
507  assert(!bd.processName().empty());
508  SharedProductPtr phb(productResolver.release());
509 
510  ProductResolverIndex index = preg_->indexFrom(bd.branchID());
512  productResolvers_[index] = phb;
513  }

References cms::cuda::assert(), edm::BranchDescription::branchID(), edm::BranchDescription::className(), edm::BranchDescription::friendlyClassName(), edm::BranchDescription::moduleLabel(), preg_, edm::BranchDescription::processName(), edm::ProductResolverIndexInvalid, and productResolvers_.

Referenced by addProductOrThrow().

◆ addProductOrThrow()

void edm::Principal::addProductOrThrow ( std::unique_ptr< ProductResolverBase phb)
protected

Definition at line 515 of file Principal.cc.

515  {
516  ProductResolverBase const* phb = getExistingProduct(*productResolver);
517  if (phb != nullptr) {
518  BranchDescription const& bd = productResolver->branchDescription();
519  throw Exception(errors::InsertFailure, "AlreadyPresent")
520  << "addProductOrThrow: Problem found while adding product, "
521  << "product already exists for (" << bd.friendlyClassName() << "," << bd.moduleLabel() << ","
522  << bd.productInstanceName() << "," << bd.processName() << ")\n";
523  }
524  addProduct_(std::move(productResolver));
525  }

References addProduct_(), Exception, edm::BranchDescription::friendlyClassName(), getExistingProduct(), edm::errors::InsertFailure, edm::BranchDescription::moduleLabel(), eostools::move(), edm::BranchDescription::processName(), and edm::BranchDescription::productInstanceName().

Referenced by addAliasedProduct(), addInputProduct(), addParentProcessProduct(), addScheduledProduct(), addSourceProduct(), addSwitchAliasProduct(), addSwitchProducerProduct(), and addUnscheduledProduct().

◆ addScheduledProduct()

void edm::Principal::addScheduledProduct ( std::shared_ptr< BranchDescription const >  bd)
private

Definition at line 326 of file Principal.cc.

326  {
327  auto phb = std::make_unique<PuttableProductResolver>(std::move(bd));
329  }

References addProductOrThrow(), and eostools::move().

Referenced by Principal().

◆ addSourceProduct()

void edm::Principal::addSourceProduct ( std::shared_ptr< BranchDescription const >  bd)
private

Definition at line 331 of file Principal.cc.

331  {
332  auto phb = std::make_unique<PuttableProductResolver>(std::move(bd));
334  }

References addProductOrThrow(), and eostools::move().

Referenced by Principal().

◆ addSwitchAliasProduct()

void edm::Principal::addSwitchAliasProduct ( std::shared_ptr< BranchDescription const >  bd)
private

Definition at line 360 of file Principal.cc.

360  {
361  ProductResolverIndex index = preg_->indexFrom(bd->switchAliasForBranchID());
363 
364  addProductOrThrow(std::make_unique<SwitchAliasProductResolver>(
365  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
366  }

References addProductOrThrow(), cms::cuda::assert(), eostools::move(), preg_, edm::ProductResolverIndexInvalid, and productResolvers_.

Referenced by Principal().

◆ addSwitchProducerProduct()

void edm::Principal::addSwitchProducerProduct ( std::shared_ptr< BranchDescription const >  bd)
private

Definition at line 352 of file Principal.cc.

352  {
353  ProductResolverIndex index = preg_->indexFrom(bd->switchAliasForBranchID());
355 
356  addProductOrThrow(std::make_unique<SwitchProducerProductResolver>(
357  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
358  }

References addProductOrThrow(), cms::cuda::assert(), eostools::move(), preg_, edm::ProductResolverIndexInvalid, and productResolvers_.

Referenced by Principal().

◆ addUnscheduledProduct()

void edm::Principal::addUnscheduledProduct ( std::shared_ptr< BranchDescription const >  bd)
private

Definition at line 340 of file Principal.cc.

340  {
341  addProductOrThrow(std::make_unique<UnscheduledProductResolver>(std::move(bd)));
342  }

References addProductOrThrow(), and eostools::move().

Referenced by Principal().

◆ adjustIndexesAfterProductRegistryAddition()

void edm::Principal::adjustIndexesAfterProductRegistryAddition ( )

Definition at line 884 of file Principal.cc.

884  {
885  if (preg_->getNextIndexValue(branchType_) != productResolvers_.size()) {
886  bool changed = false;
887  productResolvers_.resize(preg_->getNextIndexValue(branchType_));
888  for (auto const& prod : preg_->productList()) {
889  BranchDescription const& bd = prod.second;
890  if (bd.branchType() == branchType_) {
891  ProductResolverIndex index = preg_->indexFrom(bd.branchID());
893  if (!productResolvers_[index]) {
894  // no product holder. Must add one. The new entry must be an input product holder.
895  assert(!bd.produced());
896  auto cbd = std::make_shared<BranchDescription const>(bd);
897  addInputProduct(cbd);
898  changed = true;
899  }
900  }
901  }
902  if (changed) {
903  changedIndexes_();
904  }
905  }
906  assert(preg_->getNextIndexValue(branchType_) == productResolvers_.size());
907  }

References addInputProduct(), cms::cuda::assert(), edm::BranchDescription::branchID(), edm::BranchDescription::branchType(), branchType_, changedIndexes_(), preg_, dumpMFGeometry_cfg::prod, edm::BranchDescription::produced(), edm::ProductResolverIndexInvalid, and productResolvers_.

Referenced by edm::PrincipalCache::adjustEventsToNewProductRegistry(), and edm::StreamerInputSource::read().

◆ adjustToNewProductRegistry()

bool edm::Principal::adjustToNewProductRegistry ( ProductRegistry const &  reg)

Definition at line 310 of file Principal.cc.

310  {
311  ProductRegistry::ProductList const& prodsList = reg.productList();
312  for (auto const& prod : prodsList) {
313  BranchDescription const& bd = prod.second;
314  if (!bd.produced() && (bd.branchType() == branchType_)) {
315  auto cbd = std::make_shared<BranchDescription const>(bd);
316  auto phb = getExistingProduct(cbd->branchID());
317  if (phb == nullptr || phb->branchDescription().branchName() != cbd->branchName()) {
318  return false;
319  }
320  phb->resetBranchDescription(cbd);
321  }
322  }
323  return true;
324  }

References edm::BranchDescription::branchType(), branchType_, getExistingProduct(), dumpMFGeometry_cfg::prod, edm::BranchDescription::produced(), edm::ProductRegistry::productList(), and edm::ProductResolverBase::resetBranchDescription().

Referenced by edm::PrincipalCache::adjustEventsToNewProductRegistry(), and edm::StreamerInputSource::read().

◆ applyToResolvers()

template<typename F >
void edm::Principal::applyToResolvers ( F  iFunc)
inlineprotected

Definition at line 213 of file Principal.h.

213  {
214  for (auto& resolver : productResolvers_) {
215  iFunc(resolver.get());
216  }
217  }

References productResolvers_.

Referenced by setupUnscheduled().

◆ begin() [1/2]

iterator edm::Principal::begin ( void  )
inline

Definition at line 166 of file Principal.h.

166  {
167  return boost::make_filter_iterator<FilledProductPtr>(productResolvers_.begin(), productResolvers_.end());
168  }

References productResolvers_.

◆ begin() [2/2]

const_iterator edm::Principal::begin ( void  ) const
inline

Definition at line 159 of file Principal.h.

159  {
160  return boost::make_filter_iterator<FilledProductPtr>(productResolvers_.begin(), productResolvers_.end());
161  }

References productResolvers_.

◆ branchType()

BranchType const& edm::Principal::branchType ( ) const
inline

◆ cacheIdentifier()

CacheIdentifier_t edm::Principal::cacheIdentifier ( ) const
inline

◆ changedIndexes_()

virtual void edm::Principal::changedIndexes_ ( )
inlineprivatevirtual

Reimplemented in edm::EventPrincipal.

Definition at line 221 of file Principal.h.

221 {}

Referenced by adjustIndexesAfterProductRegistryAddition().

◆ clearPrincipal()

void edm::Principal::clearPrincipal ( )

Definition at line 373 of file Principal.cc.

373  {
374  //We do not clear the product history information
375  // because it rarely changes and recalculating takes
376  // time.
377  reader_ = nullptr;
378  for (auto& prod : *this) {
379  prod->resetProductData();
380  }
381  }

References dumpMFGeometry_cfg::prod, and reader_.

Referenced by edm::EventPrincipal::clearEventPrincipal(), and edm::PoolSource::readEvent_().

◆ deleteProduct()

void edm::Principal::deleteProduct ( BranchID const &  id) const

Definition at line 383 of file Principal.cc.

383  {
384  auto phb = getExistingProduct(id);
385  assert(nullptr != phb);
386  phb->unsafe_deleteProduct();
387  }

References cms::cuda::assert(), and getExistingProduct().

◆ end() [1/2]

iterator edm::Principal::end ( void  )
inline

Definition at line 169 of file Principal.h.

169  {
170  return boost::make_filter_iterator<FilledProductPtr>(productResolvers_.end(), productResolvers_.end());
171  }

References productResolvers_.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

◆ end() [2/2]

const_iterator edm::Principal::end ( void  ) const
inline

Definition at line 162 of file Principal.h.

162  {
163  return boost::make_filter_iterator<FilledProductPtr>(productResolvers_.end(), productResolvers_.end());
164  }

References productResolvers_.

Referenced by Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), and edm::EventPrincipal::wasBranchListIndexesChangedFromInput().

◆ fillPrincipal()

void edm::Principal::fillPrincipal ( ProcessHistoryID const &  hist,
ProcessHistory const *  phr,
DelayedReader reader 
)

Definition at line 394 of file Principal.cc.

396  {
397  //increment identifier here since clearPrincipal isn't called for Run/Lumi
399  if (reader) {
400  reader_ = reader;
401  }
402 
403  if (historyAppender_ && productRegistry().anyProductProduced()) {
408  }
409  } else {
410  std::shared_ptr<ProcessHistory const> inputProcessHistory;
412  if (hist.isValid()) {
413  //does not own the pointer
414  auto noDel = [](void const*) {};
415  inputProcessHistory = std::shared_ptr<ProcessHistory const>(processHistory, noDel);
416  if (inputProcessHistory.get() == nullptr) {
417  throw Exception(errors::LogicError) << "Principal::fillPrincipal\n"
418  << "Input ProcessHistory not found in registry\n"
419  << "Contact a Framework developer\n";
420  }
421  } else {
422  //Since this is static we don't want it deleted
423  inputProcessHistory = std::shared_ptr<ProcessHistory const>(&s_emptyProcessHistory, [](void const*) {});
424  //no need to do any ordering since it is empty
426  }
428  processHistoryPtr_ = inputProcessHistory;
430  }
431  }
432 
434  std::vector<std::string> const& lookupProcessNames = productLookup_->lookupProcessNames();
435  lookupProcessOrder_.assign(lookupProcessNames.size(), 0);
436  unsigned int k = 0;
437 
438  // We loop over processes in reverse order of the ProcessHistory.
439  // If any entries in the product lookup tables are associated with
440  // the process we add it to the vector of processes in the order
441  // the lookup should be performed. There is one exception though,
442  // We start with the current process even if it is not in the ProcessHistory.
443  // The current process might be needed but not be in the process
444  // history if all the products produced in the current process are
445  // transient.
446  {
447  auto nameIterCurrentProcess =
448  std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processConfiguration_->processName());
449  if (nameIterCurrentProcess != lookupProcessNames.end()) {
450  lookupProcessOrder_.at(k) = nameIterCurrentProcess - lookupProcessNames.begin();
451  ++k;
452  }
453  }
454 
455  // We just looked for the current process so skip it if
456  // it is in the ProcessHistory.
457  auto iter = processHistoryPtr_->rbegin();
458  if (iter->processName() == processConfiguration_->processName()) {
459  ++iter;
460  }
461 
462  for (auto iEnd = processHistoryPtr_->rend(); iter != iEnd; ++iter) {
463  auto nameIter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), iter->processName());
464  if (nameIter == lookupProcessNames.end()) {
465  continue;
466  }
467  lookupProcessOrder_.at(k) = nameIter - lookupProcessNames.begin();
468  ++k;
469  }
471  }
472  }

References cacheIdentifier_, Exception, spr::find(), compare::hist, historyAppender_, dqmdumpme::k, edm::errors::LogicError, lookupProcessOrder_, edm::nextIdentifier(), orderProcessHistoryID_, processConfiguration_, processHistory(), processHistoryID_, processHistoryIDBeforeConfig_, processHistoryPtr_, edm::ProcessConfiguration::processName(), productLookup_, productRegistry(), reader(), reader_, and edm::s_emptyProcessHistory.

Referenced by edm::EventPrincipal::commonFillEventPrincipal(), edm::LuminosityBlockPrincipal::fillLuminosityBlockPrincipal(), and edm::RunPrincipal::fillRunPrincipal().

◆ findProductByLabel() [1/2]

ProductData const * edm::Principal::findProductByLabel ( KindOfType  kindOfType,
TypeID const &  typeID,
InputTag const &  inputTag,
EDConsumerBase const *  consumer,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const
private

Definition at line 706 of file Principal.cc.

711  {
712  bool skipCurrentProcess = inputTag.willSkipCurrentProcess();
713 
715 
717  char const* processName = inputTag.process().c_str();
718  if (skipCurrentProcess) {
719  processName = "\0";
720  } else if (inputTag.process() == InputTag::kCurrentProcess) {
722  }
723 
724  index =
725  productLookup().index(kindOfType, typeID, inputTag.label().c_str(), inputTag.instance().c_str(), processName);
726 
728  throwAmbiguousException("findProductByLabel",
729  typeID,
730  inputTag.label(),
731  inputTag.instance(),
733  } else if (index == ProductResolverIndexInvalid) {
734  return nullptr;
735  }
736  inputTag.tryToCacheIndex(index, typeID, branchType(), &productRegistry());
737  }
738  if (UNLIKELY(consumer and (not consumer->registeredToConsume(index, skipCurrentProcess, branchType())))) {
739  failedToRegisterConsumes(kindOfType,
740  typeID,
741  inputTag.label(),
742  inputTag.instance(),
744  }
745 
746  auto const& productResolver = productResolvers_[index];
747 
748  auto resolution = productResolver->resolveProduct(*this, skipCurrentProcess, sra, mcc);
749  if (resolution.isAmbiguous()) {
750  throwAmbiguousException("findProductByLabel",
751  typeID,
752  inputTag.label(),
753  inputTag.instance(),
755  }
756  return resolution.data();
757  }

References edm::appendCurrentProcessIfAlias(), branchType(), OfflineOutput_cfi::consumer, edm::ProductResolverIndexHelper::index(), SimL1EmulatorRepack_Full_cff::inputTag, edm::InputTag::kCurrentProcess, processConfiguration_, SimL1EmulatorRepack_CalouGT_cff::processName, edm::ProcessConfiguration::processName(), productLookup(), productRegistry(), edm::ProductResolverIndexAmbiguous, edm::ProductResolverIndexInvalid, productResolvers_, L1TObjectsTimingClient_cff::resolution, edm::throwAmbiguousException(), and UNLIKELY.

Referenced by findProductByTag(), and getByLabel().

◆ findProductByLabel() [2/2]

ProductData const * edm::Principal::findProductByLabel ( KindOfType  kindOfType,
TypeID const &  typeID,
std::string const &  label,
std::string const &  instance,
std::string const &  process,
EDConsumerBase const *  consumer,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const
private

Definition at line 759 of file Principal.cc.

766  {
768  productLookup().index(kindOfType, typeID, label.c_str(), instance.c_str(), process.c_str());
769 
771  throwAmbiguousException("findProductByLabel", typeID, label, instance, process);
772  } else if (index == ProductResolverIndexInvalid) {
773  return nullptr;
774  }
775 
776  if (UNLIKELY(consumer and (not consumer->registeredToConsume(index, false, branchType())))) {
777  failedToRegisterConsumes(kindOfType, typeID, label, instance, process);
778  }
779 
780  auto const& productResolver = productResolvers_[index];
781 
782  auto resolution = productResolver->resolveProduct(*this, false, sra, mcc);
783  if (resolution.isAmbiguous()) {
784  throwAmbiguousException("findProductByLabel", typeID, label, instance, process);
785  }
786  return resolution.data();
787  }

References branchType(), OfflineOutput_cfi::consumer, edm::ProductResolverIndexHelper::index(), instance, label, LaserDQM_cfg::process, productLookup(), edm::ProductResolverIndexAmbiguous, edm::ProductResolverIndexInvalid, productResolvers_, L1TObjectsTimingClient_cff::resolution, edm::throwAmbiguousException(), and UNLIKELY.

◆ findProductByTag()

ProductData const * edm::Principal::findProductByTag ( TypeID const &  typeID,
InputTag const &  tag,
ModuleCallingContext const *  mcc 
) const

Definition at line 789 of file Principal.cc.

791  {
792  ProductData const* productData = findProductByLabel(PRODUCT_TYPE, typeID, tag, nullptr, nullptr, mcc);
793  return productData;
794  }

References findProductByLabel(), edm::PRODUCT_TYPE, and GlobalPosition_Frontier_DevDB_cff::tag.

◆ findProducts()

void edm::Principal::findProducts ( std::vector< ProductResolverBase const * > const &  holders,
TypeID const &  typeID,
BasicHandleVec results,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const
private

Definition at line 681 of file Principal.cc.

685  {
686  for (auto iter = processHistoryPtr_->rbegin(), iEnd = processHistoryPtr_->rend(); iter != iEnd; ++iter) {
687  std::string const& process = iter->processName();
688  for (auto productResolver : holders) {
689  BranchDescription const& bd = productResolver->branchDescription();
690  if (process == bd.processName()) {
691  // Ignore aliases to avoid matching the same product multiple times.
692  if (bd.isAnyAlias()) {
693  continue;
694  }
695 
696  ProductData const* productData = productResolver->resolveProduct(*this, false, sra, mcc).data();
697  if (productData) {
698  // Skip product if not available.
699  results.emplace_back(productData->wrapper(), &(productData->provenance()));
700  }
701  }
702  }
703  }
704  }

References edm::BranchDescription::isAnyAlias(), LaserDQM_cfg::process, processHistoryPtr_, edm::BranchDescription::processName(), edm::ProductData::provenance(), bookConverter::results, AlCaHLTBitMon_QueryRunRegistry::string, and edm::ProductData::wrapper().

Referenced by getManyByType().

◆ getAllProvenance()

void edm::Principal::getAllProvenance ( std::vector< Provenance const * > &  provenances) const

Definition at line 813 of file Principal.cc.

813  {
814  provenances.clear();
815  for (auto const& productResolver : *this) {
816  if (productResolver->singleProduct() && productResolver->provenanceAvailable() &&
817  !productResolver->branchDescription().isAnyAlias()) {
818  // We do not attempt to get the event/lumi/run status from the provenance,
819  // because the per event provenance may have been dropped.
820  if (productResolver->provenance()->branchDescription().present()) {
821  provenances.push_back(productResolver->provenance());
822  }
823  }
824  }
825  }

Referenced by edm::OccurrenceForOutput::getAllProvenance(), and edm::Event::getAllProvenance().

◆ getAllStableProvenance()

void edm::Principal::getAllStableProvenance ( std::vector< StableProvenance const * > &  provenances) const

Definition at line 830 of file Principal.cc.

830  {
831  provenances.clear();
832  for (auto const& productResolver : *this) {
833  if (productResolver->singleProduct() && !productResolver->branchDescription().isAnyAlias()) {
834  if (productResolver->stableProvenance()->branchDescription().present()) {
835  provenances.push_back(productResolver->stableProvenance());
836  }
837  }
838  }
839  }

Referenced by edm::OccurrenceForOutput::getAllStableProvenance(), edm::Run::getAllStableProvenance(), edm::LuminosityBlock::getAllStableProvenance(), and edm::Event::getAllStableProvenance().

◆ getByLabel() [1/2]

BasicHandle edm::Principal::getByLabel ( KindOfType  kindOfType,
TypeID const &  typeID,
InputTag const &  inputTag,
EDConsumerBase const *  consumes,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const

Definition at line 540 of file Principal.cc.

545  {
546  ProductData const* result = findProductByLabel(kindOfType, typeID, inputTag, consumer, sra, mcc);
547  if (result == nullptr) {
548  return BasicHandle(makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> {
549  return makeNotFoundException(
550  "getByLabel",
551  kindOfType,
552  typeID,
553  inputTag.label(),
554  inputTag.instance(),
556  }));
557  }
558  return BasicHandle(result->wrapper(), &(result->provenance()));
559  }

References edm::appendCurrentProcessIfAlias(), OfflineOutput_cfi::consumer, findProductByLabel(), SimL1EmulatorRepack_Full_cff::inputTag, edm::makeHandleExceptionFactory(), edm::makeNotFoundException(), processConfiguration_, edm::ProcessConfiguration::processName(), and mps_fire::result.

Referenced by edm::test::Event::get(), PileUpEventPrincipal::getByLabel(), edm::PrincipalGetAdapter::getByLabel_(), and edm::PrincipalGetAdapter::getMatchingSequenceByLabel_().

◆ getByLabel() [2/2]

BasicHandle edm::Principal::getByLabel ( KindOfType  kindOfType,
TypeID const &  typeID,
std::string const &  label,
std::string const &  instance,
std::string const &  process,
EDConsumerBase const *  consumes,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const

Definition at line 561 of file Principal.cc.

568  {
569  ProductData const* result = findProductByLabel(kindOfType, typeID, label, instance, process, consumer, sra, mcc);
570  if (result == nullptr) {
571  return BasicHandle(makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> {
572  return makeNotFoundException("getByLabel", kindOfType, typeID, label, instance, process);
573  }));
574  }
575  return BasicHandle(result->wrapper(), &(result->provenance()));
576  }

References OfflineOutput_cfi::consumer, findProductByLabel(), instance, label, edm::makeHandleExceptionFactory(), edm::makeNotFoundException(), LaserDQM_cfg::process, and mps_fire::result.

◆ getByToken()

BasicHandle edm::Principal::getByToken ( KindOfType  kindOfType,
TypeID const &  typeID,
ProductResolverIndex  index,
bool  skipCurrentProcess,
bool &  ambiguous,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const

Definition at line 578 of file Principal.cc.

584  {
586  auto& productResolver = productResolvers_[index];
587  assert(nullptr != productResolver.get());
588  auto resolution = productResolver->resolveProduct(*this, skipCurrentProcess, sra, mcc);
589  if (resolution.isAmbiguous()) {
590  ambiguous = true;
591  //The caller is looking explicitly for this case
592  // and uses the extra data at the caller to setup the exception
593  return BasicHandle::makeInvalid();
594  }
595  auto productData = resolution.data();
596  if (productData == nullptr) {
597  //The caller is looking explicitly for this case
598  // and uses the extra data at the caller to setup the exception
599  return BasicHandle::makeInvalid();
600  }
601  return BasicHandle(productData->wrapper(), &(productData->provenance()));
602  }

References cms::cuda::assert(), edm::BasicHandle::makeInvalid(), edm::ProductResolverIndexInvalid, productResolvers_, and L1TObjectsTimingClient_cff::resolution.

Referenced by edm::PrincipalGetAdapter::getByToken_().

◆ getExistingProduct() [1/3]

ProductResolverBase * edm::Principal::getExistingProduct ( BranchID const &  branchID)
protected

Definition at line 474 of file Principal.cc.

474  {
475  return const_cast<ProductResolverBase*>(const_cast<const Principal*>(this)->getExistingProduct(branchID));
476  }

Referenced by addProductOrThrow(), adjustToNewProductRegistry(), deleteProduct(), getExistingProduct(), edm::EventPrincipal::put(), edm::EventPrincipal::putOnRead(), and putOrMerge().

◆ getExistingProduct() [2/3]

ProductResolverBase const * edm::Principal::getExistingProduct ( BranchID const &  branchID) const
protected

Definition at line 478 of file Principal.cc.

478  {
479  ProductResolverIndex index = preg_->indexFrom(branchID);
481  return productResolvers_.at(index).get();
482  }

References cms::cuda::assert(), preg_, edm::ProductResolverIndexInvalid, and productResolvers_.

◆ getExistingProduct() [3/3]

ProductResolverBase const * edm::Principal::getExistingProduct ( ProductResolverBase const &  phb) const
protected

Definition at line 484 of file Principal.cc.

484  {
485  auto phb = getExistingProduct(productResolver.branchDescription().branchID());
486  if (nullptr != phb && BranchKey(productResolver.branchDescription()) != BranchKey(phb->branchDescription())) {
487  BranchDescription const& newProduct = phb->branchDescription();
488  BranchDescription const& existing = productResolver.branchDescription();
489  if (newProduct.branchName() != existing.branchName() && newProduct.branchID() == existing.branchID()) {
490  throw cms::Exception("HashCollision")
491  << "Principal::getExistingProduct\n"
492  << " Branch " << newProduct.branchName() << " has same branch ID as branch " << existing.branchName()
493  << "\n"
494  << "Workaround: change process name or product instance name of " << newProduct.branchName() << "\n";
495  } else {
496  assert(nullptr == phb || BranchKey(productResolver.branchDescription()) == BranchKey(phb->branchDescription()));
497  }
498  }
499  return phb;
500  }

References cms::cuda::assert(), edm::ProductResolverBase::branchDescription(), edm::BranchDescription::branchID(), edm::BranchDescription::branchName(), Exception, dqmPostProcessing_online::existing, and getExistingProduct().

◆ getIt()

WrapperBase const * edm::Principal::getIt ( ProductID const &  ) const
overrideprivatevirtual

Implements edm::EDProductGetter.

Definition at line 852 of file Principal.cc.

852  {
853  assert(false);
854  return nullptr;
855  }

References cms::cuda::assert().

◆ getManyByType()

void edm::Principal::getManyByType ( TypeID const &  typeID,
BasicHandleVec results,
EDConsumerBase const *  consumes,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const

Definition at line 614 of file Principal.cc.

618  {
619  assert(results.empty());
620 
621  if (UNLIKELY(consumer and (not consumer->registeredToConsumeMany(typeID, branchType())))) {
622  failedToRegisterConsumesMany(typeID);
623  }
624 
625  // This finds the indexes to all the ProductResolver's matching the type
626  ProductResolverIndexHelper::Matches matches = productLookup().relatedIndexes(PRODUCT_TYPE, typeID);
627 
628  if (matches.numberOfMatches() == 0) {
629  return;
630  }
631 
632  results.reserve(matches.numberOfMatches());
633 
634  // Loop over the ProductResolvers. Add the products that are actually
635  // present into the results. This will also trigger delayed reading,
636  // on demand production, and check for deleted products as appropriate.
637 
638  // Over the years the code that uses getManyByType has grown to depend
639  // on the ordering of the results. The order originally was just an
640  // accident of how previous versions of the code were written, but
641  // here we have to go through some extra effort to preserve that ordering.
642 
643  // We build a list of holders that match a particular label and instance.
644  // When that list is complete we call findProducts, which loops over
645  // that list in reverse order of the ProcessHistory (starts with the
646  // most recent). Then we clear the list and repeat this until all the
647  // matching label and instance subsets have been dealt with.
648 
649  // Note that the function isFullyResolved returns true for the ProductResolvers
650  // that are associated with an empty process name. Those are the ones that
651  // know how to search for the most recent process name matching
652  // a label and instance. We do not need these for getManyByType and
653  // skip them. In addition to skipping them, we make use of the fact
654  // that they mark the beginning of each subset of holders with the same
655  // label and instance. They tell us when to call findProducts.
656 
657  std::vector<ProductResolverBase const*> holders;
658 
659  for (unsigned int i = 0; i < matches.numberOfMatches(); ++i) {
661 
662  if (!matches.isFullyResolved(i)) {
663  if (!holders.empty()) {
664  // Process the ones with a particular module label and instance
665  findProducts(holders, typeID, results, sra, mcc);
666  holders.clear();
667  }
668  } else {
669  ProductResolverBase const* productResolver = productResolvers_.at(index).get();
670  assert(productResolver);
671  holders.push_back(productResolver);
672  }
673  }
674  // Do not miss the last subset of products
675  if (!holders.empty()) {
676  findProducts(holders, typeID, results, sra, mcc);
677  }
678  return;
679  }

References cms::cuda::assert(), branchType(), OfflineOutput_cfi::consumer, findProducts(), mps_fire::i, patCandidatesForDimuonsSequences_cff::matches, edm::PRODUCT_TYPE, productLookup(), productResolvers_, edm::ProductResolverIndexHelper::relatedIndexes(), bookConverter::results, and UNLIKELY.

Referenced by edm::PrincipalGetAdapter::getManyByType_().

◆ getModifiableProductResolver()

ProductResolverBase* edm::Principal::getModifiableProductResolver ( BranchID const &  oid)
inline

Definition at line 152 of file Principal.h.

152  {
153  return const_cast<ProductResolverBase*>(const_cast<const Principal*>(this)->getProductResolver(oid));
154  }

References getProductResolver().

Referenced by edm::SubProcess::propagateProducts().

◆ getProductResolver()

Principal::ConstProductResolverPtr edm::Principal::getProductResolver ( BranchID const &  oid) const

◆ getProductResolverByIndex()

Principal::ConstProductResolverPtr edm::Principal::getProductResolverByIndex ( ProductResolverIndex const &  oid) const

◆ getProvenance()

Provenance edm::Principal::getProvenance ( BranchID const &  bid,
ModuleCallingContext const *  mcc 
) const

Definition at line 796 of file Principal.cc.

796  {
798  if (phb == nullptr) {
800  }
801 
802  if (phb->unscheduledWasNotRun()) {
803  if (not phb->resolveProduct(*this, false, nullptr, mcc).data()) {
804  throwProductNotFoundException("getProvenance(onDemand)", errors::ProductNotFound, bid);
805  }
806  }
807  return *phb->provenance();
808  }

References getProductResolver(), edm::errors::ProductNotFound, and edm::throwProductNotFoundException().

Referenced by edm::OccurrenceForOutput::getProvenance(), edm::Run::getProvenance(), edm::LuminosityBlock::getProvenance(), and edm::Event::getProvenance().

◆ getThinnedProduct()

WrapperBase const * edm::Principal::getThinnedProduct ( ProductID const &  ,
unsigned int &   
) const
overrideprivatevirtual

Implements edm::EDProductGetter.

Definition at line 857 of file Principal.cc.

857  {
858  assert(false);
859  return nullptr;
860  }

References cms::cuda::assert().

◆ getThinnedProducts()

void edm::Principal::getThinnedProducts ( ProductID const &  ,
std::vector< WrapperBase const * > &  ,
std::vector< unsigned int > &   
) const
overrideprivatevirtual

Implements edm::EDProductGetter.

Definition at line 862 of file Principal.cc.

864  {
865  assert(false);
866  }

References cms::cuda::assert().

◆ lookupProcessOrder()

std::vector<unsigned int> const& edm::Principal::lookupProcessOrder ( ) const
inline

◆ prefetchAsync()

void edm::Principal::prefetchAsync ( WaitingTask waitTask,
ProductResolverIndex  index,
bool  skipCurrentProcess,
ServiceToken const &  token,
ModuleCallingContext const *  mcc 
) const

Definition at line 604 of file Principal.cc.

608  {
609  auto const& productResolver = productResolvers_.at(index);
610  assert(nullptr != productResolver.get());
611  productResolver->prefetchAsync(task, *this, skipCurrentProcess, token, nullptr, mcc);
612  }

References cms::cuda::assert(), productResolvers_, TrackValidation_cff::task, and unpackBuffers-CaloStage2::token.

Referenced by edm::Worker::prefetchAsync(), and edm::Worker::prePrefetchSelectionAsync().

◆ processConfiguration()

ProcessConfiguration const& edm::Principal::processConfiguration ( ) const
inline

Definition at line 143 of file Principal.h.

143 { return *processConfiguration_; }

References processConfiguration_.

◆ processHistory()

ProcessHistory const& edm::Principal::processHistory ( ) const
inline

◆ processHistoryID()

ProcessHistoryID const& edm::Principal::processHistoryID ( ) const
inline

◆ prodGetter()

EDProductGetter const* edm::Principal::prodGetter ( ) const
inline

Definition at line 91 of file Principal.h.

91 { return this; }

Referenced by edm::PrincipalGetAdapter::prodGetter().

◆ productLookup()

ProductResolverIndexHelper const& edm::Principal::productLookup ( ) const
inline

Definition at line 147 of file Principal.h.

147 { return *productLookup_; }

References productLookup_.

Referenced by findProductByLabel(), edm::PrincipalGetAdapter::getBranchDescription(), and getManyByType().

◆ productRegistry()

ProductRegistry const& edm::Principal::productRegistry ( ) const
inline

◆ putOrMerge() [1/2]

void edm::Principal::putOrMerge ( BranchDescription const &  bd,
std::unique_ptr< WrapperBase edp 
) const
protected

Definition at line 872 of file Principal.cc.

872  {
873  if (edp.get() == nullptr) {
874  throw edm::Exception(edm::errors::InsertFailure, "Null Pointer")
875  << "put: Cannot put because unique_ptr to product is null."
876  << "\n";
877  }
878  auto phb = getExistingProduct(bd.branchID());
879  assert(phb);
880  // ProductResolver assumes ownership
881  putOrMerge(std::move(edp), phb);
882  }

References cms::cuda::assert(), edm::BranchDescription::branchID(), Exception, getExistingProduct(), edm::errors::InsertFailure, and eostools::move().

Referenced by edm::LuminosityBlockPrincipal::put(), and edm::RunPrincipal::put().

◆ putOrMerge() [2/2]

void edm::Principal::putOrMerge ( std::unique_ptr< WrapperBase prod,
ProductResolverBase const *  productResolver 
) const
private

Definition at line 868 of file Principal.cc.

868  {
869  phb->putOrMergeProduct(std::move(prod));
870  }

References eostools::move(), dumpMFGeometry_cfg::prod, and edm::ProductResolverBase::putOrMergeProduct().

◆ readAllFromSourceAndMergeImmediately()

void edm::Principal::readAllFromSourceAndMergeImmediately ( MergeableRunProductMetadata const *  mergeableRunProductMetadata = nullptr)

Definition at line 909 of file Principal.cc.

909  {
910  if (not reader()) {
911  return;
912  }
913 
914  for (auto& prod : *this) {
915  prod->retrieveAndMerge(*this, mergeableRunProductMetadata);
916  }
917  }

References dumpMFGeometry_cfg::prod, and reader().

Referenced by edm::PoolSource::readEvent_(), edm::RootFile::readLuminosityBlock_(), and edm::RootFile::readRun_().

◆ reader()

DelayedReader* edm::Principal::reader ( ) const
inline

◆ recombine()

void edm::Principal::recombine ( Principal other,
std::vector< BranchID > const &  bids 
)

◆ setupUnscheduled()

void edm::Principal::setupUnscheduled ( UnscheduledConfigurator const &  iConfigure)

Definition at line 389 of file Principal.cc.

389  {
390  applyToResolvers([&iConfigure](ProductResolverBase* iResolver) { iResolver->setupUnscheduled(iConfigure); });
391  }

References applyToResolvers(), and edm::ProductResolverBase::setupUnscheduled().

◆ size()

size_t edm::Principal::size ( void  ) const

Definition at line 298 of file Principal.cc.

298  {
299  size_t size = 0U;
300  for (auto const& prod : *this) {
301  if (prod->singleProduct() && // Not a NoProcessProductResolver
302  !prod->productUnavailable() && !prod->unscheduledWasNotRun() && !prod->branchDescription().dropped()) {
303  ++size;
304  }
305  }
306  return size;
307  }

References dumpMFGeometry_cfg::prod, and mitigatedMETSequence_cff::U.

Referenced by ntupleDataFormat._Collection::__iter__(), ntupleDataFormat._Collection::__len__(), edm::StreamerInputSource::read(), edm::OccurrenceForOutput::size(), and edm::Event::size().

Member Data Documentation

◆ branchType_

BranchType edm::Principal::branchType_
private

◆ cacheIdentifier_

CacheIdentifier_t edm::Principal::cacheIdentifier_
private

Definition at line 291 of file Principal.h.

Referenced by cacheIdentifier(), and fillPrincipal().

◆ historyAppender_

edm::propagate_const<HistoryAppender*> edm::Principal::historyAppender_
private

Definition at line 289 of file Principal.h.

Referenced by fillPrincipal().

◆ lookupProcessOrder_

std::vector<unsigned int> edm::Principal::lookupProcessOrder_
private

Definition at line 277 of file Principal.h.

Referenced by fillPrincipal(), and lookupProcessOrder().

◆ orderProcessHistoryID_

ProcessHistoryID edm::Principal::orderProcessHistoryID_
private

Definition at line 278 of file Principal.h.

Referenced by fillPrincipal().

◆ preg_

std::shared_ptr<ProductRegistry const> edm::Principal::preg_
private

◆ processConfiguration_

ProcessConfiguration const* edm::Principal::processConfiguration_
private

Definition at line 267 of file Principal.h.

Referenced by fillPrincipal(), findProductByLabel(), getByLabel(), and processConfiguration().

◆ processHistoryID_

ProcessHistoryID edm::Principal::processHistoryID_
private

Definition at line 264 of file Principal.h.

Referenced by fillPrincipal(), and processHistoryID().

◆ processHistoryIDBeforeConfig_

ProcessHistoryID edm::Principal::processHistoryIDBeforeConfig_
private

Definition at line 265 of file Principal.h.

Referenced by fillPrincipal().

◆ processHistoryPtr_

std::shared_ptr<ProcessHistory const> edm::Principal::processHistoryPtr_
private

Definition at line 262 of file Principal.h.

Referenced by fillPrincipal(), findProducts(), and processHistory().

◆ productLookup_

std::shared_ptr<ProductResolverIndexHelper const> edm::Principal::productLookup_
private

Definition at line 275 of file Principal.h.

Referenced by fillPrincipal(), Principal(), and productLookup().

◆ productResolvers_

ProductResolverCollection edm::Principal::productResolvers_
private

◆ reader_

DelayedReader* edm::Principal::reader_
private

Definition at line 282 of file Principal.h.

Referenced by clearPrincipal(), fillPrincipal(), reader(), and recombine().

edm::source
static const std::string source("source")
diffTwoXMLs.ranges
string ranges
Definition: diffTwoXMLs.py:79
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
edm::InputTag::kCurrentProcess
static const std::string kCurrentProcess
Definition: InputTag.h:54
edm::ProductResolverIndex
unsigned int ProductResolverIndex
Definition: ProductResolverIndex.h:8
mps_fire.i
i
Definition: mps_fire.py:355
edm::appendCurrentProcessIfAlias
static std::string appendCurrentProcessIfAlias(std::string const &processFromInputTag, std::string const &currentProcess)
Definition: Principal.cc:35
edm::Principal::findProducts
void findProducts(std::vector< ProductResolverBase const * > const &holders, TypeID const &typeID, BasicHandleVec &results, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:681
edm::PRODUCT_TYPE
Definition: ProductKindOfType.h:5
Range
PixelRecoRange< float > Range
Definition: PixelTripletHLTGenerator.cc:31
edm::errors::LogicError
Definition: EDMException.h:37
edm::Principal::ConstProductResolverPtr
ProductResolverBase const * ConstProductResolverPtr
Definition: Principal.h:63
dqmPostProcessing_online.existing
existing
Definition: dqmPostProcessing_online.py:126
cms::cuda::assert
assert(be >=bs)
edm::ProductResolverIndexHelper::index
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=nullptr) const
Definition: ProductResolverIndexHelper.cc:81
bookConverter.results
results
Definition: bookConverter.py:144
edm::Principal::addSwitchProducerProduct
void addSwitchProducerProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:352
edm::ProductResolverIndexHelper::relatedIndexes
Matches relatedIndexes(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance) const
Definition: ProductResolverIndexHelper.cc:142
edm::Principal::processHistory
ProcessHistory const & processHistory() const
Definition: Principal.h:139
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::DelayedReader::mergeReaders
void mergeReaders(DelayedReader *other)
Definition: DelayedReader.h:36
edm::Principal::getProductResolverByIndex
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:535
edm::Principal::addParentProcessProduct
void addParentProcessProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:368
edm::Principal::addScheduledProduct
void addScheduledProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:326
edm::makeHandleExceptionFactory
std::shared_ptr< HandleExceptionFactory > makeHandleExceptionFactory(T &&iFunctor)
Definition: FunctorHandleExceptionFactory.h:45
edm::errors::ProductNotFound
Definition: EDMException.h:33
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
edm::ProductResolverIndexHelper::lookupProcessNames
std::vector< std::string > const & lookupProcessNames() const
Definition: ProductResolverIndexHelper.cc:412
compare.hist
hist
Definition: compare.py:376
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
edm::Principal::reader
DelayedReader * reader() const
Definition: Principal.h:185
TrackValidation_cff.task
task
Definition: TrackValidation_cff.py:252
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
edm::Principal::branchType
BranchType const & branchType() const
Definition: Principal.h:179
edm::Principal::processHistoryIDBeforeConfig_
ProcessHistoryID processHistoryIDBeforeConfig_
Definition: Principal.h:265
L1TObjectsTimingClient_cff.resolution
resolution
Definition: L1TObjectsTimingClient_cff.py:52
edm::errors::InsertFailure
Definition: EDMException.h:35
edm::Principal::getProductResolver
ConstProductResolverPtr getProductResolver(BranchID const &oid) const
Definition: Principal.cc:527
trackingPlots.other
other
Definition: trackingPlots.py:1465
edm::InEvent
Definition: BranchType.h:11
dqmdumpme.k
k
Definition: dqmdumpme.py:60
edm::ProcessConfiguration::processName
std::string const & processName() const
Definition: ProcessConfiguration.h:24
edm::Principal::productRegistry
ProductRegistry const & productRegistry() const
Definition: Principal.h:145
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Principal::reader_
DelayedReader * reader_
Definition: Principal.h:282
edm::Principal::productLookup
ProductResolverIndexHelper const & productLookup() const
Definition: Principal.h:147
edm::get_underlying_safe
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:40
edm::makeNotFoundException
static std::shared_ptr< cms::Exception > makeNotFoundException(char const *where, KindOfType kindOfType, TypeID const &productType, std::string const &label, std::string const &instance, std::string const &process)
Definition: Principal.cc:52
edm::BasicHandle::makeInvalid
static BasicHandle makeInvalid()
Definition: BasicHandle.h:93
edm::ProductRegistry::ProductList
std::map< BranchKey, BranchDescription > ProductList
Definition: ProductRegistry.h:36
edm::Principal::processHistoryPtr_
std::shared_ptr< ProcessHistory const > processHistoryPtr_
Definition: Principal.h:262
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
edm::Principal::processConfiguration_
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:267
edm::ProductResolverIndexInvalid
Definition: ProductResolverIndex.h:16
edm::Principal::addSwitchAliasProduct
void addSwitchAliasProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:360
edm::Principal::getExistingProduct
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:474
edm::Principal::branchType_
BranchType branchType_
Definition: Principal.h:284
edm::ProductResolverBase::resetBranchDescription
void resetBranchDescription(std::shared_ptr< BranchDescription const > bd)
Definition: ProductResolverBase.h:116
edm::Principal::SharedProductPtr
std::shared_ptr< ProductResolverBase > SharedProductPtr
Definition: Principal.h:67
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
edm::ProductResolverIndexAmbiguous
Definition: ProductResolverIndex.h:18
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
edm::Principal::addAliasedProduct
void addAliasedProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:344
edm::Principal::addInputProduct
void addInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:336
edm::Principal::productResolvers_
ProductResolverCollection productResolvers_
Definition: Principal.h:270
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ProductResolverBase::branchDescription
BranchDescription const & branchDescription() const
Definition: ProductResolverBase.h:110
edm::throwAmbiguousException
static void throwAmbiguousException(const char *where, TypeID const &productType, std::string const &label, std::string const &instance, std::string const &process)
Definition: Principal.cc:76
edm::nextIdentifier
static Principal::CacheIdentifier_t nextIdentifier()
Definition: Principal.cc:117
edm::Principal::size
size_t size() const
Definition: Principal.cc:298
Exception
Definition: hltDiff.cc:246
edm::Principal::productLookup_
std::shared_ptr< ProductResolverIndexHelper const > productLookup_
Definition: Principal.h:275
edm::Principal::addProduct_
void addProduct_(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:502
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::Principal::processHistoryID_
ProcessHistoryID processHistoryID_
Definition: Principal.h:264
OfflineOutput_cfi.consumer
consumer
Definition: OfflineOutput_cfi.py:3
patCandidatesForDimuonsSequences_cff.matches
matches
Definition: patCandidatesForDimuonsSequences_cff.py:131
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::Principal::applyToResolvers
void applyToResolvers(F iFunc)
Definition: Principal.h:213
edm::Principal::changedIndexes_
virtual void changedIndexes_()
Definition: Principal.h:221
edm::Principal::addSourceProduct
void addSourceProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:331
mps_fire.result
result
Definition: mps_fire.py:303
edm::Principal::putOrMerge
void putOrMerge(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: Principal.cc:872
edm::Principal::findProductByLabel
ProductData const * findProductByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumer, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:706
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::throwProductNotFoundException
static void throwProductNotFoundException(char const *where, errors::ErrorCodes error, BranchID const &bid)
Definition: Principal.cc:47
SimL1EmulatorRepack_Full_cff.inputTag
inputTag
Definition: SimL1EmulatorRepack_Full_cff.py:56
edm::Principal::addProductOrThrow
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:515
edm::Principal::cacheIdentifier_
CacheIdentifier_t cacheIdentifier_
Definition: Principal.h:291
edm::Principal::lookupProcessOrder_
std::vector< unsigned int > lookupProcessOrder_
Definition: Principal.h:277
edm::Principal::historyAppender_
edm::propagate_const< HistoryAppender * > historyAppender_
Definition: Principal.h:289
edm::Principal::addUnscheduledProduct
void addUnscheduledProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:340
label
const char * label
Definition: PFTauDecayModeTools.cc:11
edm::Principal::orderProcessHistoryID_
ProcessHistoryID orderProcessHistoryID_
Definition: Principal.h:278
edm::s_emptyProcessHistory
static const ProcessHistory s_emptyProcessHistory
Definition: Principal.cc:33
edm::EDProductGetter::EDProductGetter
EDProductGetter()
Definition: EDProductGetter.cc:32
edm::Principal::preg_
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:274
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316