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::ProcessBlockPrincipal 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)
 
const_iterator begin () const
 
iterator begin ()
 
BranchType const & branchType () const
 
CacheIdentifier_t cacheIdentifier () const
 
void clearPrincipal ()
 
void deleteProduct (BranchID const &id) const
 
const_iterator end () const
 
iterator end ()
 
void fillPrincipal (DelayedReader *reader)
 
void fillPrincipal (ProcessHistoryID const &hist, ProcessHistory const *phr, DelayedReader *reader)
 
void fillPrincipal (std::string const &processNameOfBlock, 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
 
ProductResolverBasegetModifiableProductResolver (BranchID const &oid)
 
ConstProductResolverPtr getProductResolver (BranchID const &oid) const
 
ConstProductResolverPtr getProductResolverByIndex (ProductResolverIndex const &oid) const noexcept
 
Provenance const & getProvenance (BranchID const &bid) const
 
StableProvenance const & getStableProvenance (BranchID const &bid) const
 
std::vector< unsigned int > const & lookupProcessOrder () const noexcept
 
void prefetchAsync (WaitingTaskHolder 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)
 
virtual unsigned int processBlockIndex (std::string const &processName) const
 
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 put_ (BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
 

Private Member Functions

void addAliasedProduct (std::shared_ptr< BranchDescription const > bd)
 
void addDelayedReaderInputProduct (std::shared_ptr< BranchDescription const > bd)
 
void addParentProcessProduct (std::shared_ptr< BranchDescription const > bd)
 
void addPutOnReadInputProduct (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 addTransformProduct (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
 
WrapperBase const * getIt (ProductID const &) const override
 
OptionalThinnedKey getThinnedKeyFrom (ProductID const &parent, unsigned int key, ProductID const &thinned) const override
 
std::optional< std::tuple< WrapperBase const *, unsigned int > > getThinnedProduct (ProductID const &, unsigned int) const override
 
void getThinnedProducts (ProductID const &, std::vector< WrapperBase const *> &, std::vector< unsigned int > &) const override
 
void put_ (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 56 of file Principal.h.

Member Typedef Documentation

◆ BasicHandleVec

Definition at line 63 of file Principal.h.

◆ CacheIdentifier_t

typedef unsigned long edm::Principal::CacheIdentifier_t

Definition at line 178 of file Principal.h.

◆ const_iterator

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

Definition at line 59 of file Principal.h.

◆ ConstProductResolverPtr

Definition at line 62 of file Principal.h.

◆ iterator

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

Definition at line 60 of file Principal.h.

◆ ProcessName

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

Definition at line 67 of file Principal.h.

◆ ProcessNameConstIterator

Definition at line 61 of file Principal.h.

◆ ProductResolverCollection

Definition at line 58 of file Principal.h.

◆ SharedProductPtr

Definition at line 66 of file Principal.h.

◆ size_type

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

Definition at line 64 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 118 of file Principal.cc.

References addAliasedProduct(), addDelayedReaderInputProduct(), addParentProcessProduct(), addPutOnReadInputProduct(), addScheduledProduct(), addSourceProduct(), addSwitchAliasProduct(), addSwitchProducerProduct(), addTransformProduct(), 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(), edm::BranchDescription::isTransform(), dqmiolumiharvest::j, dqmdumpme::k, parT::kEnd, 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.

124  : EDProductGetter(),
130  preg_(reg),
133  reader_(),
134  branchType_(bt),
135  historyAppender_(historyAppender),
137  productResolvers_.resize(reg->getNextIndexValue(bt));
138  //Now that these have been set, we can create the list of Branches we need.
139  std::string const source("source");
140  ProductRegistry::ProductList const& prodsList = reg->productList();
141  // The constructor of an alias product holder takes as an argument the product holder for which it is an alias.
142  // So, the non-alias product holders must be created first.
143  // Therefore, on this first pass, skip current EDAliases.
144  bool hasAliases = false;
145  bool hasSwitchAliases = false;
146  for (auto const& prod : prodsList) {
147  BranchDescription const& bd = prod.second;
148  if (bd.branchType() == branchType_) {
149  if (isForPrimaryProcess or bd.processName() == pc.processName()) {
150  if (bd.isAlias()) {
151  hasAliases = true;
152  } else if (bd.isSwitchAlias()) {
153  hasSwitchAliases = true;
154  } else {
155  auto cbd = std::make_shared<BranchDescription const>(bd);
156  if (bd.produced()) {
157  if (bd.moduleLabel() == source) {
158  addSourceProduct(cbd);
159  } else if (bd.onDemand()) {
161  if (bd.isTransform()) {
162  addTransformProduct(cbd);
163  } else {
165  }
166  } else {
167  addScheduledProduct(cbd);
168  }
169  } else {
170  if (bd.onDemand()) {
172  } else {
174  }
175  }
176  }
177  } else {
178  //We are in a SubProcess and this branch is from the parent
179  auto cbd = std::make_shared<BranchDescription const>(bd);
181  }
182  }
183  }
184  // Now process any EDAliases
185  if (hasAliases) {
186  for (auto const& prod : prodsList) {
187  BranchDescription const& bd = prod.second;
188  if (bd.isAlias() && bd.branchType() == branchType_) {
189  addAliasedProduct(std::make_shared<BranchDescription const>(bd));
190  }
191  }
192  }
193  // Finally process any SwitchProducer aliases
194  if (hasSwitchAliases) {
195  for (auto const& prod : prodsList) {
196  BranchDescription const& bd = prod.second;
197  if (bd.isSwitchAlias() && bd.branchType() == branchType_) {
199  auto cbd = std::make_shared<BranchDescription const>(bd);
200  // Need different implementation for SwitchProducers not
201  // in any Path (onDemand) and for those in a Path in order
202  // to prevent the switch-aliased-for EDProducers from
203  // being run when the SwitchProducer is in a Path after a
204  // failing EDFilter.
205  if (bd.onDemand()) {
207  } else {
209  }
210  }
211  }
212  }
213 
214  // Now create the ProductResolvers that search in reverse process
215  // order and are used for queries where the process name is the
216  // empty string
217  std::vector<std::string> const& lookupProcessNames = productLookup_->lookupProcessNames();
218  std::vector<ProductResolverIndex> matchingHolders(lookupProcessNames.size(), ProductResolverIndexInvalid);
219  std::vector<bool> ambiguous(lookupProcessNames.size(), false);
220  unsigned int beginElements = productLookup_->beginElements();
221  std::vector<TypeID> const& sortedTypeIDs = productLookup_->sortedTypeIDs();
222  std::vector<ProductResolverIndexHelper::Range> const& ranges = productLookup_->ranges();
223  std::vector<ProductResolverIndexHelper::IndexAndNames> const& indexAndNames = productLookup_->indexAndNames();
224  std::vector<char> const& processNamesCharArray = productLookup_->processNames();
225 
226  unsigned int numberOfMatches = 0;
228  if (!sortedTypeIDs.empty()) {
229  ProductResolverIndex productResolverIndex = ProductResolverIndexInvalid;
230  for (unsigned int k = 0, kEnd = sortedTypeIDs.size(); k < kEnd; ++k) {
232  for (unsigned int i = range.begin(); i < range.end(); ++i) {
233  ProductResolverIndexHelper::IndexAndNames const& product = indexAndNames.at(i);
234  if (product.startInProcessNames() == 0) {
235  if (productResolverIndex != ProductResolverIndexInvalid) {
236  if ((numberOfMatches == 1) and (lastMatchIndex != ProductResolverIndexAmbiguous)) {
237  //only one choice so use a special resolver
238  productResolvers_.at(productResolverIndex) =
239  std::make_shared<SingleChoiceNoProcessProductResolver>(lastMatchIndex);
240  } else {
241  bool productMadeAtEnd = false;
242  //Need to know if the product from this processes is added at end of transition
243  for (unsigned int j = 0; j < matchingHolders.size(); ++j) {
244  if ((not ambiguous[j]) and ProductResolverIndexInvalid != matchingHolders[j] and
245  productResolvers_[matchingHolders[j]]->branchDescription().availableOnlyAtEndTransition()) {
246  productMadeAtEnd = true;
247  break;
248  }
249  }
250  std::shared_ptr<ProductResolverBase> newHolder =
251  std::make_shared<NoProcessProductResolver>(matchingHolders, ambiguous, productMadeAtEnd);
252  productResolvers_.at(productResolverIndex) = newHolder;
253  }
254  matchingHolders.assign(lookupProcessNames.size(), ProductResolverIndexInvalid);
255  ambiguous.assign(lookupProcessNames.size(), false);
256  numberOfMatches = 0;
257  lastMatchIndex = ProductResolverIndexInvalid;
258  }
259  productResolverIndex = product.index();
260  } else {
261  std::string process(&processNamesCharArray.at(product.startInProcessNames()));
262  auto iter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), process);
263  assert(iter != lookupProcessNames.end());
264  ProductResolverIndex iMatchingIndex = product.index();
265  lastMatchIndex = iMatchingIndex;
266  assert(iMatchingIndex != ProductResolverIndexInvalid);
267  ++numberOfMatches;
268  if (iMatchingIndex == ProductResolverIndexAmbiguous) {
269  assert(k >= beginElements);
270  ambiguous.at(iter - lookupProcessNames.begin()) = true;
271  } else {
272  matchingHolders.at(iter - lookupProcessNames.begin()) = iMatchingIndex;
273  }
274  }
275  }
276  }
277  //Need to know if the product from this processes is added at end of transition
278  if ((numberOfMatches == 1) and (lastMatchIndex != ProductResolverIndexAmbiguous)) {
279  //only one choice so use a special resolver
280  productResolvers_.at(productResolverIndex) =
281  std::make_shared<SingleChoiceNoProcessProductResolver>(lastMatchIndex);
282  } else {
283  bool productMadeAtEnd = false;
284  for (unsigned int i = 0; i < matchingHolders.size(); ++i) {
285  if ((not ambiguous[i]) and ProductResolverIndexInvalid != matchingHolders[i] and
286  productResolvers_[matchingHolders[i]]->branchDescription().availableOnlyAtEndTransition()) {
287  productMadeAtEnd = true;
288  break;
289  }
290  }
291  std::shared_ptr<ProductResolverBase> newHolder =
292  std::make_shared<NoProcessProductResolver>(matchingHolders, ambiguous, productMadeAtEnd);
293  productResolvers_.at(productResolverIndex) = newHolder;
294  }
295  }
296  }
BranchType branchType_
Definition: Principal.h:282
DelayedReader * reader_
Definition: Principal.h:280
ProcessHistoryID processHistoryIDBeforeConfig_
Definition: Principal.h:263
unsigned int ProductResolverIndex
static std::string const source("source")
ProductResolverCollection productResolvers_
Definition: Principal.h:268
std::shared_ptr< ProcessHistory const > processHistoryPtr_
Definition: Principal.h:260
PixelRecoRange< float > Range
std::map< BranchKey, BranchDescription > ProductList
static Principal::CacheIdentifier_t nextIdentifier()
Definition: Principal.cc:114
ProcessHistoryID processHistoryID_
Definition: Principal.h:262
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
edm::propagate_const< HistoryAppender * > historyAppender_
Definition: Principal.h:287
void addUnscheduledProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:349
void addAliasedProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:357
std::vector< unsigned int > lookupProcessOrder_
Definition: Principal.h:275
std::shared_ptr< ProductResolverIndexHelper const > productLookup_
Definition: Principal.h:273
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:272
CacheIdentifier_t cacheIdentifier_
Definition: Principal.h:289
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
void addSourceProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:336
void addPutOnReadInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:345
void addDelayedReaderInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:341
string ranges
Definition: diffTwoXMLs.py:79
void addParentProcessProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:381
void addScheduledProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:331
void addSwitchProducerProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:365
std::vector< std::string > const & lookupProcessNames() const
ProductResolverIndexHelper const & productLookup() const
Definition: Principal.h:142
void addTransformProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:353
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:265
void addSwitchAliasProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:373

◆ ~Principal()

edm::Principal::~Principal ( )
override

Definition at line 298 of file Principal.cc.

298 {}

Member Function Documentation

◆ addAliasedProduct()

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

Definition at line 357 of file Principal.cc.

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

Referenced by Principal().

357  {
358  ProductResolverIndex index = preg_->indexFrom(bd->originalBranchID());
360 
361  addProductOrThrow(std::make_unique<AliasProductResolver>(
362  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
363  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:268
assert(be >=bs)
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:546
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:272
def move(src, dest)
Definition: eostools.py:511

◆ addDelayedReaderInputProduct()

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

Definition at line 341 of file Principal.cc.

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

Referenced by adjustIndexesAfterProductRegistryAddition(), and Principal().

341  {
342  addProductOrThrow(std::make_unique<DelayedReaderInputProductResolver>(std::move(bd)));
343  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:546
def move(src, dest)
Definition: eostools.py:511

◆ addParentProcessProduct()

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

Definition at line 381 of file Principal.cc.

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

Referenced by Principal().

381  {
382  addProductOrThrow(std::make_unique<ParentProcessProductResolver>(std::move(bd)));
383  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:546
def move(src, dest)
Definition: eostools.py:511

◆ addProduct_()

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

Definition at line 533 of file Principal.cc.

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().

533  {
534  BranchDescription const& bd = productResolver->branchDescription();
535  assert(!bd.className().empty());
536  assert(!bd.friendlyClassName().empty());
537  assert(!bd.moduleLabel().empty());
538  assert(!bd.processName().empty());
539  SharedProductPtr phb(productResolver.release());
540 
541  ProductResolverIndex index = preg_->indexFrom(bd.branchID());
543  productResolvers_[index] = phb;
544  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:268
std::shared_ptr< ProductResolverBase > SharedProductPtr
Definition: Principal.h:66
assert(be >=bs)
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:272

◆ addProductOrThrow()

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

Definition at line 546 of file Principal.cc.

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(), addDelayedReaderInputProduct(), addParentProcessProduct(), addPutOnReadInputProduct(), addScheduledProduct(), addSourceProduct(), addSwitchAliasProduct(), addSwitchProducerProduct(), addTransformProduct(), and addUnscheduledProduct().

546  {
547  ProductResolverBase const* phb = getExistingProduct(*productResolver);
548  if (phb != nullptr) {
549  BranchDescription const& bd = productResolver->branchDescription();
550  throw Exception(errors::InsertFailure, "AlreadyPresent")
551  << "addProductOrThrow: Problem found while adding product, "
552  << "product already exists for (" << bd.friendlyClassName() << "," << bd.moduleLabel() << ","
553  << bd.productInstanceName() << "," << bd.processName() << ")\n";
554  }
555  addProduct_(std::move(productResolver));
556  }
void addProduct_(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:533
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:505
def move(src, dest)
Definition: eostools.py:511

◆ addPutOnReadInputProduct()

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

Definition at line 345 of file Principal.cc.

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

Referenced by adjustIndexesAfterProductRegistryAddition(), and Principal().

345  {
346  addProductOrThrow(std::make_unique<PutOnReadInputProductResolver>(std::move(bd)));
347  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:546
def move(src, dest)
Definition: eostools.py:511

◆ addScheduledProduct()

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

Definition at line 331 of file Principal.cc.

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

Referenced by Principal().

331  {
332  auto phb = std::make_unique<PuttableProductResolver>(std::move(bd));
334  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:546
def move(src, dest)
Definition: eostools.py:511

◆ addSourceProduct()

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

Definition at line 336 of file Principal.cc.

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

Referenced by Principal().

336  {
337  auto phb = std::make_unique<PuttableProductResolver>(std::move(bd));
339  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:546
def move(src, dest)
Definition: eostools.py:511

◆ addSwitchAliasProduct()

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

Definition at line 373 of file Principal.cc.

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

Referenced by Principal().

373  {
374  ProductResolverIndex index = preg_->indexFrom(bd->switchAliasForBranchID());
376 
377  addProductOrThrow(std::make_unique<SwitchAliasProductResolver>(
378  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
379  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:268
assert(be >=bs)
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:546
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:272
def move(src, dest)
Definition: eostools.py:511

◆ addSwitchProducerProduct()

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

Definition at line 365 of file Principal.cc.

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

Referenced by Principal().

365  {
366  ProductResolverIndex index = preg_->indexFrom(bd->switchAliasForBranchID());
368 
369  addProductOrThrow(std::make_unique<SwitchProducerProductResolver>(
370  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
371  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:268
assert(be >=bs)
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:546
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:272
def move(src, dest)
Definition: eostools.py:511

◆ addTransformProduct()

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

Definition at line 353 of file Principal.cc.

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

Referenced by Principal().

353  {
354  addProductOrThrow(std::make_unique<TransformingProductResolver>(std::move(bd)));
355  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:546
def move(src, dest)
Definition: eostools.py:511

◆ addUnscheduledProduct()

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

Definition at line 349 of file Principal.cc.

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

Referenced by Principal().

349  {
350  addProductOrThrow(std::make_unique<UnscheduledProductResolver>(std::move(bd)));
351  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:546
def move(src, dest)
Definition: eostools.py:511

◆ adjustIndexesAfterProductRegistryAddition()

void edm::Principal::adjustIndexesAfterProductRegistryAddition ( )

Definition at line 877 of file Principal.cc.

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

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

877  {
878  if (preg_->getNextIndexValue(branchType_) != productResolvers_.size()) {
879  bool changed = false;
880  productResolvers_.resize(preg_->getNextIndexValue(branchType_));
881  for (auto const& prod : preg_->productList()) {
882  BranchDescription const& bd = prod.second;
883  if (bd.branchType() == branchType_) {
884  ProductResolverIndex index = preg_->indexFrom(bd.branchID());
886  if (!productResolvers_[index]) {
887  // no product holder. Must add one. The new entry must be an input product holder.
888  assert(!bd.produced());
889  auto cbd = std::make_shared<BranchDescription const>(bd);
890  if (bd.onDemand()) {
892  } else {
894  }
895  changed = true;
896  }
897  }
898  }
899  if (changed) {
900  changedIndexes_();
901  }
902  }
903  assert(preg_->getNextIndexValue(branchType_) == productResolvers_.size());
904  }
BranchType branchType_
Definition: Principal.h:282
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:268
assert(be >=bs)
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:272
virtual void changedIndexes_()
Definition: Principal.h:219
void addPutOnReadInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:345
void addDelayedReaderInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:341

◆ adjustToNewProductRegistry()

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

Definition at line 315 of file Principal.cc.

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

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

315  {
316  ProductRegistry::ProductList const& prodsList = reg.productList();
317  for (auto const& prod : prodsList) {
318  BranchDescription const& bd = prod.second;
319  if (!bd.produced() && (bd.branchType() == branchType_)) {
320  auto cbd = std::make_shared<BranchDescription const>(bd);
321  auto phb = getExistingProduct(cbd->branchID());
322  if (phb == nullptr || phb->branchDescription().branchName() != cbd->branchName()) {
323  return false;
324  }
325  phb->resetBranchDescription(cbd);
326  }
327  }
328  return true;
329  }
BranchType branchType_
Definition: Principal.h:282
std::map< BranchKey, BranchDescription > ProductList
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:505
void resetBranchDescription(std::shared_ptr< BranchDescription const > bd)

◆ applyToResolvers()

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

Definition at line 211 of file Principal.h.

References productResolvers_.

Referenced by setupUnscheduled().

211  {
212  for (auto& resolver : productResolvers_) {
213  iFunc(resolver.get());
214  }
215  }
ProductResolverCollection productResolvers_
Definition: Principal.h:268

◆ begin() [1/2]

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

Definition at line 154 of file Principal.h.

References productResolvers_.

154  {
155  return boost::make_filter_iterator<FilledProductPtr>(productResolvers_.begin(), productResolvers_.end());
156  }
ProductResolverCollection productResolvers_
Definition: Principal.h:268

◆ begin() [2/2]

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

Definition at line 161 of file Principal.h.

References productResolvers_.

161  {
162  return boost::make_filter_iterator<FilledProductPtr>(productResolvers_.begin(), productResolvers_.end());
163  }
ProductResolverCollection productResolvers_
Definition: Principal.h:268

◆ 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 219 of file Principal.h.

Referenced by adjustIndexesAfterProductRegistryAddition().

219 {}

◆ clearPrincipal()

void edm::Principal::clearPrincipal ( )

Definition at line 386 of file Principal.cc.

References dumpMFGeometry_cfg::prod, and reader_.

Referenced by edm::EventPrincipal::clearEventPrincipal(), edm::SubProcess::clearProcessBlockPrincipal(), edm::SubProcess::doEndProcessBlockAsync(), edm::EventProcessor::endProcessBlock(), edm::EventProcessor::inputProcessBlocks(), edm::test::TestSourceProcessor::openFile(), and edm::PoolSource::readEvent_().

386  {
387  //We do not clear the product history information
388  // because it rarely changes and recalculating takes
389  // time.
390  reader_ = nullptr;
391  for (auto& prod : *this) {
392  prod->resetProductData();
393  }
394  }
DelayedReader * reader_
Definition: Principal.h:280

◆ deleteProduct()

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

Definition at line 396 of file Principal.cc.

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

396  {
397  auto phb = getExistingProduct(id);
398  assert(nullptr != phb);
399  phb->unsafe_deleteProduct();
400  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:505
assert(be >=bs)

◆ end() [1/2]

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

Definition at line 157 of file Principal.h.

References productResolvers_.

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

157  {
158  return boost::make_filter_iterator<FilledProductPtr>(productResolvers_.end(), productResolvers_.end());
159  }
ProductResolverCollection productResolvers_
Definition: Principal.h:268

◆ end() [2/2]

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

Definition at line 164 of file Principal.h.

References productResolvers_.

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

164  {
165  return boost::make_filter_iterator<FilledProductPtr>(productResolvers_.end(), productResolvers_.end());
166  }
ProductResolverCollection productResolvers_
Definition: Principal.h:268

◆ fillPrincipal() [1/3]

void edm::Principal::fillPrincipal ( DelayedReader reader)

Definition at line 406 of file Principal.cc.

References cacheIdentifier_, edm::nextIdentifier(), reader(), and reader_.

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

406  {
407  //increment identifier here since clearPrincipal isn't called for Run/Lumi
409  if (reader) {
410  reader_ = reader;
411  }
412  }
DelayedReader * reader_
Definition: Principal.h:280
static Principal::CacheIdentifier_t nextIdentifier()
Definition: Principal.cc:114
CacheIdentifier_t cacheIdentifier_
Definition: Principal.h:289
DelayedReader * reader() const
Definition: Principal.h:181

◆ fillPrincipal() [2/3]

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

Definition at line 415 of file Principal.cc.

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

417  {
419 
420  if (historyAppender_ && productRegistry().anyProductProduced()) {
425  }
426  } else {
427  std::shared_ptr<ProcessHistory const> inputProcessHistory;
429  if (hist.isValid()) {
430  //does not own the pointer
431  auto noDel = [](void const*) {};
432  inputProcessHistory = std::shared_ptr<ProcessHistory const>(processHistory, noDel);
433  if (inputProcessHistory.get() == nullptr) {
434  throw Exception(errors::LogicError) << "Principal::fillPrincipal\n"
435  << "Input ProcessHistory not found in registry\n"
436  << "Contact a Framework developer\n";
437  }
438  } else {
439  //Since this is static we don't want it deleted
440  inputProcessHistory = std::shared_ptr<ProcessHistory const>(&s_emptyProcessHistory, [](void const*) {});
441  //no need to do any ordering since it is empty
443  }
445  processHistoryPtr_ = inputProcessHistory;
447  }
448  }
449 
451  std::vector<std::string> const& lookupProcessNames = productLookup_->lookupProcessNames();
452  lookupProcessOrder_.assign(lookupProcessNames.size(), 0);
453  unsigned int k = 0;
454 
455  // We loop over processes in reverse order of the ProcessHistory.
456  // If any entries in the product lookup tables are associated with
457  // the process we add it to the vector of processes in the order
458  // the lookup should be performed. There is one exception though,
459  // We start with the current process even if it is not in the ProcessHistory.
460  // The current process might be needed but not be in the process
461  // history if all the products produced in the current process are
462  // transient.
463  {
464  auto nameIterCurrentProcess =
465  std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processConfiguration_->processName());
466  if (nameIterCurrentProcess != lookupProcessNames.end()) {
467  lookupProcessOrder_.at(k) = nameIterCurrentProcess - lookupProcessNames.begin();
468  ++k;
469  }
470  }
471 
472  // We just looked for the current process so skip it if
473  // it is in the ProcessHistory.
474  auto iter = processHistoryPtr_->rbegin();
475  if (iter->processName() == processConfiguration_->processName()) {
476  ++iter;
477  }
478 
479  for (auto iEnd = processHistoryPtr_->rend(); iter != iEnd; ++iter) {
480  auto nameIter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), iter->processName());
481  if (nameIter == lookupProcessNames.end()) {
482  continue;
483  }
484  lookupProcessOrder_.at(k) = nameIter - lookupProcessNames.begin();
485  ++k;
486  }
488  }
489  }
void fillPrincipal(DelayedReader *reader)
Definition: Principal.cc:406
static ProcessHistory const s_emptyProcessHistory
Definition: Principal.cc:37
ProcessHistoryID processHistoryIDBeforeConfig_
Definition: Principal.h:263
std::shared_ptr< ProcessHistory const > processHistoryPtr_
Definition: Principal.h:260
ProductRegistry const & productRegistry() const
Definition: Principal.h:140
ProcessHistoryID processHistoryID_
Definition: Principal.h:262
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::propagate_const< HistoryAppender * > historyAppender_
Definition: Principal.h:287
std::vector< unsigned int > lookupProcessOrder_
Definition: Principal.h:275
std::shared_ptr< ProductResolverIndexHelper const > productLookup_
Definition: Principal.h:273
ProcessHistoryID orderProcessHistoryID_
Definition: Principal.h:276
ProcessHistory const & processHistory() const
Definition: Principal.h:134
std::string const & processName() const
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:265
DelayedReader * reader() const
Definition: Principal.h:181

◆ fillPrincipal() [3/3]

void edm::Principal::fillPrincipal ( std::string const &  processNameOfBlock,
DelayedReader reader 
)

Definition at line 492 of file Principal.cc.

References fillPrincipal(), spr::find(), lookupProcessOrder_, productLookup_, and reader().

492  {
494 
495  std::vector<std::string> const& lookupProcessNames = productLookup_->lookupProcessNames();
496  lookupProcessOrder_.assign(lookupProcessNames.size(), 0);
497  if (!lookupProcessOrder_.empty()) {
498  auto iter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processNameOfBlock);
499  if (iter != lookupProcessNames.end()) {
500  lookupProcessOrder_[0] = iter - lookupProcessNames.begin();
501  }
502  }
503  }
void fillPrincipal(DelayedReader *reader)
Definition: Principal.cc:406
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< unsigned int > lookupProcessOrder_
Definition: Principal.h:275
std::shared_ptr< ProductResolverIndexHelper const > productLookup_
Definition: Principal.h:273
DelayedReader * reader() const
Definition: Principal.h:181

◆ 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 654 of file Principal.cc.

References edm::appendCurrentProcessIfAlias(), branchType(), OfflineOutput_cfi::consumer, edm::ProductResolverIndexHelper::index(), SimL1EmulatorRepack_Full_cff::inputTag, B2GTnPMonitor_cfi::item, edm::InputTag::kCurrentProcess, or, preg_, 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().

659  {
660  bool skipCurrentProcess = inputTag.willSkipCurrentProcess();
661 
663 
665  char const* processName = inputTag.process().c_str();
666  if (skipCurrentProcess) {
667  processName = "\0";
668  } else if (inputTag.process() == InputTag::kCurrentProcess) {
670  }
671 
672  index =
673  productLookup().index(kindOfType, typeID, inputTag.label().c_str(), inputTag.instance().c_str(), processName);
674 
676  throwAmbiguousException("findProductByLabel",
677  typeID,
678  inputTag.label(),
679  inputTag.instance(),
681  } else if (index == ProductResolverIndexInvalid) {
682  // can occur because of missing consumes if nothing else in the process consumes the product
683  for (auto const& item : preg_->productList()) {
684  auto const& bd = item.second;
685  if (bd.present() and bd.unwrappedTypeID() == typeID and bd.moduleLabel() == inputTag.label() and
686  bd.productInstanceName() == inputTag.instance()) {
687  bool const inCurrentProcess = bd.processName() == processConfiguration_->processName();
688  if (inputTag.process().empty() or bd.processName() == inputTag.process() or
689  (skipCurrentProcess and not inCurrentProcess) or
690  (inputTag.process() == InputTag::kCurrentProcess and inCurrentProcess)) {
691  failedToRegisterConsumes(
692  kindOfType,
693  typeID,
694  inputTag.label(),
695  inputTag.instance(),
697  }
698  }
699  }
700  return nullptr;
701  }
702  inputTag.tryToCacheIndex(index, typeID, branchType(), &productRegistry());
703  }
704  if (UNLIKELY(consumer and (not consumer->registeredToConsume(index, skipCurrentProcess, branchType())))) {
705  failedToRegisterConsumes(kindOfType,
706  typeID,
707  inputTag.label(),
708  inputTag.instance(),
710  }
711 
712  auto const& productResolver = productResolvers_[index];
713 
714  auto resolution = productResolver->resolveProduct(*this, skipCurrentProcess, sra, mcc);
715  if (resolution.isAmbiguous()) {
716  throwAmbiguousException("findProductByLabel",
717  typeID,
718  inputTag.label(),
719  inputTag.instance(),
721  }
722  return resolution.data();
723  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:268
ProductRegistry const & productRegistry() const
Definition: Principal.h:140
static void throwAmbiguousException(const char *where, TypeID const &productType, std::string const &label, std::string const &instance, std::string const &process)
Definition: Principal.cc:80
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:272
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=nullptr) const
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
static const std::string kCurrentProcess
Definition: InputTag.h:54
std::string const & processName() const
ProductResolverIndexHelper const & productLookup() const
Definition: Principal.h:142
#define UNLIKELY(x)
Definition: Likely.h:21
static std::string appendCurrentProcessIfAlias(std::string const &processFromInputTag, std::string const &currentProcess)
Definition: Principal.cc:39
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:265
BranchType const & branchType() const
Definition: Principal.h:175

◆ 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 725 of file Principal.cc.

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

732  {
734  productLookup().index(kindOfType, typeID, label.c_str(), instance.c_str(), process.c_str());
735 
737  throwAmbiguousException("findProductByLabel", typeID, label, instance, process);
738  } else if (index == ProductResolverIndexInvalid) {
739  // can occur because of missing consumes if nothing else in the process consumes the product
740  for (auto const& item : preg_->productList()) {
741  auto const& bd = item.second;
742  if (bd.present() and bd.unwrappedTypeID() == typeID and bd.moduleLabel() == label and
743  bd.productInstanceName() == instance) {
744  if (process.empty() or bd.processName() == process) {
745  failedToRegisterConsumes(kindOfType, typeID, label, instance, process);
746  }
747  }
748  }
749  return nullptr;
750  }
751 
752  if (UNLIKELY(consumer and (not consumer->registeredToConsume(index, false, branchType())))) {
753  failedToRegisterConsumes(kindOfType, typeID, label, instance, process);
754  }
755 
756  auto const& productResolver = productResolvers_[index];
757 
758  auto resolution = productResolver->resolveProduct(*this, false, sra, mcc);
759  if (resolution.isAmbiguous()) {
760  throwAmbiguousException("findProductByLabel", typeID, label, instance, process);
761  }
762  return resolution.data();
763  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:268
static PFTauRenderPlugin instance
static void throwAmbiguousException(const char *where, TypeID const &productType, std::string const &label, std::string const &instance, std::string const &process)
Definition: Principal.cc:80
char const * label
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:272
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=nullptr) const
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
ProductResolverIndexHelper const & productLookup() const
Definition: Principal.h:142
#define UNLIKELY(x)
Definition: Likely.h:21
BranchType const & branchType() const
Definition: Principal.h:175

◆ findProductByTag()

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

Definition at line 765 of file Principal.cc.

References cms::cuda::assert(), branchType_, findProductByLabel(), edm::InProcess, edm::PRODUCT_TYPE, and makeGlobalPositionRcd_cfg::tag.

767  {
768  // Not implemented for ProcessBlocks
770 
771  ProductData const* productData = findProductByLabel(PRODUCT_TYPE, typeID, tag, nullptr, nullptr, mcc);
772  return productData;
773  }
BranchType branchType_
Definition: Principal.h:282
assert(be >=bs)
ProductData const * findProductByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumer, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:654

◆ getAllProvenance()

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

Definition at line 800 of file Principal.cc.

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

800  {
801  provenances.clear();
802  for (auto const& productResolver : *this) {
803  if (productResolver->singleProduct() && productResolver->provenanceAvailable() &&
804  !productResolver->branchDescription().isAnyAlias()) {
805  // We do not attempt to get the event/lumi/run status from the provenance,
806  // because the per event provenance may have been dropped.
807  if (productResolver->provenance()->branchDescription().present()) {
808  provenances.push_back(productResolver->provenance());
809  }
810  }
811  }
812  }

◆ getAllStableProvenance()

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

Definition at line 817 of file Principal.cc.

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

817  {
818  provenances.clear();
819  for (auto const& productResolver : *this) {
820  if (productResolver->singleProduct() && !productResolver->branchDescription().isAnyAlias()) {
821  if (productResolver->stableProvenance()->branchDescription().present()) {
822  provenances.push_back(productResolver->stableProvenance());
823  }
824  }
825  }
826  }

◆ 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 576 of file Principal.cc.

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

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

581  {
582  // Not implemented for ProcessBlocks, it might work though, not tested
583  // The other getByLabel function is used for ProcessBlocks by TestProcessor
585 
586  ProductData const* result = findProductByLabel(kindOfType, typeID, inputTag, consumer, sra, mcc);
587  if (result == nullptr) {
588  return BasicHandle(makeHandleExceptionFactory([=, this]() -> std::shared_ptr<cms::Exception> {
589  return makeNotFoundException(
590  "getByLabel",
591  kindOfType,
592  typeID,
593  inputTag.label(),
594  inputTag.instance(),
596  }));
597  }
598  return BasicHandle(result->wrapper(), &(result->provenance()));
599  }
BranchType branchType_
Definition: Principal.h:282
assert(be >=bs)
ProductData const * findProductByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumer, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:654
std::shared_ptr< HandleExceptionFactory > makeHandleExceptionFactory(T &&iFunctor)
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:56
std::string const & processName() const
static std::string appendCurrentProcessIfAlias(std::string const &processFromInputTag, std::string const &currentProcess)
Definition: Principal.cc:39
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:265

◆ 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 601 of file Principal.cc.

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

608  {
609  ProductData const* result = findProductByLabel(kindOfType, typeID, label, instance, process, consumer, sra, mcc);
610  if (result == nullptr) {
611  return BasicHandle(makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> {
612  return makeNotFoundException("getByLabel", kindOfType, typeID, label, instance, process);
613  }));
614  }
615  return BasicHandle(result->wrapper(), &(result->provenance()));
616  }
static PFTauRenderPlugin instance
ProductData const * findProductByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumer, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:654
char const * label
std::shared_ptr< HandleExceptionFactory > makeHandleExceptionFactory(T &&iFunctor)
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:56

◆ 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 618 of file Principal.cc.

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

Referenced by edm::EventForTransformer::get(), and edm::PrincipalGetAdapter::getByToken_().

624  {
626  auto& productResolver = productResolvers_[index];
627  assert(nullptr != productResolver.get());
628  auto resolution = productResolver->resolveProduct(*this, skipCurrentProcess, sra, mcc);
629  if (resolution.isAmbiguous()) {
630  ambiguous = true;
631  //The caller is looking explicitly for this case
632  // and uses the extra data at the caller to setup the exception
633  return BasicHandle::makeInvalid();
634  }
635  auto productData = resolution.data();
636  if (productData == nullptr) {
637  //The caller is looking explicitly for this case
638  // and uses the extra data at the caller to setup the exception
639  return BasicHandle::makeInvalid();
640  }
641  return BasicHandle(productData->wrapper(), &(productData->provenance()));
642  }
ProductResolverCollection productResolvers_
Definition: Principal.h:268
assert(be >=bs)
static BasicHandle makeInvalid()
Definition: BasicHandle.h:93

◆ getExistingProduct() [1/3]

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

Definition at line 505 of file Principal.cc.

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

505  {
506  return const_cast<ProductResolverBase*>(const_cast<const Principal*>(this)->getExistingProduct(branchID));
507  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:505
Principal(std::shared_ptr< ProductRegistry const > reg, std::shared_ptr< ProductResolverIndexHelper const > productLookup, ProcessConfiguration const &pc, BranchType bt, HistoryAppender *historyAppender, bool isForPrimaryProcess=true)
Definition: Principal.cc:118

◆ getExistingProduct() [2/3]

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

Definition at line 509 of file Principal.cc.

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

509  {
510  ProductResolverIndex index = preg_->indexFrom(branchID);
512  return productResolvers_.at(index).get();
513  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:268
assert(be >=bs)
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:272

◆ getExistingProduct() [3/3]

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

Definition at line 515 of file Principal.cc.

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

515  {
516  auto phb = getExistingProduct(productResolver.branchDescription().branchID());
517  if (nullptr != phb && BranchKey(productResolver.branchDescription()) != BranchKey(phb->branchDescription())) {
518  BranchDescription const& newProduct = phb->branchDescription();
519  BranchDescription const& existing = productResolver.branchDescription();
520  if (newProduct.branchName() != existing.branchName() && newProduct.branchID() == existing.branchID()) {
521  throw cms::Exception("HashCollision")
522  << "Principal::getExistingProduct\n"
523  << " Branch " << newProduct.branchName() << " has same branch ID as branch " << existing.branchName()
524  << "\n"
525  << "Workaround: change process name or product instance name of " << newProduct.branchName() << "\n";
526  } else {
527  assert(nullptr == phb || BranchKey(productResolver.branchDescription()) == BranchKey(phb->branchDescription()));
528  }
529  }
530  return phb;
531  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:505
assert(be >=bs)
BranchDescription const & branchDescription() const

◆ getIt()

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

Implements edm::EDProductGetter.

Definition at line 839 of file Principal.cc.

References cms::cuda::assert().

839  {
840  assert(false);
841  return nullptr;
842  }
assert(be >=bs)

◆ getModifiableProductResolver()

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

Definition at line 147 of file Principal.h.

References getProductResolver().

Referenced by edm::SubProcess::parentProducedProductIsKept(), and edm::SubProcess::propagateProducts().

147  {
148  return const_cast<ProductResolverBase*>(const_cast<const Principal*>(this)->getProductResolver(oid));
149  }
Principal(std::shared_ptr< ProductRegistry const > reg, std::shared_ptr< ProductResolverIndexHelper const > productLookup, ProcessConfiguration const &pc, BranchType bt, HistoryAppender *historyAppender, bool isForPrimaryProcess=true)
Definition: Principal.cc:118
ConstProductResolverPtr getProductResolver(BranchID const &oid) const
Definition: Principal.cc:558

◆ getProductResolver()

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

Definition at line 558 of file Principal.cc.

References getProductResolverByIndex(), preg_, and edm::ProductResolverIndexInvalid.

Referenced by edm::EventPrincipal::getByProductID(), getModifiableProductResolver(), getProvenance(), getStableProvenance(), edm::EventPrincipal::getThinnedAssociation(), edm::SubProcess::parentProducedProductIsKept(), and edm::SubProcess::propagateProducts().

558  {
559  ProductResolverIndex index = preg_->indexFrom(bid);
561  return ConstProductResolverPtr();
562  }
564  }
unsigned int ProductResolverIndex
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const noexcept
Definition: Principal.cc:566
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:272
ProductResolverBase const * ConstProductResolverPtr
Definition: Principal.h:62

◆ getProductResolverByIndex()

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

◆ getProvenance()

Provenance const & edm::Principal::getProvenance ( BranchID const &  bid) const

Definition at line 775 of file Principal.cc.

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

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

775  {
777  if (phb == nullptr) {
779  }
780 
781  if (phb->unscheduledWasNotRun()) {
783  << "Requesting provenance from unrun EDProducer. The requested branch ID was: " << bid;
784  }
785  return *phb->provenance();
786  }
ProductResolverBase const * ConstProductResolverPtr
Definition: Principal.h:62
static void throwProductNotFoundException(char const *where, errors::ErrorCodes error, BranchID const &bid)
Definition: Principal.cc:51
ConstProductResolverPtr getProductResolver(BranchID const &oid) const
Definition: Principal.cc:558

◆ getStableProvenance()

StableProvenance const & edm::Principal::getStableProvenance ( BranchID const &  bid) const

Definition at line 788 of file Principal.cc.

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

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

788  {
790  if (phb == nullptr) {
791  throwProductNotFoundException("getStableProvenance", errors::ProductNotFound, bid);
792  }
793  //NOTE: in all implementations, this never returns a nullptr
794  return *phb->stableProvenance();
795  }
ProductResolverBase const * ConstProductResolverPtr
Definition: Principal.h:62
static void throwProductNotFoundException(char const *where, errors::ErrorCodes error, BranchID const &bid)
Definition: Principal.cc:51
ConstProductResolverPtr getProductResolver(BranchID const &oid) const
Definition: Principal.cc:558

◆ getThinnedKeyFrom()

OptionalThinnedKey edm::Principal::getThinnedKeyFrom ( ProductID const &  parent,
unsigned int  key,
ProductID const &  thinned 
) const
overrideprivatevirtual

Implements edm::EDProductGetter.

Definition at line 856 of file Principal.cc.

References cms::cuda::assert().

856  {
857  assert(false);
858  return std::monostate{};
859  }
assert(be >=bs)

◆ getThinnedProduct()

std::optional< std::tuple< WrapperBase const *, unsigned int > > edm::Principal::getThinnedProduct ( ProductID const &  ,
unsigned int   
) const
overrideprivatevirtual

Implements edm::EDProductGetter.

Definition at line 844 of file Principal.cc.

References cms::cuda::assert().

845  {
846  assert(false);
847  return std::nullopt;
848  }
assert(be >=bs)

◆ getThinnedProducts()

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

Implements edm::EDProductGetter.

Definition at line 850 of file Principal.cc.

References cms::cuda::assert().

852  {
853  assert(false);
854  }
assert(be >=bs)

◆ lookupProcessOrder()

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

◆ prefetchAsync()

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

Definition at line 644 of file Principal.cc.

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

648  {
649  auto const& productResolver = productResolvers_.at(index);
650  assert(nullptr != productResolver.get());
651  productResolver->prefetchAsync(task, *this, skipCurrentProcess, token, nullptr, mcc);
652  }
ProductResolverCollection productResolvers_
Definition: Principal.h:268
assert(be >=bs)

◆ processBlockIndex()

unsigned int edm::Principal::processBlockIndex ( std::string const &  processName) const
virtual

Reimplemented in edm::EventPrincipal.

Definition at line 572 of file Principal.cc.

References Exception, and edm::errors::LogicError.

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

572  {
573  throw Exception(errors::LogicError) << "Principal::processBlockIndex not implemented for this type of Principal";
574  }

◆ processConfiguration()

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

Definition at line 138 of file Principal.h.

References processConfiguration_.

138 { return *processConfiguration_; }
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:265

◆ 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 92 of file Principal.h.

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

92 { return this; }

◆ productLookup()

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

Definition at line 142 of file Principal.h.

References productLookup_.

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

142 { return *productLookup_; }
std::shared_ptr< ProductResolverIndexHelper const > productLookup_
Definition: Principal.h:273

◆ productRegistry()

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

Definition at line 140 of file Principal.h.

References preg_.

Referenced by edm::EventPrincipal::changedIndexes_(), fillPrincipal(), findProductByLabel(), edm::SubProcess::processAsync(), and edm::PrincipalGetAdapter::throwUnregisteredPutException().

140 { return *preg_; }
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:272

◆ put_() [1/2]

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

Definition at line 865 of file Principal.cc.

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

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

865  {
866  if (edp.get() == nullptr) {
867  throw edm::Exception(edm::errors::InsertFailure, "Null Pointer")
868  << "put: Cannot put because unique_ptr to product is null."
869  << "\n";
870  }
871  auto phb = getExistingProduct(bd.branchID());
872  assert(phb);
873  // ProductResolver assumes ownership
874  put_(std::move(edp), phb);
875  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:505
assert(be >=bs)
void put_(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: Principal.cc:865
def move(src, dest)
Definition: eostools.py:511

◆ put_() [2/2]

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

Definition at line 861 of file Principal.cc.

References runTheMatrix::const, eostools::move(), and dumpMFGeometry_cfg::prod.

861  {
862  dynamic_cast<ProductPutterBase const*>(phb)->putProduct(std::move(prod));
863  }
def move(src, dest)
Definition: eostools.py:511

◆ readAllFromSourceAndMergeImmediately()

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

Definition at line 906 of file Principal.cc.

References dumpMFGeometry_cfg::prod, and reader().

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

906  {
907  if (not reader()) {
908  return;
909  }
910 
911  for (auto& prod : *this) {
912  prod->retrieveAndMerge(*this, mergeableRunProductMetadata);
913  }
914  }
DelayedReader * reader() const
Definition: Principal.h:181

◆ reader()

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

◆ recombine()

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

Definition at line 828 of file Principal.cc.

References cms::cuda::assert(), edm::get_underlying_safe(), edm::DelayedReader::mergeReaders(), trackingPlots::other, preg_, dumpMFGeometry_cfg::prod, edm::ProductResolverIndexInvalid, productResolvers_, and reader_.

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

828  {
829  for (auto& prod : bids) {
830  ProductResolverIndex index = preg_->indexFrom(prod);
832  ProductResolverIndex indexO = other.preg_->indexFrom(prod);
834  get_underlying_safe(productResolvers_[index]).swap(get_underlying_safe(other.productResolvers_[indexO]));
835  }
836  reader_->mergeReaders(other.reader());
837  }
DelayedReader * reader_
Definition: Principal.h:280
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:268
void mergeReaders(DelayedReader *other)
Definition: DelayedReader.h:36
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
assert(be >=bs)
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:272

◆ setupUnscheduled()

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

Definition at line 402 of file Principal.cc.

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

402  {
403  applyToResolvers([&iConfigure](ProductResolverBase* iResolver) { iResolver->setupUnscheduled(iConfigure); });
404  }
void applyToResolvers(F iFunc)
Definition: Principal.h:211

◆ size()

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

Definition at line 303 of file Principal.cc.

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

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

303  {
304  size_t size = 0U;
305  for (auto const& prod : *this) {
306  if (prod->singleProduct() && // Not a NoProcessProductResolver
307  !prod->productUnavailable() && !prod->unscheduledWasNotRun() && !prod->branchDescription().dropped()) {
308  ++size;
309  }
310  }
311  return size;
312  }
size_t size() const
Definition: Principal.cc:303

Member Data Documentation

◆ branchType_

BranchType edm::Principal::branchType_
private

◆ cacheIdentifier_

CacheIdentifier_t edm::Principal::cacheIdentifier_
private

Definition at line 289 of file Principal.h.

Referenced by cacheIdentifier(), and fillPrincipal().

◆ historyAppender_

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

Definition at line 287 of file Principal.h.

Referenced by fillPrincipal().

◆ lookupProcessOrder_

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

Definition at line 275 of file Principal.h.

Referenced by fillPrincipal(), and lookupProcessOrder().

◆ orderProcessHistoryID_

ProcessHistoryID edm::Principal::orderProcessHistoryID_
private

Definition at line 276 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 265 of file Principal.h.

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

◆ processHistoryID_

ProcessHistoryID edm::Principal::processHistoryID_
private

Definition at line 262 of file Principal.h.

Referenced by fillPrincipal(), and processHistoryID().

◆ processHistoryIDBeforeConfig_

ProcessHistoryID edm::Principal::processHistoryIDBeforeConfig_
private

Definition at line 263 of file Principal.h.

Referenced by fillPrincipal().

◆ processHistoryPtr_

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

Definition at line 260 of file Principal.h.

Referenced by fillPrincipal(), and processHistory().

◆ productLookup_

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

Definition at line 273 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 280 of file Principal.h.

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