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
 
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 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
 
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

◆ BasicHandleVec

Definition at line 63 of file Principal.h.

◆ CacheIdentifier_t

typedef unsigned long edm::Principal::CacheIdentifier_t

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

References addAliasedProduct(), addDelayedReaderInputProduct(), addParentProcessProduct(), addPutOnReadInputProduct(), addScheduledProduct(), addSourceProduct(), addSwitchAliasProduct(), addSwitchProducerProduct(), addTransformProduct(), addUnscheduledProduct(), cms::cuda::assert(), branchType_, spr::find(), mps_fire::i, edm::ProductResolverIndexHelper::IndexAndNames::index(), edm::InEvent, dqmiolumiharvest::j, dqmdumpme::k, or, LaserDQM_cfg::process, edm::ProcessConfiguration::processName(), dumpMFGeometry_cfg::prod, productLookup_, edm::ProductResolverIndexAmbiguous, edm::ProductResolverIndexInvalid, productResolvers_, FastTimerService_cff::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()) {
165  if (bd.isTransform()) {
166  addTransformProduct(cbd);
167  } else {
169  }
170  } else {
171  addScheduledProduct(cbd);
172  }
173  } else {
174  if (bd.onDemand()) {
176  } else {
178  }
179  }
180  }
181  } else {
182  //We are in a SubProcess and this branch is from the parent
183  auto cbd = std::make_shared<BranchDescription const>(bd);
185  }
186  }
187  }
188  // Now process any EDAliases
189  if (hasAliases) {
190  for (auto const& prod : prodsList) {
191  BranchDescription const& bd = prod.second;
192  if (bd.isAlias() && bd.branchType() == branchType_) {
193  addAliasedProduct(std::make_shared<BranchDescription const>(bd));
194  }
195  }
196  }
197  // Finally process any SwitchProducer aliases
198  if (hasSwitchAliases) {
199  for (auto const& prod : prodsList) {
200  BranchDescription const& bd = prod.second;
201  if (bd.isSwitchAlias() && bd.branchType() == branchType_) {
203  auto cbd = std::make_shared<BranchDescription const>(bd);
204  // Need different implementation for SwitchProducers not
205  // in any Path (onDemand) and for those in a Path in order
206  // to prevent the switch-aliased-for EDProducers from
207  // being run when the SwitchProducer is in a Path after a
208  // failing EDFilter.
209  if (bd.onDemand()) {
211  } else {
213  }
214  }
215  }
216  }
217 
218  // Now create the ProductResolvers that search in reverse process
219  // order and are used for queries where the process name is the
220  // empty string
221  std::vector<std::string> const& lookupProcessNames = productLookup_->lookupProcessNames();
222  std::vector<ProductResolverIndex> matchingHolders(lookupProcessNames.size(), ProductResolverIndexInvalid);
223  std::vector<bool> ambiguous(lookupProcessNames.size(), false);
224  unsigned int beginElements = productLookup_->beginElements();
225  std::vector<TypeID> const& sortedTypeIDs = productLookup_->sortedTypeIDs();
226  std::vector<ProductResolverIndexHelper::Range> const& ranges = productLookup_->ranges();
227  std::vector<ProductResolverIndexHelper::IndexAndNames> const& indexAndNames = productLookup_->indexAndNames();
228  std::vector<char> const& processNamesCharArray = productLookup_->processNames();
229 
230  unsigned int numberOfMatches = 0;
232  if (!sortedTypeIDs.empty()) {
233  ProductResolverIndex productResolverIndex = ProductResolverIndexInvalid;
234  for (unsigned int k = 0, kEnd = sortedTypeIDs.size(); k < kEnd; ++k) {
236  for (unsigned int i = range.begin(); i < range.end(); ++i) {
237  ProductResolverIndexHelper::IndexAndNames const& product = indexAndNames.at(i);
238  if (product.startInProcessNames() == 0) {
239  if (productResolverIndex != ProductResolverIndexInvalid) {
240  if ((numberOfMatches == 1) and (lastMatchIndex != ProductResolverIndexAmbiguous)) {
241  //only one choice so use a special resolver
242  productResolvers_.at(productResolverIndex) =
243  std::make_shared<SingleChoiceNoProcessProductResolver>(lastMatchIndex);
244  } else {
245  bool productMadeAtEnd = false;
246  //Need to know if the product from this processes is added at end of transition
247  for (unsigned int j = 0; j < matchingHolders.size(); ++j) {
248  if ((not ambiguous[j]) and ProductResolverIndexInvalid != matchingHolders[j] and
249  productResolvers_[matchingHolders[j]]->branchDescription().availableOnlyAtEndTransition()) {
250  productMadeAtEnd = true;
251  break;
252  }
253  }
254  std::shared_ptr<ProductResolverBase> newHolder =
255  std::make_shared<NoProcessProductResolver>(matchingHolders, ambiguous, productMadeAtEnd);
256  productResolvers_.at(productResolverIndex) = newHolder;
257  }
258  matchingHolders.assign(lookupProcessNames.size(), ProductResolverIndexInvalid);
259  ambiguous.assign(lookupProcessNames.size(), false);
260  numberOfMatches = 0;
261  lastMatchIndex = ProductResolverIndexInvalid;
262  }
263  productResolverIndex = product.index();
264  } else {
265  std::string process(&processNamesCharArray.at(product.startInProcessNames()));
266  auto iter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), process);
267  assert(iter != lookupProcessNames.end());
268  ProductResolverIndex iMatchingIndex = product.index();
269  lastMatchIndex = iMatchingIndex;
270  assert(iMatchingIndex != ProductResolverIndexInvalid);
271  ++numberOfMatches;
272  if (iMatchingIndex == ProductResolverIndexAmbiguous) {
273  assert(k >= beginElements);
274  ambiguous.at(iter - lookupProcessNames.begin()) = true;
275  } else {
276  matchingHolders.at(iter - lookupProcessNames.begin()) = iMatchingIndex;
277  }
278  }
279  }
280  }
281  //Need to know if the product from this processes is added at end of transition
282  if ((numberOfMatches == 1) and (lastMatchIndex != ProductResolverIndexAmbiguous)) {
283  //only one choice so use a special resolver
284  productResolvers_.at(productResolverIndex) =
285  std::make_shared<SingleChoiceNoProcessProductResolver>(lastMatchIndex);
286  } else {
287  bool productMadeAtEnd = false;
288  for (unsigned int i = 0; i < matchingHolders.size(); ++i) {
289  if ((not ambiguous[i]) and ProductResolverIndexInvalid != matchingHolders[i] and
290  productResolvers_[matchingHolders[i]]->branchDescription().availableOnlyAtEndTransition()) {
291  productMadeAtEnd = true;
292  break;
293  }
294  }
295  std::shared_ptr<ProductResolverBase> newHolder =
296  std::make_shared<NoProcessProductResolver>(matchingHolders, ambiguous, productMadeAtEnd);
297  productResolvers_.at(productResolverIndex) = newHolder;
298  }
299  }
300  }
BranchType branchType_
Definition: Principal.h:294
DelayedReader * reader_
Definition: Principal.h:292
ProcessHistoryID processHistoryIDBeforeConfig_
Definition: Principal.h:275
unsigned int ProductResolverIndex
static std::string const source("source")
ProductResolverCollection productResolvers_
Definition: Principal.h:280
std::shared_ptr< ProcessHistory const > processHistoryPtr_
Definition: Principal.h:272
PixelRecoRange< float > Range
std::map< BranchKey, BranchDescription > ProductList
static Principal::CacheIdentifier_t nextIdentifier()
Definition: Principal.cc:118
ProcessHistoryID processHistoryID_
Definition: Principal.h:274
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:299
void addUnscheduledProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:353
void addAliasedProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:361
std::vector< unsigned int > lookupProcessOrder_
Definition: Principal.h:287
deep_tau::DeepTauBase::BasicDiscriminator bd
Definition: DeepTauId.cc:808
std::shared_ptr< ProductResolverIndexHelper const > productLookup_
Definition: Principal.h:285
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:284
CacheIdentifier_t cacheIdentifier_
Definition: Principal.h:301
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:340
void addPutOnReadInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:349
void addDelayedReaderInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:345
string ranges
Definition: diffTwoXMLs.py:79
void addParentProcessProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:385
void addScheduledProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:335
void addSwitchProducerProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:369
std::vector< std::string > const & lookupProcessNames() const
ProductResolverIndexHelper const & productLookup() const
Definition: Principal.h:148
void addTransformProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:357
ProcessConfiguration const * processConfiguration_
Definition: Principal.h:277
void addSwitchAliasProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:377

