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
 
Provenance const & getProvenance (BranchID const &bid) const
 
StableProvenance const & getStableProvenance (BranchID const &bid) const
 
std::vector< unsigned int > const & lookupProcessOrder () const
 
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 115 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, 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.

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

◆ ~Principal()

edm::Principal::~Principal ( )
override

Definition at line 295 of file Principal.cc.

295 {}

Member Function Documentation

◆ addAliasedProduct()

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

Definition at line 354 of file Principal.cc.

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

Referenced by Principal().

354  {
355  ProductResolverIndex index = preg_->indexFrom(bd->originalBranchID());
357 
358  addProductOrThrow(std::make_unique<AliasProductResolver>(
359  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
360  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:268
assert(be >=bs)
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:543
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 338 of file Principal.cc.

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

Referenced by adjustIndexesAfterProductRegistryAddition(), and Principal().

338  {
339  addProductOrThrow(std::make_unique<DelayedReaderInputProductResolver>(std::move(bd)));
340  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:543
def move(src, dest)
Definition: eostools.py:511

◆ addParentProcessProduct()

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

Definition at line 378 of file Principal.cc.

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

Referenced by Principal().

378  {
379  addProductOrThrow(std::make_unique<ParentProcessProductResolver>(std::move(bd)));
380  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:543
def move(src, dest)
Definition: eostools.py:511

◆ addProduct_()

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

Definition at line 530 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().

530  {
531  BranchDescription const& bd = productResolver->branchDescription();
532  assert(!bd.className().empty());
533  assert(!bd.friendlyClassName().empty());
534  assert(!bd.moduleLabel().empty());
535  assert(!bd.processName().empty());
536  SharedProductPtr phb(productResolver.release());
537 
538  ProductResolverIndex index = preg_->indexFrom(bd.branchID());
540  productResolvers_[index] = phb;
541  }
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 543 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().

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

◆ addPutOnReadInputProduct()

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

Definition at line 342 of file Principal.cc.

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

Referenced by adjustIndexesAfterProductRegistryAddition(), and Principal().

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

◆ addScheduledProduct()

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

Definition at line 328 of file Principal.cc.

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

Referenced by Principal().

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

◆ addSourceProduct()

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

Definition at line 333 of file Principal.cc.

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

Referenced by Principal().

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

◆ addSwitchAliasProduct()

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

Definition at line 370 of file Principal.cc.

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

Referenced by Principal().

370  {
371  ProductResolverIndex index = preg_->indexFrom(bd->switchAliasForBranchID());
373 
374  addProductOrThrow(std::make_unique<SwitchAliasProductResolver>(
375  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
376  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:268
assert(be >=bs)
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:543
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 362 of file Principal.cc.

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

Referenced by Principal().

362  {
363  ProductResolverIndex index = preg_->indexFrom(bd->switchAliasForBranchID());
365 
366  addProductOrThrow(std::make_unique<SwitchProducerProductResolver>(
367  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
368  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:268
assert(be >=bs)
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:543
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 350 of file Principal.cc.

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

Referenced by Principal().

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

◆ addUnscheduledProduct()

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

Definition at line 346 of file Principal.cc.

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

Referenced by Principal().

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

◆ adjustIndexesAfterProductRegistryAddition()

void edm::Principal::adjustIndexesAfterProductRegistryAddition ( )

Definition at line 873 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::StreamerInputSource::read().

873  {
874  if (preg_->getNextIndexValue(branchType_) != productResolvers_.size()) {
875  bool changed = false;
876  productResolvers_.resize(preg_->getNextIndexValue(branchType_));
877  for (auto const& prod : preg_->productList()) {
878  BranchDescription const& bd = prod.second;
879  if (bd.branchType() == branchType_) {
880  ProductResolverIndex index = preg_->indexFrom(bd.branchID());
882  if (!productResolvers_[index]) {
883  // no product holder. Must add one. The new entry must be an input product holder.
884  assert(!bd.produced());
885  auto cbd = std::make_shared<BranchDescription const>(bd);
886  if (bd.onDemand()) {
888  } else {
890  }
891  changed = true;
892  }
893  }
894  }
895  if (changed) {
896  changedIndexes_();
897  }
898  }
899  assert(preg_->getNextIndexValue(branchType_) == productResolvers_.size());
900  }
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:342
void addDelayedReaderInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:338

◆ adjustToNewProductRegistry()

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

Definition at line 312 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::StreamerInputSource::read(), and edm::EventProcessor::readAndMergeRun().

312  {
313  ProductRegistry::ProductList const& prodsList = reg.productList();
314  for (auto const& prod : prodsList) {
315  BranchDescription const& bd = prod.second;
316  if (!bd.produced() && (bd.branchType() == branchType_)) {
317  auto cbd = std::make_shared<BranchDescription const>(bd);
318  auto phb = getExistingProduct(cbd->branchID());
319  if (phb == nullptr || phb->branchDescription().branchName() != cbd->branchName()) {
320  return false;
321  }
322  phb->resetBranchDescription(cbd);
323  }
324  }
325  return true;
326  }
BranchType branchType_
Definition: Principal.h:282
std::map< BranchKey, BranchDescription > ProductList
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:502
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 383 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(), and edm::PoolSource::readEvent_().

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

◆ deleteProduct()

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

Definition at line 393 of file Principal.cc.

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

393  {
394  auto phb = getExistingProduct(id);
395  assert(nullptr != phb);
396  phb->unsafe_deleteProduct();
397  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:502
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 403 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().

403  {
404  //increment identifier here since clearPrincipal isn't called for Run/Lumi
406  if (reader) {
407  reader_ = reader;
408  }
409  }
DelayedReader * reader_
Definition: Principal.h:280
static Principal::CacheIdentifier_t nextIdentifier()
Definition: Principal.cc:111
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 412 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.

414  {
416 
417  if (historyAppender_ && productRegistry().anyProductProduced()) {
422  }
423  } else {
424  std::shared_ptr<ProcessHistory const> inputProcessHistory;
426  if (hist.isValid()) {
427  //does not own the pointer
428  auto noDel = [](void const*) {};
429  inputProcessHistory = std::shared_ptr<ProcessHistory const>(processHistory, noDel);
430  if (inputProcessHistory.get() == nullptr) {
431  throw Exception(errors::LogicError) << "Principal::fillPrincipal\n"
432  << "Input ProcessHistory not found in registry\n"
433  << "Contact a Framework developer\n";
434  }
435  } else {
436  //Since this is static we don't want it deleted
437  inputProcessHistory = std::shared_ptr<ProcessHistory const>(&s_emptyProcessHistory, [](void const*) {});
438  //no need to do any ordering since it is empty
440  }
442  processHistoryPtr_ = inputProcessHistory;
444  }
445  }
446 
448  std::vector<std::string> const& lookupProcessNames = productLookup_->lookupProcessNames();
449  lookupProcessOrder_.assign(lookupProcessNames.size(), 0);
450  unsigned int k = 0;
451 
452  // We loop over processes in reverse order of the ProcessHistory.
453  // If any entries in the product lookup tables are associated with
454  // the process we add it to the vector of processes in the order
455  // the lookup should be performed. There is one exception though,
456  // We start with the current process even if it is not in the ProcessHistory.
457  // The current process might be needed but not be in the process
458  // history if all the products produced in the current process are
459  // transient.
460  {
461  auto nameIterCurrentProcess =
462  std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processConfiguration_->processName());
463  if (nameIterCurrentProcess != lookupProcessNames.end()) {
464  lookupProcessOrder_.at(k) = nameIterCurrentProcess - lookupProcessNames.begin();
465  ++k;
466  }
467  }
468 
469  // We just looked for the current process so skip it if
470  // it is in the ProcessHistory.
471  auto iter = processHistoryPtr_->rbegin();
472  if (iter->processName() == processConfiguration_->processName()) {
473  ++iter;
474  }
475 
476  for (auto iEnd = processHistoryPtr_->rend(); iter != iEnd; ++iter) {
477  auto nameIter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), iter->processName());
478  if (nameIter == lookupProcessNames.end()) {
479  continue;
480  }
481  lookupProcessOrder_.at(k) = nameIter - lookupProcessNames.begin();
482  ++k;
483  }
485  }
486  }
void fillPrincipal(DelayedReader *reader)
Definition: Principal.cc:403
static ProcessHistory const s_emptyProcessHistory
Definition: Principal.cc:34
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 489 of file Principal.cc.

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

489  {
491 
492  std::vector<std::string> const& lookupProcessNames = productLookup_->lookupProcessNames();
493  lookupProcessOrder_.assign(lookupProcessNames.size(), 0);
494  if (!lookupProcessOrder_.empty()) {
495  auto iter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processNameOfBlock);
496  if (iter != lookupProcessNames.end()) {
497  lookupProcessOrder_[0] = iter - lookupProcessNames.begin();
498  }
499  }
500  }
void fillPrincipal(DelayedReader *reader)
Definition: Principal.cc:403
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 650 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().

655  {
656  bool skipCurrentProcess = inputTag.willSkipCurrentProcess();
657 
659 
661  char const* processName = inputTag.process().c_str();
662  if (skipCurrentProcess) {
663  processName = "\0";
664  } else if (inputTag.process() == InputTag::kCurrentProcess) {
666  }
667 
668  index =
669  productLookup().index(kindOfType, typeID, inputTag.label().c_str(), inputTag.instance().c_str(), processName);
670 
672  throwAmbiguousException("findProductByLabel",
673  typeID,
674  inputTag.label(),
675  inputTag.instance(),
677  } else if (index == ProductResolverIndexInvalid) {
678  // can occur because of missing consumes if nothing else in the process consumes the product
679  for (auto const& item : preg_->productList()) {
680  auto const& bd = item.second;
681  if (bd.present() and bd.unwrappedTypeID() == typeID and bd.moduleLabel() == inputTag.label() and
682  bd.productInstanceName() == inputTag.instance()) {
683  bool const inCurrentProcess = bd.processName() == processConfiguration_->processName();
684  if (inputTag.process().empty() or bd.processName() == inputTag.process() or
685  (skipCurrentProcess and not inCurrentProcess) or
686  (inputTag.process() == InputTag::kCurrentProcess and inCurrentProcess)) {
687  failedToRegisterConsumes(
688  kindOfType,
689  typeID,
690  inputTag.label(),
691  inputTag.instance(),
693  }
694  }
695  }
696  return nullptr;
697  }
698  inputTag.tryToCacheIndex(index, typeID, branchType(), &productRegistry());
699  }
700  if (UNLIKELY(consumer and (not consumer->registeredToConsume(index, skipCurrentProcess, branchType())))) {
701  failedToRegisterConsumes(kindOfType,
702  typeID,
703  inputTag.label(),
704  inputTag.instance(),
706  }
707 
708  auto const& productResolver = productResolvers_[index];
709 
710  auto resolution = productResolver->resolveProduct(*this, skipCurrentProcess, sra, mcc);
711  if (resolution.isAmbiguous()) {
712  throwAmbiguousException("findProductByLabel",
713  typeID,
714  inputTag.label(),
715  inputTag.instance(),
717  }
718  return resolution.data();
719  }
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:77
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:36
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 721 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.

728  {
730  productLookup().index(kindOfType, typeID, label.c_str(), instance.c_str(), process.c_str());
731 
733  throwAmbiguousException("findProductByLabel", typeID, label, instance, process);
734  } else if (index == ProductResolverIndexInvalid) {
735  // can occur because of missing consumes if nothing else in the process consumes the product
736  for (auto const& item : preg_->productList()) {
737  auto const& bd = item.second;
738  if (bd.present() and bd.unwrappedTypeID() == typeID and bd.moduleLabel() == label and
739  bd.productInstanceName() == instance) {
740  if (process.empty() or bd.processName() == process) {
741  failedToRegisterConsumes(kindOfType, typeID, label, instance, process);
742  }
743  }
744  }
745  return nullptr;
746  }
747 
748  if (UNLIKELY(consumer and (not consumer->registeredToConsume(index, false, branchType())))) {
749  failedToRegisterConsumes(kindOfType, typeID, label, instance, process);
750  }
751 
752  auto const& productResolver = productResolvers_[index];
753 
754  auto resolution = productResolver->resolveProduct(*this, false, sra, mcc);
755  if (resolution.isAmbiguous()) {
756  throwAmbiguousException("findProductByLabel", typeID, label, instance, process);
757  }
758  return resolution.data();
759  }
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:77
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 761 of file Principal.cc.

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

763  {
764  // Not implemented for ProcessBlocks
766 
767  ProductData const* productData = findProductByLabel(PRODUCT_TYPE, typeID, tag, nullptr, nullptr, mcc);
768  return productData;
769  }
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:650

◆ getAllProvenance()

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

Definition at line 796 of file Principal.cc.

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

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

◆ getAllStableProvenance()

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

Definition at line 813 of file Principal.cc.

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

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

◆ 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 572 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::Event::get(), PileUpEventPrincipal::getByLabel(), edm::PrincipalGetAdapter::getByLabel_(), and edm::PrincipalGetAdapter::getMatchingSequenceByLabel_().

577  {
578  // Not implemented for ProcessBlocks, it might work though, not tested
579  // The other getByLabel function is used for ProcessBlocks by TestProcessor
581 
582  ProductData const* result = findProductByLabel(kindOfType, typeID, inputTag, consumer, sra, mcc);
583  if (result == nullptr) {
584  return BasicHandle(makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> {
585  return makeNotFoundException(
586  "getByLabel",
587  kindOfType,
588  typeID,
589  inputTag.label(),
590  inputTag.instance(),
592  }));
593  }
594  return BasicHandle(result->wrapper(), &(result->provenance()));
595  }
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:650
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:53
std::string const & processName() const
static std::string appendCurrentProcessIfAlias(std::string const &processFromInputTag, std::string const &currentProcess)
Definition: Principal.cc:36
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 597 of file Principal.cc.

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

604  {
605  ProductData const* result = findProductByLabel(kindOfType, typeID, label, instance, process, consumer, sra, mcc);
606  if (result == nullptr) {
607  return BasicHandle(makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> {
608  return makeNotFoundException("getByLabel", kindOfType, typeID, label, instance, process);
609  }));
610  }
611  return BasicHandle(result->wrapper(), &(result->provenance()));
612  }
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:650
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:53

◆ 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 614 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_().

620  {
622  auto& productResolver = productResolvers_[index];
623  assert(nullptr != productResolver.get());
624  auto resolution = productResolver->resolveProduct(*this, skipCurrentProcess, sra, mcc);
625  if (resolution.isAmbiguous()) {
626  ambiguous = true;
627  //The caller is looking explicitly for this case
628  // and uses the extra data at the caller to setup the exception
629  return BasicHandle::makeInvalid();
630  }
631  auto productData = resolution.data();
632  if (productData == nullptr) {
633  //The caller is looking explicitly for this case
634  // and uses the extra data at the caller to setup the exception
635  return BasicHandle::makeInvalid();
636  }
637  return BasicHandle(productData->wrapper(), &(productData->provenance()));
638  }
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 502 of file Principal.cc.

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

502  {
503  return const_cast<ProductResolverBase*>(const_cast<const Principal*>(this)->getExistingProduct(branchID));
504  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:502
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:115

◆ getExistingProduct() [2/3]

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

Definition at line 506 of file Principal.cc.

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

506  {
507  ProductResolverIndex index = preg_->indexFrom(branchID);
509  return productResolvers_.at(index).get();
510  }
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 512 of file Principal.cc.

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

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

◆ getIt()

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

Implements edm::EDProductGetter.

Definition at line 835 of file Principal.cc.

References cms::cuda::assert().

835  {
836  assert(false);
837  return nullptr;
838  }
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:115
ConstProductResolverPtr getProductResolver(BranchID const &oid) const
Definition: Principal.cc:555

◆ getProductResolver()

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

Definition at line 555 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().

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

◆ getProductResolverByIndex()

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

◆ getProvenance()

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

Definition at line 771 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().

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

◆ getStableProvenance()

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

Definition at line 784 of file Principal.cc.

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

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

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

◆ getThinnedKeyFrom()

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

Implements edm::EDProductGetter.

Definition at line 852 of file Principal.cc.

References cms::cuda::assert().

852  {
853  assert(false);
854  return std::monostate{};
855  }
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 840 of file Principal.cc.

References cms::cuda::assert().

841  {
842  assert(false);
843  return std::nullopt;
844  }
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 846 of file Principal.cc.

References cms::cuda::assert().

848  {
849  assert(false);
850  }
assert(be >=bs)

◆ lookupProcessOrder()

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

◆ prefetchAsync()

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

Definition at line 640 of file Principal.cc.

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

Referenced by edm::Worker::doTransformAsync(), edm::EDLooperBase::edPrefetchAsync(), edm::Worker::edPrefetchAsync(), and edm::Worker::prePrefetchSelectionAsync().

644  {
645  auto const& productResolver = productResolvers_.at(index);
646  assert(nullptr != productResolver.get());
647  productResolver->prefetchAsync(task, *this, skipCurrentProcess, token, nullptr, mcc);
648  }
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 568 of file Principal.cc.

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

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

568  {
569  throw Exception(errors::LogicError) << "Principal::processBlockIndex not implemented for this type of Principal";
570  }

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

861  {
862  if (edp.get() == nullptr) {
863  throw edm::Exception(edm::errors::InsertFailure, "Null Pointer")
864  << "put: Cannot put because unique_ptr to product is null."
865  << "\n";
866  }
867  auto phb = getExistingProduct(bd.branchID());
868  assert(phb);
869  // ProductResolver assumes ownership
870  put_(std::move(edp), phb);
871  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:502
assert(be >=bs)
void put_(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: Principal.cc:861
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 857 of file Principal.cc.

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

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

◆ readAllFromSourceAndMergeImmediately()

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

Definition at line 902 of file Principal.cc.

References dumpMFGeometry_cfg::prod, and reader().

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

902  {
903  if (not reader()) {
904  return;
905  }
906 
907  for (auto& prod : *this) {
908  prod->retrieveAndMerge(*this, mergeableRunProductMetadata);
909  }
910  }
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 824 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_().

824  {
825  for (auto& prod : bids) {
826  ProductResolverIndex index = preg_->indexFrom(prod);
828  ProductResolverIndex indexO = other.preg_->indexFrom(prod);
830  get_underlying_safe(productResolvers_[index]).swap(get_underlying_safe(other.productResolvers_[indexO]));
831  }
832  reader_->mergeReaders(other.reader());
833  }
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 399 of file Principal.cc.

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

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

◆ size()

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

Definition at line 300 of file Principal.cc.

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

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

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