4 #pragma GCC diagnostic ignored "-Wc++20-extensions" 44 returnValue += currentProcess;
48 return processFromInputTag;
52 throw Exception(
error,
"InvalidID") <<
"Principal::" << where <<
": no product with given branch id: " << bid
65 <<
": Found zero products matching all criteria\nLooking for type: " << productType <<
"\n" 66 <<
"Looking for module label: " <<
label <<
"\n" 67 <<
"Looking for productInstanceName: " <<
instance <<
"\n" 68 << (
process.empty() ?
"" :
"Looking for process: ") <<
process <<
"\n";
71 <<
": Found zero products matching all criteria\nLooking for a container with elements of type: " 72 << productType <<
"\n" 73 <<
"Looking for module label: " <<
label <<
"\n" 74 <<
"Looking for productInstanceName: " <<
instance <<
"\n" 75 << (
process.empty() ?
"" :
"Looking for process: ") <<
process <<
"\n";
87 <<
": More than 1 product matches all criteria\nLooking for type: " << productType <<
"\n" 88 <<
"Looking for module label: " <<
label <<
"\n" 89 <<
"Looking for productInstanceName: " <<
instance <<
"\n" 90 << (
process.empty() ?
"" :
"Looking for process: ") <<
process <<
"\n" 91 <<
"This can only occur with get function calls using a Handle<View> argument.\n" 92 <<
"Try a get not using a View or change the instance name of one of the products";
97 void failedToRegisterConsumes(
KindOfType kindOfType,
98 TypeID
const& productType,
103 exception <<
"::getByLabel without corresponding call to consumes or mayConsumes for this module.\n" 104 << (kindOfType ==
PRODUCT_TYPE ?
" type: " :
" type: edm::View<") << productType
106 <<
"\n product instance name: '" << productInstanceName <<
"'\n process name: '" <<
processName 119 std::shared_ptr<ProductResolverIndexHelper const> productLookup,
123 bool isForPrimaryProcess)
125 processHistoryPtr_(),
127 processHistoryIDBeforeConfig_(),
128 processConfiguration_(&pc),
131 productLookup_(productLookup),
132 lookupProcessOrder_(productLookup->lookupProcessNames().size(), 0),
135 historyAppender_(historyAppender),
144 bool hasAliases =
false;
145 bool hasSwitchAliases =
false;
146 for (
auto const&
prod : prodsList) {
153 hasSwitchAliases =
true;
155 auto cbd = std::make_shared<BranchDescription const>(bd);
179 auto cbd = std::make_shared<BranchDescription const>(bd);
186 for (
auto const&
prod : prodsList) {
194 if (hasSwitchAliases) {
195 for (
auto const&
prod : prodsList) {
199 auto cbd = std::make_shared<BranchDescription const>(bd);
217 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
219 std::vector<bool> ambiguous(lookupProcessNames.size(),
false);
221 std::vector<TypeID>
const& sortedTypeIDs =
productLookup_->sortedTypeIDs();
223 std::vector<ProductResolverIndexHelper::IndexAndNames>
const& indexAndNames =
productLookup_->indexAndNames();
224 std::vector<char>
const& processNamesCharArray =
productLookup_->processNames();
226 unsigned int numberOfMatches = 0;
228 if (!sortedTypeIDs.empty()) {
230 for (
unsigned int k = 0, kEnd = sortedTypeIDs.size();
k < kEnd; ++
k) {
239 std::make_shared<SingleChoiceNoProcessProductResolver>(lastMatchIndex);
241 bool productMadeAtEnd =
false;
243 for (
unsigned int j = 0;
j < matchingHolders.size(); ++
j) {
245 productResolvers_[matchingHolders[
j]]->branchDescription().availableOnlyAtEndTransition()) {
246 productMadeAtEnd =
true;
250 std::shared_ptr<ProductResolverBase> newHolder =
251 std::make_shared<NoProcessProductResolver>(matchingHolders, ambiguous, productMadeAtEnd);
255 ambiguous.assign(lookupProcessNames.size(),
false);
259 productResolverIndex = product.
index();
262 auto iter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(),
process);
263 assert(iter != lookupProcessNames.end());
265 lastMatchIndex = iMatchingIndex;
270 ambiguous.at(iter - lookupProcessNames.begin()) =
true;
272 matchingHolders.at(iter - lookupProcessNames.begin()) = iMatchingIndex;
281 std::make_shared<SingleChoiceNoProcessProductResolver>(lastMatchIndex);
283 bool productMadeAtEnd =
false;
284 for (
unsigned int i = 0;
i < matchingHolders.size(); ++
i) {
286 productResolvers_[matchingHolders[
i]]->branchDescription().availableOnlyAtEndTransition()) {
287 productMadeAtEnd =
true;
291 std::shared_ptr<ProductResolverBase> newHolder =
292 std::make_shared<NoProcessProductResolver>(matchingHolders, ambiguous, productMadeAtEnd);
305 for (
auto const&
prod : *
this) {
306 if (
prod->singleProduct() &&
307 !
prod->productUnavailable() && !
prod->unscheduledWasNotRun() && !
prod->branchDescription().dropped()) {
317 for (
auto const&
prod : prodsList) {
320 auto cbd = std::make_shared<BranchDescription const>(bd);
322 if (phb ==
nullptr || phb->branchDescription().branchName() != cbd->branchName()) {
332 auto phb = std::make_unique<PuttableProductResolver>(
std::move(bd));
337 auto phb = std::make_unique<PuttableProductResolver>(
std::move(bd));
391 for (
auto&
prod : *
this) {
392 prod->resetProductData();
399 phb->unsafe_deleteProduct();
427 std::shared_ptr<ProcessHistory const> inputProcessHistory;
429 if (
hist.isValid()) {
431 auto noDel = [](
void const*) {};
432 inputProcessHistory = std::shared_ptr<ProcessHistory const>(
processHistory, noDel);
433 if (inputProcessHistory.get() ==
nullptr) {
435 <<
"Input ProcessHistory not found in registry\n" 436 <<
"Contact a Framework developer\n";
440 inputProcessHistory = std::shared_ptr<ProcessHistory const>(&
s_emptyProcessHistory, [](
void const*) {});
451 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
464 auto nameIterCurrentProcess =
466 if (nameIterCurrentProcess != lookupProcessNames.end()) {
480 auto nameIter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(), iter->processName());
481 if (nameIter == lookupProcessNames.end()) {
495 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
498 auto iter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processNameOfBlock);
499 if (iter != lookupProcessNames.end()) {
522 <<
"Principal::getExistingProduct\n" 523 <<
" Branch " << newProduct.
branchName() <<
" has same branch ID as branch " <<
existing.branchName()
525 <<
"Workaround: change process name or product instance name of " << newProduct.
branchName() <<
"\n";
548 if (phb !=
nullptr) {
551 <<
"addProductOrThrow: Problem found while adding product, " 620 bool skipCurrentProcess,
626 assert(
nullptr != productResolver.get());
627 auto resolution = productResolver->resolveProduct(*
this, skipCurrentProcess, sra, mcc);
635 if (productData ==
nullptr) {
640 return BasicHandle(productData->wrapper(), &(productData->provenance()));
645 bool skipCurrentProcess,
649 assert(
nullptr != productResolver.get());
650 productResolver->prefetchAsync(
task, *
this, skipCurrentProcess,
token,
nullptr, mcc);
659 bool skipCurrentProcess =
inputTag.willSkipCurrentProcess();
665 if (skipCurrentProcess) {
682 for (
auto const&
item :
preg_->productList()) {
683 auto const& bd =
item.second;
684 if (bd.present() and bd.unwrappedTypeID() == typeID and bd.moduleLabel() ==
inputTag.label() and
685 bd.productInstanceName() ==
inputTag.instance()) {
688 (skipCurrentProcess and not inCurrentProcess)
or 690 failedToRegisterConsumes(
704 failedToRegisterConsumes(kindOfType,
713 auto resolution = productResolver->resolveProduct(*
this, skipCurrentProcess, sra, mcc);
739 for (
auto const&
item :
preg_->productList()) {
740 auto const& bd =
item.second;
741 if (bd.present() and bd.unwrappedTypeID() == typeID and bd.moduleLabel() ==
label and
742 bd.productInstanceName() ==
instance) {
757 auto resolution = productResolver->resolveProduct(*
this,
false, sra, mcc);
776 if (phb ==
nullptr) {
780 if (phb->unscheduledWasNotRun()) {
782 <<
"Requesting provenance from unrun EDProducer. The requested branch ID was: " << bid;
784 return *phb->provenance();
789 if (phb ==
nullptr) {
793 return *phb->stableProvenance();
801 for (
auto const& productResolver : *
this) {
802 if (productResolver->singleProduct() && productResolver->provenanceAvailable() &&
803 !productResolver->branchDescription().isAnyAlias()) {
806 if (productResolver->provenance()->branchDescription().present()) {
807 provenances.push_back(productResolver->provenance());
818 for (
auto const& productResolver : *
this) {
819 if (productResolver->singleProduct() && !productResolver->branchDescription().isAnyAlias()) {
820 if (productResolver->stableProvenance()->branchDescription().present()) {
821 provenances.push_back(productResolver->stableProvenance());
828 for (
auto&
prod : bids) {
844 unsigned int)
const {
850 std::vector<WrapperBase const*>&,
851 std::vector<unsigned int>&)
const {
857 return std::monostate{};
865 if (edp.get() ==
nullptr) {
867 <<
"put: Cannot put because unique_ptr to product is null." 878 bool changed =
false;
880 for (
auto const&
prod :
preg_->productList()) {
888 auto cbd = std::make_shared<BranchDescription const>(bd);
910 for (
auto&
prod : *
this) {
911 prod->retrieveAndMerge(*
this, mergeableRunProductMetadata);
std::optional< std::tuple< WrapperBase const *, unsigned int > > getThinnedProduct(ProductID const &, unsigned int) const override
void fillPrincipal(DelayedReader *reader)
static ProcessHistory const s_emptyProcessHistory
void getAllProvenance(std::vector< Provenance const *> &provenances) const
ProcessHistoryID processHistoryIDBeforeConfig_
void setupUnscheduled(UnscheduledConfigurator const &)
unsigned int ProductResolverIndex
BasicHandle getByToken(KindOfType kindOfType, TypeID const &typeID, ProductResolverIndex index, bool skipCurrentProcess, bool &ambiguous, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
static std::string const source("source")
ProductResolverCollection productResolvers_
std::variant< unsigned int, detail::GetThinnedKeyFromExceptionFactory, std::monostate > OptionalThinnedKey
std::shared_ptr< ProcessHistory const > processHistoryPtr_
ProductList const & productList() const
BranchID const & branchID() const
static PFTauRenderPlugin instance
ProductRegistry const & productRegistry() const
std::shared_ptr< ProductResolverBase > SharedProductPtr
void addProduct_(std::unique_ptr< ProductResolverBase > phb)
BranchType const & branchType() const
static std::atomic< Principal::CacheIdentifier_t > s_nextIdentifier
StableProvenance const & getStableProvenance(BranchID const &bid) const
std::map< BranchKey, BranchDescription > ProductList
static Principal::CacheIdentifier_t nextIdentifier()
ProcessHistoryID processHistoryID_
void mergeReaders(DelayedReader *other)
ProductResolverBase * getExistingProduct(BranchID const &branchID)
virtual void setupUnscheduled(UnscheduledConfigurator const &)
void getThinnedProducts(ProductID const &, std::vector< WrapperBase const *> &, std::vector< unsigned int > &) const override
void applyToResolvers(F iFunc)
std::string const & processName() const
void prefetchAsync(WaitingTaskHolder waitTask, ProductResolverIndex index, bool skipCurrentProcess, ServiceToken const &token, ModuleCallingContext const *mcc) const
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
edm::propagate_const< HistoryAppender * > historyAppender_
Principal(std::shared_ptr< ProductRegistry const > reg, std::shared_ptr< ProductResolverIndexHelper const > productLookup, ProcessConfiguration const &pc, BranchType bt, HistoryAppender *historyAppender, bool isForPrimaryProcess=true)
std::string const & friendlyClassName() const
void addUnscheduledProduct(std::shared_ptr< BranchDescription const > bd)
ProductData const * findProductByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumer, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
void addAliasedProduct(std::shared_ptr< BranchDescription const > bd)
static void throwAmbiguousException(const char *where, TypeID const &productType, std::string const &label, std::string const &instance, std::string const &process)
std::vector< unsigned int > lookupProcessOrder_
virtual unsigned int processBlockIndex(std::string const &processName) const
WrapperBase const * getIt(ProductID const &) const override
std::shared_ptr< ProductResolverIndexHelper const > productLookup_
std::string const & className() const
std::string const & branchName() const
void addProductOrThrow(std::unique_ptr< ProductResolverBase > phb)
std::shared_ptr< ProductRegistry const > preg_
CacheIdentifier_t cacheIdentifier_
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=nullptr) const
std::string const & productInstanceName() const
std::shared_ptr< HandleExceptionFactory > makeHandleExceptionFactory(T &&iFunctor)
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
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
void getAllStableProvenance(std::vector< StableProvenance const *> &provenances) const
ProcessHistoryID orderProcessHistoryID_
virtual void changedIndexes_()
void addSourceProduct(std::shared_ptr< BranchDescription const > bd)
void addPutOnReadInputProduct(std::shared_ptr< BranchDescription const > bd)
void deleteProduct(BranchID const &id) const
bool isSwitchAlias() const
void addDelayedReaderInputProduct(std::shared_ptr< BranchDescription const > bd)
void put_(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp) const
void addParentProcessProduct(std::shared_ptr< BranchDescription const > bd)
ProductData const * findProductByTag(TypeID const &typeID, InputTag const &tag, ModuleCallingContext const *mcc) const
void addScheduledProduct(std::shared_ptr< BranchDescription const > bd)
static BasicHandle makeInvalid()
ProcessHistory const & processHistory() const
void addSwitchProducerProduct(std::shared_ptr< BranchDescription const > bd)
BranchDescription const & branchDescription() const
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)
ProductResolverBase const * ConstProductResolverPtr
std::string const & processName() const
void readAllFromSourceAndMergeImmediately(MergeableRunProductMetadata const *mergeableRunProductMetadata=nullptr)
unsigned long CacheIdentifier_t
bool adjustToNewProductRegistry(ProductRegistry const ®)
Provenance const & getProvenance(BranchID const &bid) const
void adjustIndexesAfterProductRegistryAddition()
static void throwProductNotFoundException(char const *where, errors::ErrorCodes error, BranchID const &bid)
ProductResolverIndexHelper const & productLookup() const
void addTransformProduct(std::shared_ptr< BranchDescription const > bd)
static std::string appendCurrentProcessIfAlias(std::string const &processFromInputTag, std::string const ¤tProcess)
OptionalThinnedKey getThinnedKeyFrom(ProductID const &parent, unsigned int key, ProductID const &thinned) const override
unsigned int startInProcessNames() const
ProductResolverIndex index() const
void recombine(Principal &other, std::vector< BranchID > const &bids)
ConstProductResolverPtr getProductResolverByIndex(ProductResolverIndex const &oid) const
std::string const & moduleLabel() const
void resetBranchDescription(std::shared_ptr< BranchDescription const > bd)
ProcessConfiguration const * processConfiguration_
void addSwitchAliasProduct(std::shared_ptr< BranchDescription const > bd)
DelayedReader * reader() const
BranchType const & branchType() const
ConstProductResolverPtr getProductResolver(BranchID const &oid) const