◆ ~Principal()

edm::Principal::~Principal ( )
override

Definition at line 302 of file Principal.cc.

302 {}

Member Function Documentation

◆ addAliasedProduct()

void edm::Principal::addAliasedProduct ( 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->originalBranchID());
364 
365  addProductOrThrow(std::make_unique<AliasProductResolver>(
366  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
367  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:280
assert(be >=bs)
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:550
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:284
def move(src, dest)
Definition: eostools.py:511

◆ addDelayedReaderInputProduct()

void edm::Principal::addDelayedReaderInputProduct ( 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<DelayedReaderInputProductResolver>(std::move(bd)));
347  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:550
def move(src, dest)
Definition: eostools.py:511

◆ addParentProcessProduct()

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

Definition at line 385 of file Principal.cc.

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

Referenced by Principal().

385  {
386  addProductOrThrow(std::make_unique<ParentProcessProductResolver>(std::move(bd)));
387  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:550
def move(src, dest)
Definition: eostools.py:511

◆ addProduct_()

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

Definition at line 537 of file Principal.cc.

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

Referenced by addProductOrThrow().

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

◆ addProductOrThrow()

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

Definition at line 550 of file Principal.cc.

References addProduct_(), Exception, getExistingProduct(), edm::errors::InsertFailure, and eostools::move().

Referenced by addAliasedProduct(), addDelayedReaderInputProduct(), addParentProcessProduct(), addPutOnReadInputProduct(), addScheduledProduct(), addSourceProduct(), addSwitchAliasProduct(), addSwitchProducerProduct(), addTransformProduct(), and addUnscheduledProduct().

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

◆ addPutOnReadInputProduct()

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

Definition at line 349 of file Principal.cc.

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

Referenced by adjustIndexesAfterProductRegistryAddition(), and Principal().

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

◆ addScheduledProduct()

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

Definition at line 335 of file Principal.cc.

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

Referenced by Principal().

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

◆ addSourceProduct()

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

Definition at line 340 of file Principal.cc.

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

Referenced by Principal().

340  {
341  auto phb = std::make_unique<PuttableProductResolver>(std::move(bd));
343  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:550
def move(src, dest)
Definition: eostools.py:511

◆ addSwitchAliasProduct()

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

Definition at line 377 of file Principal.cc.

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

Referenced by Principal().

377  {
378  ProductResolverIndex index = preg_->indexFrom(bd->switchAliasForBranchID());
380 
381  addProductOrThrow(std::make_unique<SwitchAliasProductResolver>(
382  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
383  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:280
assert(be >=bs)
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:550
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:284
def move(src, dest)
Definition: eostools.py:511

◆ addSwitchProducerProduct()

void edm::Principal::addSwitchProducerProduct ( 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<SwitchProducerProductResolver>(
374  std::move(bd), dynamic_cast<DataManagingOrAliasProductResolver&>(*productResolvers_[index])));
375  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:280
assert(be >=bs)
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:550
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:284
def move(src, dest)
Definition: eostools.py:511

◆ addTransformProduct()

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

Definition at line 357 of file Principal.cc.

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

Referenced by Principal().

357  {
358  addProductOrThrow(std::make_unique<TransformingProductResolver>(std::move(bd)));
359  }
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
Definition: Principal.cc:550
def move(src, dest)
Definition: eostools.py:511

◆ addUnscheduledProduct()

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

Definition at line 353 of file Principal.cc.

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

Referenced by Principal().

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

◆ adjustIndexesAfterProductRegistryAddition()

void edm::Principal::adjustIndexesAfterProductRegistryAddition ( )

Definition at line 975 of file Principal.cc.

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

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

975  {
976  if (preg_->getNextIndexValue(branchType_) != productResolvers_.size()) {
977  bool changed = false;
978  productResolvers_.resize(preg_->getNextIndexValue(branchType_));
979  for (auto const& prod : preg_->productList()) {
980  BranchDescription const& bd = prod.second;
981  if (bd.branchType() == branchType_) {
982  ProductResolverIndex index = preg_->indexFrom(bd.branchID());
984  if (!productResolvers_[index]) {
985  // no product holder. Must add one. The new entry must be an input product holder.
986  assert(!bd.produced());
987  auto cbd = std::make_shared<BranchDescription const>(bd);
988  if (bd.onDemand()) {
990  } else {
992  }
993  changed = true;
994  }
995  }
996  }
997  if (changed) {
998  changedIndexes_();
999  }
1000  }
1001  assert(preg_->getNextIndexValue(branchType_) == productResolvers_.size());
1002  }
BranchType branchType_
Definition: Principal.h:294
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:280
assert(be >=bs)
deep_tau::DeepTauBase::BasicDiscriminator bd
Definition: DeepTauId.cc:808
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:284
virtual void changedIndexes_()
Definition: Principal.h:225
void addPutOnReadInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:349
void addDelayedReaderInputProduct(std::shared_ptr< BranchDescription const > bd)
Definition: Principal.cc:345

◆ adjustToNewProductRegistry()

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

Definition at line 319 of file Principal.cc.

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

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

319  {
320  ProductRegistry::ProductList const& prodsList = reg.productList();
321  for (auto const& prod : prodsList) {
322  BranchDescription const& bd = prod.second;
323  if (!bd.produced() && (bd.branchType() == branchType_)) {
324  auto cbd = std::make_shared<BranchDescription const>(bd);
325  auto phb = getExistingProduct(cbd->branchID());
326  if (phb == nullptr || phb->branchDescription().branchName() != cbd->branchName()) {
327  return false;
328  }
329  phb->resetBranchDescription(cbd);
330  }
331  }
332  return true;
333  }
BranchType branchType_
Definition: Principal.h:294
std::map< BranchKey, BranchDescription > ProductList
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:509
deep_tau::DeepTauBase::BasicDiscriminator bd
Definition: DeepTauId.cc:808
void resetBranchDescription(std::shared_ptr< BranchDescription const > bd)

◆ applyToResolvers()

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:280

◆ begin() [1/2]

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:280

◆ begin() [2/2]

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:280

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

Referenced by adjustIndexesAfterProductRegistryAddition().

225 {}

◆ clearPrincipal()

void edm::Principal::clearPrincipal ( )

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

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

◆ deleteProduct()

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

Definition at line 400 of file Principal.cc.

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

400  {
401  auto phb = getExistingProduct(id);
402  assert(nullptr != phb);
403  phb->unsafe_deleteProduct();
404  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:509
assert(be >=bs)

◆ end() [1/2]

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:280

◆ end() [2/2]

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:280

◆ fillPrincipal() [1/3]

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

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

410  {
411  //increment identifier here since clearPrincipal isn't called for Run/Lumi
413  if (reader) {
414  reader_ = reader;
415  }
416  }
DelayedReader * reader_
Definition: Principal.h:292
static Principal::CacheIdentifier_t nextIdentifier()
Definition: Principal.cc:118
CacheIdentifier_t cacheIdentifier_
Definition: Principal.h:301
DelayedReader * reader() const
Definition: Principal.h:187

◆ fillPrincipal() [2/3]

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

Definition at line 419 of file Principal.cc.

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

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

◆ fillPrincipal() [3/3]

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

Definition at line 496 of file Principal.cc.

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

496  {
498 
499  std::vector<std::string> const& lookupProcessNames = productLookup_->lookupProcessNames();
500  lookupProcessOrder_.assign(lookupProcessNames.size(), 0);
501  if (!lookupProcessOrder_.empty()) {
502  auto iter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processNameOfBlock);
503  if (iter != lookupProcessNames.end()) {
504  lookupProcessOrder_[0] = iter - lookupProcessNames.begin();
505  }
506  }
507  }
void fillPrincipal(DelayedReader *reader)
Definition: Principal.cc:410
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:287
std::shared_ptr< ProductResolverIndexHelper const > productLookup_
Definition: Principal.h:285
DelayedReader * reader() const
Definition: Principal.h:187

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

757  {
758  bool skipCurrentProcess = inputTag.willSkipCurrentProcess();
759 
761 
763  char const* processName = inputTag.process().c_str();
764  if (skipCurrentProcess) {
765  processName = "\0";
766  } else if (inputTag.process() == InputTag::kCurrentProcess) {
768  }
769 
770  index =
771  productLookup().index(kindOfType, typeID, inputTag.label().c_str(), inputTag.instance().c_str(), processName);
772 
774  throwAmbiguousException("findProductByLabel",
775  typeID,
776  inputTag.label(),
777  inputTag.instance(),
779  } else if (index == ProductResolverIndexInvalid) {
780  // can occur because of missing consumes if nothing else in the process consumes the product
781  for (auto const& item : preg_->productList()) {
782  auto const& bd = item.second;
783  if (bd.present() and bd.unwrappedTypeID() == typeID and bd.moduleLabel() == inputTag.label() and
784  bd.productInstanceName() == inputTag.instance()) {
785  bool const inCurrentProcess = bd.processName() == processConfiguration_->processName();
786  if (inputTag.process().empty() or bd.processName() == inputTag.process() or
787  (skipCurrentProcess and not inCurrentProcess) or
788  (inputTag.process() == InputTag::kCurrentProcess and inCurrentProcess)) {
789  failedToRegisterConsumes(
790  kindOfType,
791  typeID,
792  inputTag.label(),
793  inputTag.instance(),
795  }
796  }
797  }
798  return nullptr;
799  }
800  inputTag.tryToCacheIndex(index, typeID, branchType(), &productRegistry());
801  }
802  if (UNLIKELY(consumer and (not consumer->registeredToConsume(index, skipCurrentProcess, branchType())))) {
803  failedToRegisterConsumes(kindOfType,
804  typeID,
805  inputTag.label(),
806  inputTag.instance(),
808  }
809 
810  auto const& productResolver = productResolvers_[index];
811 
812  auto resolution = productResolver->resolveProduct(*this, skipCurrentProcess, sra, mcc);
813  if (resolution.isAmbiguous()) {
814  throwAmbiguousException("findProductByLabel",
815  typeID,
816  inputTag.label(),
817  inputTag.instance(),
819  }
820  return resolution.data();
821  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:280
ProductRegistry const & productRegistry() const
Definition: Principal.h:146
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:284
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: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:277
BranchType const & branchType() const
Definition: Principal.h:181

◆ 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 823 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.

830  {
832  productLookup().index(kindOfType, typeID, label.c_str(), instance.c_str(), process.c_str());
833 
835  throwAmbiguousException("findProductByLabel", typeID, label, instance, process);
836  } else if (index == ProductResolverIndexInvalid) {
837  // can occur because of missing consumes if nothing else in the process consumes the product
838  for (auto const& item : preg_->productList()) {
839  auto const& bd = item.second;
840  if (bd.present() and bd.unwrappedTypeID() == typeID and bd.moduleLabel() == label and
841  bd.productInstanceName() == instance) {
842  if (process.empty() or bd.processName() == process) {
843  failedToRegisterConsumes(kindOfType, typeID, label, instance, process);
844  }
845  }
846  }
847  return nullptr;
848  }
849 
850  if (UNLIKELY(consumer and (not consumer->registeredToConsume(index, false, branchType())))) {
851  failedToRegisterConsumes(kindOfType, typeID, label, instance, process);
852  }
853 
854  auto const& productResolver = productResolvers_[index];
855 
856  auto resolution = productResolver->resolveProduct(*this, false, sra, mcc);
857  if (resolution.isAmbiguous()) {
858  throwAmbiguousException("findProductByLabel", typeID, label, instance, process);
859  }
860  return resolution.data();
861  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:280
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:284
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:148
#define UNLIKELY(x)
Definition: Likely.h:21
BranchType const & branchType() const
Definition: Principal.h:181

◆ findProductByTag()

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

Definition at line 863 of file Principal.cc.

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

865  {
866  // Not implemented for ProcessBlocks
868 
869  ProductData const* productData = findProductByLabel(PRODUCT_TYPE, typeID, tag, nullptr, nullptr, mcc);
870  return productData;
871  }
BranchType branchType_
Definition: Principal.h:294
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:752

◆ findProducts()

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

Definition at line 727 of file Principal.cc.

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

Referenced by getManyByType().

731  {
732  for (auto iter = processHistoryPtr_->rbegin(), iEnd = processHistoryPtr_->rend(); iter != iEnd; ++iter) {
733  std::string const& process = iter->processName();
734  for (auto productResolver : holders) {
735  BranchDescription const& bd = productResolver->branchDescription();
736  if (process == bd.processName()) {
737  // Ignore aliases to avoid matching the same product multiple times.
738  if (bd.isAnyAlias()) {
739  continue;
740  }
741 
742  ProductData const* productData = productResolver->resolveProduct(*this, false, sra, mcc).data();
743  if (productData) {
744  // Skip product if not available.
745  results.emplace_back(productData->wrapper(), &(productData->provenance()));
746  }
747  }
748  }
749  }
750  }
std::shared_ptr< ProcessHistory const > processHistoryPtr_
Definition: Principal.h:272

◆ getAllProvenance()

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

Definition at line 898 of file Principal.cc.

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

898  {
899  provenances.clear();
900  for (auto const& productResolver : *this) {
901  if (productResolver->singleProduct() && productResolver->provenanceAvailable() &&
902  !productResolver->branchDescription().isAnyAlias()) {
903  // We do not attempt to get the event/lumi/run status from the provenance,
904  // because the per event provenance may have been dropped.
905  if (productResolver->provenance()->branchDescription().present()) {
906  provenances.push_back(productResolver->provenance());
907  }
908  }
909  }
910  }

◆ getAllStableProvenance()

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

Definition at line 915 of file Principal.cc.

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

915  {
916  provenances.clear();
917  for (auto const& productResolver : *this) {
918  if (productResolver->singleProduct() && !productResolver->branchDescription().isAnyAlias()) {
919  if (productResolver->stableProvenance()->branchDescription().present()) {
920  provenances.push_back(productResolver->stableProvenance());
921  }
922  }
923  }
924  }

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

584  {
585  // Not implemented for ProcessBlocks, it might work though, not tested
586  // The other getByLabel function is used for ProcessBlocks by TestProcessor
588 
589  ProductData const* result = findProductByLabel(kindOfType, typeID, inputTag, consumer, sra, mcc);
590  if (result == nullptr) {
591  return BasicHandle(makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> {
592  return makeNotFoundException(
593  "getByLabel",
594  kindOfType,
595  typeID,
596  inputTag.label(),
597  inputTag.instance(),
599  }));
600  }
601  return BasicHandle(result->wrapper(), &(result->provenance()));
602  }
BranchType branchType_
Definition: Principal.h:294
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:752
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:277

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

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

611  {
612  ProductData const* result = findProductByLabel(kindOfType, typeID, label, instance, process, consumer, sra, mcc);
613  if (result == nullptr) {
614  return BasicHandle(makeHandleExceptionFactory([=]() -> std::shared_ptr<cms::Exception> {
615  return makeNotFoundException("getByLabel", kindOfType, typeID, label, instance, process);
616  }));
617  }
618  return BasicHandle(result->wrapper(), &(result->provenance()));
619  }
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:752
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 621 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_().

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

◆ getExistingProduct() [1/3]

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

Definition at line 509 of file Principal.cc.

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

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

◆ getExistingProduct() [2/3]

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

Definition at line 513 of file Principal.cc.

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

513  {
514  ProductResolverIndex index = preg_->indexFrom(branchID);
516  return productResolvers_.at(index).get();
517  }
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:280
assert(be >=bs)
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:284

◆ getExistingProduct() [3/3]

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

Definition at line 519 of file Principal.cc.

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

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

◆ getIt()

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

Implements edm::EDProductGetter.

Definition at line 937 of file Principal.cc.

References cms::cuda::assert().

937  {
938  assert(false);
939  return nullptr;
940  }
assert(be >=bs)

◆ getManyByType()

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

Definition at line 657 of file Principal.cc.

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

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

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

◆ getModifiableProductResolver()

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:562

◆ getProductResolver()

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

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

562  {
563  ProductResolverIndex index = preg_->indexFrom(bid);
565  return ConstProductResolverPtr();
566  }
568  }
unsigned int ProductResolverIndex
std::shared_ptr< ProductRegistry const > preg_
Definition: Principal.h:284
ProductResolverBase const * ConstProductResolverPtr
Definition: Principal.h:62
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
Definition: Principal.cc:570

◆ getProductResolverByIndex()

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

◆ getProvenance()

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

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

873  {
875  if (phb == nullptr) {
877  }
878 
879  if (phb->unscheduledWasNotRun()) {
881  << "Requesting provenance from unrun EDProducer. The requested branch ID was: " << bid;
882  }
883  return *phb->provenance();
884  }
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:562

◆ getStableProvenance()

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

Definition at line 886 of file Principal.cc.

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

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

886  {
888  if (phb == nullptr) {
889  throwProductNotFoundException("getStableProvenance", errors::ProductNotFound, bid);
890  }
891  //NOTE: in all implementations, this never returns a nullptr
892  return *phb->stableProvenance();
893  }
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:562

◆ getThinnedKeyFrom()

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

Implements edm::EDProductGetter.

Definition at line 954 of file Principal.cc.

References cms::cuda::assert().

954  {
955  assert(false);
956  return std::monostate{};
957  }
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 942 of file Principal.cc.

References cms::cuda::assert().

943  {
944  assert(false);
945  return std::nullopt;
946  }
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 948 of file Principal.cc.

References cms::cuda::assert().

950  {
951  assert(false);
952  }
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 647 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().

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

◆ processBlockIndex()

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

Reimplemented in edm::EventPrincipal.

Definition at line 575 of file Principal.cc.

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

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

575  {
576  throw Exception(errors::LogicError) << "Principal::processBlockIndex not implemented for this type of Principal";
577  }

◆ processConfiguration()

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:277

◆ 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 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:285

◆ productRegistry()

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:284

◆ put_() [1/2]

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

Definition at line 963 of file Principal.cc.

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

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

963  {
964  if (edp.get() == nullptr) {
965  throw edm::Exception(edm::errors::InsertFailure, "Null Pointer")
966  << "put: Cannot put because unique_ptr to product is null."
967  << "\n";
968  }
969  auto phb = getExistingProduct(bd.branchID());
970  assert(phb);
971  // ProductResolver assumes ownership
972  put_(std::move(edp), phb);
973  }
ProductResolverBase * getExistingProduct(BranchID const &branchID)
Definition: Principal.cc:509
assert(be >=bs)
void put_(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
Definition: Principal.cc:963
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 959 of file Principal.cc.

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

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

◆ readAllFromSourceAndMergeImmediately()

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

Definition at line 1004 of file Principal.cc.

References dumpMFGeometry_cfg::prod, and reader().

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

1004  {
1005  if (not reader()) {
1006  return;
1007  }
1008 
1009  for (auto& prod : *this) {
1010  prod->retrieveAndMerge(*this, mergeableRunProductMetadata);
1011  }
1012  }
DelayedReader * reader() const
Definition: Principal.h:187

◆ reader()

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

◆ recombine()

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

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

926  {
927  for (auto& prod : bids) {
928  ProductResolverIndex index = preg_->indexFrom(prod);
930  ProductResolverIndex indexO = other.preg_->indexFrom(prod);
932  get_underlying_safe(productResolvers_[index]).swap(get_underlying_safe(other.productResolvers_[indexO]));
933  }
934  reader_->mergeReaders(other.reader());
935  }
DelayedReader * reader_
Definition: Principal.h:292
unsigned int ProductResolverIndex
ProductResolverCollection productResolvers_
Definition: Principal.h:280
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:284

◆ setupUnscheduled()

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

Definition at line 406 of file Principal.cc.

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

406  {
407  applyToResolvers([&iConfigure](ProductResolverBase* iResolver) { iResolver->setupUnscheduled(iConfigure); });
408  }
void applyToResolvers(F iFunc)
Definition: Principal.h:217

◆ size()

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

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

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

Member Data Documentation

◆ branchType_

BranchType edm::Principal::branchType_
private

◆ cacheIdentifier_

CacheIdentifier_t edm::Principal::cacheIdentifier_
private

Definition at line 301 of file Principal.h.

Referenced by cacheIdentifier(), and fillPrincipal().

◆ historyAppender_

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

Definition at line 299 of file Principal.h.

Referenced by fillPrincipal().

◆ lookupProcessOrder_

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

Definition at line 287 of file Principal.h.

Referenced by fillPrincipal(), and lookupProcessOrder().

◆ orderProcessHistoryID_

ProcessHistoryID edm::Principal::orderProcessHistoryID_
private

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

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

◆ processHistoryID_

ProcessHistoryID edm::Principal::processHistoryID_
private

Definition at line 274 of file Principal.h.

Referenced by fillPrincipal(), and processHistoryID().

◆ processHistoryIDBeforeConfig_

ProcessHistoryID edm::Principal::processHistoryIDBeforeConfig_
private

Definition at line 275 of file Principal.h.

Referenced by fillPrincipal().

◆ processHistoryPtr_

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

Definition at line 272 of file Principal.h.

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

◆ productLookup_

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

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

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