CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< ProductResolverBase
SharedProductPtr
 
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
 
void getManyByType (TypeID const &typeID, BasicHandleVec &results, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
ProductResolverBasegetModifiableProductResolver (BranchID const &oid)
 
ConstProductResolverPtr getProductResolver (BranchID const &oid) const
 
ConstProductResolverPtr getProductResolverByIndex (ProductResolverIndex const &oid) const
 
Provenance 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 addUnscheduledProduct (std::shared_ptr< BranchDescription const > bd)
 
virtual void changedIndexes_ ()
 
ProductData const * findProductByLabel (KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumer, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
ProductData const * findProductByLabel (KindOfType kindOfType, TypeID const &typeID, std::string const &label, std::string const &instance, std::string const &process, EDConsumerBase const *consumer, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
void findProducts (std::vector< ProductResolverBase const * > const &holders, TypeID const &typeID, BasicHandleVec &results, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
WrapperBase const * getIt (ProductID const &) const override
 
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

Definition at line 63 of file Principal.h.

typedef unsigned long edm::Principal::CacheIdentifier_t

Definition at line 184 of file Principal.h.

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

Definition at line 59 of file Principal.h.

Definition at line 62 of file Principal.h.

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

Definition at line 60 of file Principal.h.

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

Definition at line 67 of file Principal.h.

Definition at line 61 of file Principal.h.

Definition at line 58 of file Principal.h.

Definition at line 66 of file Principal.h.

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

Definition at line 64 of file Principal.h.

Constructor & Destructor Documentation

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

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

128  : EDProductGetter(),
134  preg_(reg),
137  reader_(),
138  branchType_(bt),
139  historyAppender_(historyAppender),
141  productResolvers_.resize(reg->getNextIndexValue(bt));
142  //Now that these have been set, we can create the list of Branches we need.
143  std::string const source("source");
144  ProductRegistry::ProductList const& prodsList = reg->productList();
145  // The constructor of an alias product holder takes as an argument the product holder for which it is an alias.
146  // So, the non-alias product holders must be created first.
147  // Therefore, on this first pass, skip current EDAliases.
148  bool hasAliases = false;
149  bool hasSwitchAliases = false;
150  for (auto const& prod : prodsList) {
151  BranchDescription const& bd = prod.second;
152  if (bd.branchType() == branchType_) {
153  if (isForPrimaryProcess or bd.processName() == pc.processName()) {
154  if (bd.isAlias()) {
155  hasAliases = true;
156  } else if (bd.isSwitchAlias()) {
157  hasSwitchAliases = true;
158  } else {
159  auto cbd = std::make_shared<BranchDescription const>(bd);
160  if (bd.produced()) {
161  if (bd.moduleLabel() == source) {
162  addSourceProduct(cbd);
163  } else if (bd.onDemand()) {
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) {
231  ProductResolverIndexHelper::Range const& range = ranges.at(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:293
DelayedReader * reader_
Definition: Principal.h:291
ProcessHistoryID processHistoryIDBeforeConfig_
Definition: Principal.h:274
unsigned int ProductResolverIndex
static std::string const source("source")
ProductResolverCollection productResolvers_
Definition: Principal.h:279
std::shared_ptr< ProcessHistory const > processHistoryPtr_
Definition: Principal.h:271
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
PixelRecoRange< float > Range
std::map< BranchKey, BranchDescription > ProductList
static Principal::CacheIdentifier_t nextIdentifier()
Definition: Principal.cc:118
ProcessHistoryID processHistoryID_
Definition: Principal.h:273
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:298
const uint16_t range(const Frame &aFrame)
std::vector< unsigned int > lookupProcessOrder_
Definition: Principal.h:286
deep_tau::DeepTauBase::BasicDiscriminator bd
Definition: DeepTauId.cc:1082
void addScheduledProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:331
std::shared_ptr< ProductResolverIndexHelper const > productLookup_
Definition: Principal.h:284
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:283
CacheIdentifier_t cacheIdentifier_
Definition: Principal.h:300
void addDelayedReaderInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:341
void addSourceProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:336
void addParentProcessProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:377
string ranges
Definition: diffTwoXMLs.py:79
void addSwitchAliasProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:369
void addUnscheduledProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:349
ProductResolverIndexHelper const & productLookup() const
Definition: Principal.h:148
void addPutOnReadInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:345
void addSwitchProducerProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:361
tuple process
Definition: LaserDQM_cfg.py:3
void addAliasedProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:353
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:276
std::vector< std::string > const & lookupProcessNames() const
edm::Principal::~Principal ( )
override

Definition at line 298 of file Principal.cc.

298 {}

Member Function Documentation

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

Definition at line 353 of file Principal.cc.

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

Referenced by Principal().

353  {
354  ProductResolverIndex index = preg_->indexFrom(bd->originalBranchID());
356 
357  addProductOrThrow(std::make_unique<AliasProductResolver>(
358  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
359  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:279
assert(be >=bs)
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:542
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:283
def move
Definition: eostools.py:511
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:542
def move
Definition: eostools.py:511
void edm::Principal::addParentProcessProduct ( std::shared_ptr< BranchDescription const >  bd)
private

Definition at line 377 of file Principal.cc.

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

Referenced by Principal().

377  {
378  addProductOrThrow(std::make_unique<ParentProcessProductResolver>(std::move(bd)));
379  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:542
def move
Definition: eostools.py:511
void edm::Principal::addProduct_ ( std::unique_ptr< ProductResolverBase phb)
protected

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

529  {
530  BranchDescription const& bd = productResolver->branchDescription();
531  assert(!bd.className().empty());
532  assert(!bd.friendlyClassName().empty());
533  assert(!bd.moduleLabel().empty());
534  assert(!bd.processName().empty());
535  SharedProductPtr phb(productResolver.release());
536 
537  ProductResolverIndex index = preg_->indexFrom(bd.branchID());
539  productResolvers_[index] = phb;
540  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:279
std::shared_ptr< ProductResolverBase > SharedProductPtr
Definition: Principal.h:66
assert(be >=bs)
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:283
void edm::Principal::addProductOrThrow ( std::unique_ptr< ProductResolverBase phb)
protected

Definition at line 542 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(), and addUnscheduledProduct().

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

Definition at line 369 of file Principal.cc.

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

Referenced by Principal().

369  {
370  ProductResolverIndex index = preg_->indexFrom(bd->switchAliasForBranchID());
372 
373  addProductOrThrow(std::make_unique<SwitchAliasProductResolver>(
374  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
375  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:279
assert(be >=bs)
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:542
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:283
def move
Definition: eostools.py:511
void edm::Principal::addSwitchProducerProduct ( std::shared_ptr< BranchDescription const >  bd)
private

Definition at line 361 of file Principal.cc.

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

Referenced by Principal().

361  {
362  ProductResolverIndex index = preg_->indexFrom(bd->switchAliasForBranchID());
364 
365  addProductOrThrow(std::make_unique<SwitchProducerProductResolver>(
366  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
367  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:279
assert(be >=bs)
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:542
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:283
def move
Definition: eostools.py:511
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:542
def move
Definition: eostools.py:511
void edm::Principal::adjustIndexesAfterProductRegistryAddition ( )

Definition at line 939 of file Principal.cc.

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

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

939  {
940  if (preg_->getNextIndexValue(branchType_) != productResolvers_.size()) {
941  bool changed = false;
942  productResolvers_.resize(preg_->getNextIndexValue(branchType_));
943  for (auto const& prod : preg_->productList()) {
944  BranchDescription const& bd = prod.second;
945  if (bd.branchType() == branchType_) {
946  ProductResolverIndex index = preg_->indexFrom(bd.branchID());
948  if (!productResolvers_[index]) {
949  // no product holder. Must add one. The new entry must be an input product holder.
950  assert(!bd.produced());
951  auto cbd = std::make_shared<BranchDescription const>(bd);
952  if (bd.onDemand()) {
954  } else {
956  }
957  changed = true;
958  }
959  }
960  }
961  if (changed) {
962  changedIndexes_();
963  }
964  }
965  assert(preg_->getNextIndexValue(branchType_) == productResolvers_.size());
966  }
BranchType branchType_
Definition: Principal.h:293
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:279
assert(be >=bs)
deep_tau::DeepTauBase::BasicDiscriminator bd
Definition: DeepTauId.cc:1082
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:283
void addDelayedReaderInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:341
virtual void changedIndexes_()
Definition: Principal.h:225
void addPutOnReadInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:345
bool edm::Principal::adjustToNewProductRegistry ( ProductRegistry const &  reg)

Definition at line 315 of file Principal.cc.

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

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

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:293
std::map< BranchKey, BranchDescription > ProductList
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:501
deep_tau::DeepTauBase::BasicDiscriminator bd
Definition: DeepTauId.cc:1082
void resetBranchDescription(std::shared_ptr< BranchDescription const > bd)
template<typename F >
void edm::Principal::applyToResolvers ( F  iFunc)
inlineprotected

Definition at line 217 of file Principal.h.

References productResolvers_.

Referenced by setupUnscheduled().

217  {
218  for (auto& resolver : productResolvers_) {
219  iFunc(resolver.get());
220  }
221  }
ProductResolverCollection productResolvers_
Definition: Principal.h:279
const_iterator edm::Principal::begin ( void  ) const
inline

Definition at line 160 of file Principal.h.

References productResolvers_.

160  {
161  return boost::make_filter_iterator<FilledProductPtr>(productResolvers_.begin(), productResolvers_.end());
162  }
ProductResolverCollection productResolvers_
Definition: Principal.h:279
iterator edm::Principal::begin ( void  )
inline

Definition at line 167 of file Principal.h.

References productResolvers_.

167  {
168  return boost::make_filter_iterator<FilledProductPtr>(productResolvers_.begin(), productResolvers_.end());
169  }
ProductResolverCollection productResolvers_
Definition: Principal.h:279
BranchType const& edm::Principal::branchType ( ) const
inline
CacheIdentifier_t edm::Principal::cacheIdentifier ( ) const
inline
virtual void edm::Principal::changedIndexes_ ( )
inlineprivatevirtual

Reimplemented in edm::EventPrincipal.

Definition at line 225 of file Principal.h.

Referenced by adjustIndexesAfterProductRegistryAddition().

225 {}
void edm::Principal::clearPrincipal ( )

Definition at line 382 of file Principal.cc.

References reader_.

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

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

Definition at line 392 of file Principal.cc.

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

Referenced by edm::EarlyDeleteHelper::moduleRan().

392  {
393  auto phb = getExistingProduct(id);
394  assert(nullptr != phb);
395  phb->unsafe_deleteProduct();
396  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:501
assert(be >=bs)
const_iterator edm::Principal::end ( void  ) const
inline

Definition at line 163 of file Principal.h.

References productResolvers_.

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

163  {
164  return boost::make_filter_iterator<FilledProductPtr>(productResolvers_.end(), productResolvers_.end());
165  }
ProductResolverCollection productResolvers_
Definition: Principal.h:279
iterator edm::Principal::end ( void  )
inline

Definition at line 170 of file Principal.h.

References productResolvers_.

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

170  {
171  return boost::make_filter_iterator<FilledProductPtr>(productResolvers_.end(), productResolvers_.end());
172  }
ProductResolverCollection productResolvers_
Definition: Principal.h:279
void edm::Principal::fillPrincipal ( DelayedReader reader)

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

402  {
403  //increment identifier here since clearPrincipal isn't called for Run/Lumi
405  if (reader) {
406  reader_ = reader;
407  }
408  }
DelayedReader * reader_
Definition: Principal.h:291
static Principal::CacheIdentifier_t nextIdentifier()
Definition: Principal.cc:118
CacheIdentifier_t cacheIdentifier_
Definition: Principal.h:300
DelayedReader * reader() const
Definition: Principal.h:187
void edm::Principal::fillPrincipal ( ProcessHistoryID const &  hist,
ProcessHistory const *  phr,
DelayedReader reader 
)

Definition at line 411 of file Principal.cc.

References Exception, fillPrincipal(), spr::find(), gpuVertexFinder::hist, historyAppender_, edm::Hash< I >::isValid(), isotrackApplyRegressor::k, edm::errors::LogicError, lookupProcessOrder_, orderProcessHistoryID_, processConfiguration_, processHistory(), processHistoryID_, processHistoryIDBeforeConfig_, processHistoryPtr_, edm::ProcessConfiguration::processName(), productLookup_, productRegistry(), and edm::s_emptyProcessHistory.

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

Definition at line 488 of file Principal.cc.

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

488  {
490 
491  std::vector<std::string> const& lookupProcessNames = productLookup_->lookupProcessNames();
492  lookupProcessOrder_.assign(lookupProcessNames.size(), 0);
493  if (!lookupProcessOrder_.empty()) {
494  auto iter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processNameOfBlock);
495  if (iter != lookupProcessNames.end()) {
496  lookupProcessOrder_[0] = iter - lookupProcessNames.begin();
497  }
498  }
499  }
void fillPrincipal(DelayedReader *reader)
Definition: Principal.cc:402
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:286
std::shared_ptr< ProductResolverIndexHelper const > productLookup_
Definition: Principal.h:284
DelayedReader * reader() const
Definition: Principal.h:187
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 744 of file Principal.cc.

References edm::appendCurrentProcessIfAlias(), branchType(), edm::ProductResolverIndexHelper::index(), edm::InputTag::indexFor(), edm::InputTag::instance(), edm::InputTag::kCurrentProcess, edm::InputTag::label(), edm::InputTag::process(), processConfiguration_, edm::ProcessConfiguration::processName(), FSQHLTOfflineSource_cfi::processName, productLookup(), productRegistry(), edm::ProductResolverIndexAmbiguous, edm::ProductResolverIndexInvalid, productResolvers_, edm::EDConsumerBase::registeredToConsume(), dtDQMClient_cfg::resolution, edm::throwAmbiguousException(), edm::InputTag::tryToCacheIndex(), UNLIKELY, and edm::InputTag::willSkipCurrentProcess().

Referenced by findProductByTag(), and getByLabel().

749  {
750  bool skipCurrentProcess = inputTag.willSkipCurrentProcess();
751 
753 
754  if (index == ProductResolverIndexInvalid) {
755  char const* processName = inputTag.process().c_str();
756  if (skipCurrentProcess) {
757  processName = "\0";
758  } else if (inputTag.process() == InputTag::kCurrentProcess) {
759  processName = processConfiguration_->processName().c_str();
760  }
761 
762  index =
763  productLookup().index(kindOfType, typeID, inputTag.label().c_str(), inputTag.instance().c_str(), processName);
764 
765  if (index == ProductResolverIndexAmbiguous) {
766  throwAmbiguousException("findProductByLabel",
767  typeID,
768  inputTag.label(),
769  inputTag.instance(),
771  } else if (index == ProductResolverIndexInvalid) {
772  return nullptr;
773  }
774  inputTag.tryToCacheIndex(index, typeID, branchType(), &productRegistry());
775  }
776  if (UNLIKELY(consumer and (not consumer->registeredToConsume(index, skipCurrentProcess, branchType())))) {
777  failedToRegisterConsumes(kindOfType,
778  typeID,
779  inputTag.label(),
780  inputTag.instance(),
782  }
783 
784  auto const& productResolver = productResolvers_[index];
785 
786  auto resolution = productResolver->resolveProduct(*this, skipCurrentProcess, sra, mcc);
787  if (resolution.isAmbiguous()) {
788  throwAmbiguousException("findProductByLabel",
789  typeID,
790  inputTag.label(),
791  inputTag.instance(),
793  }
794  return resolution.data();
795  }
ProductRegistry const & productRegistry() const
Definition: Principal.h:146
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:279
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::string const & processName() const
BranchType const & branchType() const
Definition: Principal.h:181
static const std::string kCurrentProcess
Definition: InputTag.h:54
ProductResolverIndexHelper const & productLookup() const
Definition: Principal.h:148
#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:276
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=nullptr) const
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 797 of file Principal.cc.

References branchType(), edm::ProductResolverIndexHelper::index(), productLookup(), edm::ProductResolverIndexAmbiguous, edm::ProductResolverIndexInvalid, productResolvers_, edm::EDConsumerBase::registeredToConsume(), dtDQMClient_cfg::resolution, edm::throwAmbiguousException(), and UNLIKELY.

804  {
806  productLookup().index(kindOfType, typeID, label.c_str(), instance.c_str(), process.c_str());
807 
808  if (index == ProductResolverIndexAmbiguous) {
809  throwAmbiguousException("findProductByLabel", typeID, label, instance, process);
810  } else if (index == ProductResolverIndexInvalid) {
811  return nullptr;
812  }
813 
814  if (UNLIKELY(consumer and (not consumer->registeredToConsume(index, false, branchType())))) {
815  failedToRegisterConsumes(kindOfType, typeID, label, instance, process);
816  }
817 
818  auto const& productResolver = productResolvers_[index];
819 
820  auto resolution = productResolver->resolveProduct(*this, false, sra, mcc);
821  if (resolution.isAmbiguous()) {
822  throwAmbiguousException("findProductByLabel", typeID, label, instance, process);
823  }
824  return resolution.data();
825  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:279
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
BranchType const & branchType() const
Definition: Principal.h:181
ProductResolverIndexHelper const & productLookup() const
Definition: Principal.h:148
#define UNLIKELY(x)
Definition: Likely.h:21
tuple process
Definition: LaserDQM_cfg.py:3
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=nullptr) const
ProductData const * edm::Principal::findProductByTag ( TypeID const &  typeID,
InputTag const &  tag,
ModuleCallingContext const *  mcc 
) const

Definition at line 827 of file Principal.cc.

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

Referenced by edm::getProductByTag().

829  {
830  // Not implemented for ProcessBlocks
832 
833  ProductData const* productData = findProductByLabel(PRODUCT_TYPE, typeID, tag, nullptr, nullptr, mcc);
834  return productData;
835  }
BranchType branchType_
Definition: Principal.h:293
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:744
void edm::Principal::findProducts ( std::vector< ProductResolverBase const * > const &  holders,
TypeID const &  typeID,
BasicHandleVec results,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const
private

Definition at line 719 of file Principal.cc.

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

Referenced by getManyByType().

723  {
724  for (auto iter = processHistoryPtr_->rbegin(), iEnd = processHistoryPtr_->rend(); iter != iEnd; ++iter) {
725  std::string const& process = iter->processName();
726  for (auto productResolver : holders) {
727  BranchDescription const& bd = productResolver->branchDescription();
728  if (process == bd.processName()) {
729  // Ignore aliases to avoid matching the same product multiple times.
730  if (bd.isAnyAlias()) {
731  continue;
732  }
733 
734  ProductData const* productData = productResolver->resolveProduct(*this, false, sra, mcc).data();
735  if (productData) {
736  // Skip product if not available.
737  results.emplace_back(productData->wrapper(), &(productData->provenance()));
738  }
739  }
740  }
741  }
742  }
std::shared_ptr< ProcessHistory const > processHistoryPtr_
Definition: Principal.h:271
dictionary results
tuple process
Definition: LaserDQM_cfg.py:3
void edm::Principal::getAllProvenance ( std::vector< Provenance const * > &  provenances) const

Definition at line 862 of file Principal.cc.

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

862  {
863  provenances.clear();
864  for (auto const& productResolver : *this) {
865  if (productResolver->singleProduct() && productResolver->provenanceAvailable() &&
866  !productResolver->branchDescription().isAnyAlias()) {
867  // We do not attempt to get the event/lumi/run status from the provenance,
868  // because the per event provenance may have been dropped.
869  if (productResolver->provenance()->branchDescription().present()) {
870  provenances.push_back(productResolver->provenance());
871  }
872  }
873  }
874  }
void edm::Principal::getAllStableProvenance ( std::vector< StableProvenance const * > &  provenances) const

Definition at line 879 of file Principal.cc.

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

879  {
880  provenances.clear();
881  for (auto const& productResolver : *this) {
882  if (productResolver->singleProduct() && !productResolver->branchDescription().isAnyAlias()) {
883  if (productResolver->stableProvenance()->branchDescription().present()) {
884  provenances.push_back(productResolver->stableProvenance());
885  }
886  }
887  }
888  }
BasicHandle edm::Principal::getByLabel ( KindOfType  kindOfType,
TypeID const &  typeID,
InputTag const &  inputTag,
EDConsumerBase const *  consumes,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const

Definition at line 571 of file Principal.cc.

References edm::appendCurrentProcessIfAlias(), cms::cuda::assert(), branchType_, findProductByLabel(), edm::InProcess, edm::InputTag::instance(), edm::InputTag::label(), edm::makeHandleExceptionFactory(), edm::makeNotFoundException(), edm::InputTag::process(), processConfiguration_, edm::ProcessConfiguration::processName(), edm::ProductData::provenance(), mps_fire::result, and edm::ProductData::wrapper().

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

576  {
577  // Not implemented for ProcessBlocks, it might work though, not tested
578  // The other getByLabel function is used for ProcessBlocks by TestProcessor
580 
581  ProductData const* result = findProductByLabel(kindOfType, typeID, inputTag, consumer, sra, mcc);
582  if (result == nullptr) {
583  return BasicHandle(makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> {
584  return makeNotFoundException(
585  "getByLabel",
586  kindOfType,
587  typeID,
588  inputTag.label(),
589  inputTag.instance(),
591  }));
592  }
593  return BasicHandle(result->wrapper(), &(result->provenance()));
594  }
BranchType branchType_
Definition: Principal.h:293
assert(be >=bs)
tuple result
Definition: mps_fire.py:311
std::string const & processName() const
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
ProductData const * findProductByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumer, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:744
static std::string appendCurrentProcessIfAlias(std::string const &processFromInputTag, std::string const &currentProcess)
Definition: Principal.cc:36
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:276
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 596 of file Principal.cc.

References findProductByLabel(), edm::makeHandleExceptionFactory(), edm::makeNotFoundException(), edm::ProductData::provenance(), mps_fire::result, and edm::ProductData::wrapper().

603  {
604  ProductData const* result = findProductByLabel(kindOfType, typeID, label, instance, process, consumer, sra, mcc);
605  if (result == nullptr) {
606  return BasicHandle(makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> {
607  return makeNotFoundException("getByLabel", kindOfType, typeID, label, instance, process);
608  }));
609  }
610  return BasicHandle(result->wrapper(), &(result->provenance()));
611  }
static PFTauRenderPlugin instance
tuple result
Definition: mps_fire.py:311
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
ProductData const * findProductByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumer, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:744
tuple process
Definition: LaserDQM_cfg.py:3
BasicHandle edm::Principal::getByToken ( KindOfType  kindOfType,
TypeID const &  typeID,
ProductResolverIndex  index,
bool  skipCurrentProcess,
bool &  ambiguous,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const

Definition at line 613 of file Principal.cc.

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

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

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

Definition at line 501 of file Principal.cc.

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

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

Definition at line 505 of file Principal.cc.

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

505  {
506  ProductResolverIndex index = preg_->indexFrom(branchID);
508  return productResolvers_.at(index).get();
509  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:279
assert(be >=bs)
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:283
ProductResolverBase const * edm::Principal::getExistingProduct ( ProductResolverBase const &  phb) const
protected

Definition at line 511 of file Principal.cc.

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

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

Implements edm::EDProductGetter.

Definition at line 901 of file Principal.cc.

References cms::cuda::assert().

901  {
902  assert(false);
903  return nullptr;
904  }
assert(be >=bs)
void edm::Principal::getManyByType ( TypeID const &  typeID,
BasicHandleVec results,
EDConsumerBase const *  consumes,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const

Definition at line 649 of file Principal.cc.

References cms::cuda::assert(), branchType(), branchType_, findProducts(), mps_fire::i, edm::ProductResolverIndexHelper::Matches::index(), edm::InProcess, edm::ProductResolverIndexHelper::Matches::isFullyResolved(), edm::ProductResolverIndexHelper::Matches::numberOfMatches(), edm::PRODUCT_TYPE, productLookup(), productResolvers_, edm::EDConsumerBase::registeredToConsumeMany(), edm::ProductResolverIndexHelper::relatedIndexes(), and UNLIKELY.

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

653  {
654  // Not implemented for ProcessBlocks
656 
657  assert(results.empty());
658 
659  if (UNLIKELY(consumer and (not consumer->registeredToConsumeMany(typeID, branchType())))) {
660  failedToRegisterConsumesMany(typeID);
661  }
662 
663  // This finds the indexes to all the ProductResolver's matching the type
664  ProductResolverIndexHelper::Matches matches = productLookup().relatedIndexes(PRODUCT_TYPE, typeID);
665 
666  if (matches.numberOfMatches() == 0) {
667  return;
668  }
669 
670  results.reserve(matches.numberOfMatches());
671 
672  // Loop over the ProductResolvers. Add the products that are actually
673  // present into the results. This will also trigger delayed reading,
674  // on demand production, and check for deleted products as appropriate.
675 
676  // Over the years the code that uses getManyByType has grown to depend
677  // on the ordering of the results. The order originally was just an
678  // accident of how previous versions of the code were written, but
679  // here we have to go through some extra effort to preserve that ordering.
680 
681  // We build a list of holders that match a particular label and instance.
682  // When that list is complete we call findProducts, which loops over
683  // that list in reverse order of the ProcessHistory (starts with the
684  // most recent). Then we clear the list and repeat this until all the
685  // matching label and instance subsets have been dealt with.
686 
687  // Note that the function isFullyResolved returns true for the ProductResolvers
688  // that are associated with an empty process name. Those are the ones that
689  // know how to search for the most recent process name matching
690  // a label and instance. We do not need these for getManyByType and
691  // skip them. In addition to skipping them, we make use of the fact
692  // that they mark the beginning of each subset of holders with the same
693  // label and instance. They tell us when to call findProducts.
694 
695  std::vector<ProductResolverBase const*> holders;
696 
697  for (unsigned int i = 0; i < matches.numberOfMatches(); ++i) {
698  ProductResolverIndex index = matches.index(i);
699 
700  if (!matches.isFullyResolved(i)) {
701  if (!holders.empty()) {
702  // Process the ones with a particular module label and instance
703  findProducts(holders, typeID, results, sra, mcc);
704  holders.clear();
705  }
706  } else {
707  ProductResolverBase const* productResolver = productResolvers_.at(index).get();
708  assert(productResolver);
709  holders.push_back(productResolver);
710  }
711  }
712  // Do not miss the last subset of products
713  if (!holders.empty()) {
714  findProducts(holders, typeID, results, sra, mcc);
715  }
716  return;
717  }
BranchType branchType_
Definition: Principal.h:293
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:279
dictionary results
assert(be >=bs)
BranchType const & branchType() const
Definition: Principal.h:181
Matches relatedIndexes(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance) const
ProductResolverIndexHelper const & productLookup() const
Definition: Principal.h:148
void findProducts(std::vector< ProductResolverBase const * > const &holders, TypeID const &typeID, BasicHandleVec &results, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
Definition: Principal.cc:719
#define UNLIKELY(x)
Definition: Likely.h:21
ProductResolverBase* edm::Principal::getModifiableProductResolver ( BranchID const &  oid)
inline

Definition at line 153 of file Principal.h.

References getProductResolver().

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

153  {
154  return const_cast<ProductResolverBase*>(const_cast<const Principal*>(this)->getProductResolver(oid));
155  }
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:122
ConstProductResolverPtr getProductResolver(BranchID const &oid) const
Definition: Principal.cc:554
Principal::ConstProductResolverPtr edm::Principal::getProductResolver ( BranchID const &  oid) const

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

554  {
555  ProductResolverIndex index = preg_->indexFrom(bid);
556  if (index == ProductResolverIndexInvalid) {
557  return ConstProductResolverPtr();
558  }
559  return getProductResolverByIndex(index);
560  }
unsigned int ProductResolverIndex
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:283
ProductResolverBase const * ConstProductResolverPtr
Definition: Principal.h:62
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:562
Principal::ConstProductResolverPtr edm::Principal::getProductResolverByIndex ( ProductResolverIndex const &  oid) const
Provenance const & edm::Principal::getProvenance ( BranchID const &  bid) const

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

837  {
839  if (phb == nullptr) {
841  }
842 
843  if (phb->unscheduledWasNotRun()) {
845  << "Requesting provenance from unrun EDProducer. The requested branch ID was: " << bid;
846  }
847  return *phb->provenance();
848  }
ProductResolverBase const * ConstProductResolverPtr
Definition: Principal.h:62
ConstProductResolverPtr getProductResolver(BranchID const &oid) const
Definition: Principal.cc:554
static void throwProductNotFoundException(char const *where, errors::ErrorCodes error, BranchID const &bid)
Definition: Principal.cc:48
StableProvenance const & edm::Principal::getStableProvenance ( BranchID const &  bid) const

Definition at line 850 of file Principal.cc.

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

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

850  {
852  if (phb == nullptr) {
853  throwProductNotFoundException("getStableProvenance", errors::ProductNotFound, bid);
854  }
855  //NOTE: in all implementations, this never returns a nullptr
856  return *phb->stableProvenance();
857  }
ProductResolverBase const * ConstProductResolverPtr
Definition: Principal.h:62
ConstProductResolverPtr getProductResolver(BranchID const &oid) const
Definition: Principal.cc:554
static void throwProductNotFoundException(char const *where, errors::ErrorCodes error, BranchID const &bid)
Definition: Principal.cc:48
OptionalThinnedKey edm::Principal::getThinnedKeyFrom ( ProductID const &  parent,
unsigned int  key,
ProductID const &  thinned 
) const
overrideprivatevirtual

Implements edm::EDProductGetter.

Definition at line 918 of file Principal.cc.

References cms::cuda::assert().

918  {
919  assert(false);
920  return std::monostate{};
921  }
assert(be >=bs)
std::optional< std::tuple< WrapperBase const *, unsigned int > > edm::Principal::getThinnedProduct ( ProductID const &  ,
unsigned int   
) const
overrideprivatevirtual

Implements edm::EDProductGetter.

Definition at line 906 of file Principal.cc.

References cms::cuda::assert().

907  {
908  assert(false);
909  return std::nullopt;
910  }
assert(be >=bs)
void edm::Principal::getThinnedProducts ( ProductID const &  ,
std::vector< WrapperBase const * > &  ,
std::vector< unsigned int > &   
) const
overrideprivatevirtual

Implements edm::EDProductGetter.

Definition at line 912 of file Principal.cc.

References cms::cuda::assert().

914  {
915  assert(false);
916  }
assert(be >=bs)
std::vector<unsigned int> const& edm::Principal::lookupProcessOrder ( ) const
inline
void edm::Principal::prefetchAsync ( WaitingTaskHolder  waitTask,
ProductResolverIndex  index,
bool  skipCurrentProcess,
ServiceToken const &  token,
ModuleCallingContext const *  mcc 
) const

Definition at line 639 of file Principal.cc.

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

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

643  {
644  auto const& productResolver = productResolvers_.at(index);
645  assert(nullptr != productResolver.get());
646  productResolver->prefetchAsync(task, *this, skipCurrentProcess, token, nullptr, mcc);
647  }
ProductResolverCollection productResolvers_
Definition: Principal.h:279
assert(be >=bs)
unsigned int edm::Principal::processBlockIndex ( std::string const &  processName) const
virtual

Reimplemented in edm::EventPrincipal.

Definition at line 567 of file Principal.cc.

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

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

567  {
568  throw Exception(errors::LogicError) << "Principal::processBlockIndex not implemented for this type of Principal";
569  }
ProcessConfiguration const& edm::Principal::processConfiguration ( ) const
inline

Definition at line 144 of file Principal.h.

References processConfiguration_.

144 { return *processConfiguration_; }
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:276
ProcessHistory const& edm::Principal::processHistory ( ) const
inline
ProcessHistoryID const& edm::Principal::processHistoryID ( ) const
inline
EDProductGetter const* edm::Principal::prodGetter ( ) const
inline

Definition at line 92 of file Principal.h.

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

92 { return this; }
ProductResolverIndexHelper const& edm::Principal::productLookup ( ) const
inline

Definition at line 148 of file Principal.h.

References productLookup_.

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

148 { return *productLookup_; }
std::shared_ptr< ProductResolverIndexHelper const > productLookup_
Definition: Principal.h:284
ProductRegistry const& edm::Principal::productRegistry ( ) const
inline

Definition at line 146 of file Principal.h.

References preg_.

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

146 { return *preg_; }
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:283
void edm::Principal::put_ ( BranchDescription const &  bd,
std::unique_ptr< WrapperBase edp 
) const
protected

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

927  {
928  if (edp.get() == nullptr) {
929  throw edm::Exception(edm::errors::InsertFailure, "Null Pointer")
930  << "put: Cannot put because unique_ptr to product is null."
931  << "\n";
932  }
933  auto phb = getExistingProduct(bd.branchID());
934  assert(phb);
935  // ProductResolver assumes ownership
936  put_(std::move(edp), phb);
937  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:501
assert(be >=bs)
def move
Definition: eostools.py:511
void put_(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: Principal.cc:927
void edm::Principal::put_ ( std::unique_ptr< WrapperBase prod,
ProductResolverBase const *  productResolver 
) const
private

Definition at line 923 of file Principal.cc.

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

923  {
924  dynamic_cast<ProductPutterBase const*>(phb)->putProduct(std::move(prod));
925  }
def move
Definition: eostools.py:511
void edm::Principal::readAllFromSourceAndMergeImmediately ( MergeableRunProductMetadata const *  mergeableRunProductMetadata = nullptr)

Definition at line 968 of file Principal.cc.

References reader().

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

968  {
969  if (not reader()) {
970  return;
971  }
972 
973  for (auto& prod : *this) {
974  prod->retrieveAndMerge(*this, mergeableRunProductMetadata);
975  }
976  }
DelayedReader * reader() const
Definition: Principal.h:187
DelayedReader* edm::Principal::reader ( ) const
inline
void edm::Principal::recombine ( Principal other,
std::vector< BranchID > const &  bids 
)

Definition at line 890 of file Principal.cc.

References cms::cuda::assert(), edm::get_underlying_safe(), edm::DelayedReader::mergeReaders(), preg_, edm::ProductResolverIndexInvalid, productResolvers_, reader(), and reader_.

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

890  {
891  for (auto& prod : bids) {
892  ProductResolverIndex index = preg_->indexFrom(prod);
894  ProductResolverIndex indexO = other.preg_->indexFrom(prod);
896  get_underlying_safe(productResolvers_[index]).swap(get_underlying_safe(other.productResolvers_[indexO]));
897  }
898  reader_->mergeReaders(other.reader());
899  }
DelayedReader * reader_
Definition: Principal.h:291
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:279
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:283
void edm::Principal::setupUnscheduled ( UnscheduledConfigurator const &  iConfigure)

Definition at line 398 of file Principal.cc.

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

Referenced by edm::WorkerManager::setupResolvers().

398  {
399  applyToResolvers([&iConfigure](ProductResolverBase* iResolver) { iResolver->setupUnscheduled(iConfigure); });
400  }
void applyToResolvers(F iFunc)
Definition: Principal.h:217
size_t edm::Principal::size ( void  ) const

Definition at line 303 of file Principal.cc.

Referenced by ntupleDataFormat._Collection::__iter__(), ntupleDataFormat._Collection::__len__(), edm::SecSourceAnalyzer::getBranches(), edm::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 edm::Principal::branchType_
private
CacheIdentifier_t edm::Principal::cacheIdentifier_
private

Definition at line 300 of file Principal.h.

Referenced by cacheIdentifier(), and fillPrincipal().

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

Definition at line 298 of file Principal.h.

Referenced by fillPrincipal().

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

Definition at line 286 of file Principal.h.

Referenced by fillPrincipal(), and lookupProcessOrder().

ProcessHistoryID edm::Principal::orderProcessHistoryID_
private

Definition at line 287 of file Principal.h.

Referenced by fillPrincipal().

std::shared_ptr<ProductRegistry const> edm::Principal::preg_
private
ProcessConfiguration const* edm::Principal::processConfiguration_
private

Definition at line 276 of file Principal.h.

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

ProcessHistoryID edm::Principal::processHistoryID_
private

Definition at line 273 of file Principal.h.

Referenced by fillPrincipal(), and processHistoryID().

ProcessHistoryID edm::Principal::processHistoryIDBeforeConfig_
private

Definition at line 274 of file Principal.h.

Referenced by fillPrincipal().

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

Definition at line 271 of file Principal.h.

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

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

Definition at line 284 of file Principal.h.

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

ProductResolverCollection edm::Principal::productResolvers_
private
DelayedReader* edm::Principal::reader_
private

Definition at line 291 of file Principal.h.

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