40 returnValue += currentProcess;
44 return processFromInputTag;
48 throw Exception(
error,
"InvalidID") <<
"Principal::" << where <<
": no product with given branch id: " << bid
61 <<
": Found zero products matching all criteria\nLooking for type: " << productType <<
"\n"
62 <<
"Looking for module label: " <<
label <<
"\n"
63 <<
"Looking for productInstanceName: " <<
instance <<
"\n"
64 << (
process.empty() ?
"" :
"Looking for process: ") <<
process <<
"\n";
67 <<
": Found zero products matching all criteria\nLooking for a container with elements of type: "
68 << productType <<
"\n"
69 <<
"Looking for module label: " <<
label <<
"\n"
70 <<
"Looking for productInstanceName: " <<
instance <<
"\n"
71 << (
process.empty() ?
"" :
"Looking for process: ") <<
process <<
"\n";
83 <<
": More than 1 product matches all criteria\nLooking for type: " << productType <<
"\n"
84 <<
"Looking for module label: " <<
label <<
"\n"
85 <<
"Looking for productInstanceName: " <<
instance <<
"\n"
86 << (
process.empty() ?
"" :
"Looking for process: ") <<
process <<
"\n"
87 <<
"This can only occur with get function calls using a Handle<View> argument.\n"
88 <<
"Try a get not using a View or change the instance name of one of the products";
93 void failedToRegisterConsumesMany(
edm::TypeID const& iType) {
95 exception <<
"::getManyByType called for " << iType
96 <<
" without a corresponding consumesMany being called for this module. \n";
100 void failedToRegisterConsumes(
KindOfType kindOfType,
101 TypeID
const& productType,
106 exception <<
"::getByLabel without corresponding call to consumes or mayConsumes for this module.\n"
107 << (kindOfType ==
PRODUCT_TYPE ?
" type: " :
" type: edm::View<") << productType
109 <<
"\n product instance name: '" << productInstanceName <<
"'\n process name: '" <<
processName
122 std::shared_ptr<ProductResolverIndexHelper const> productLookup,
126 bool isForPrimaryProcess)
128 processHistoryPtr_(),
130 processHistoryIDBeforeConfig_(),
131 processConfiguration_(&pc),
134 productLookup_(productLookup),
135 lookupProcessOrder_(productLookup->lookupProcessNames().
size(), 0),
138 historyAppender_(historyAppender),
147 bool hasAliases =
false;
148 bool hasSwitchAliases =
false;
149 for (
auto const&
prod : prodsList) {
155 }
else if (
bd.isSwitchAlias()) {
156 hasSwitchAliases =
true;
158 auto cbd = std::make_shared<BranchDescription const>(
bd);
162 }
else if (
bd.onDemand()) {
174 auto cbd = std::make_shared<BranchDescription const>(
bd);
181 for (
auto const&
prod : prodsList) {
189 if (hasSwitchAliases) {
190 for (
auto const&
prod : prodsList) {
194 auto cbd = std::make_shared<BranchDescription const>(
bd);
212 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
214 std::vector<bool> ambiguous(lookupProcessNames.size(),
false);
216 std::vector<TypeID>
const& sortedTypeIDs =
productLookup_->sortedTypeIDs();
218 std::vector<ProductResolverIndexHelper::IndexAndNames>
const& indexAndNames =
productLookup_->indexAndNames();
219 std::vector<char>
const& processNamesCharArray =
productLookup_->processNames();
221 unsigned int numberOfMatches = 0;
223 if (!sortedTypeIDs.empty()) {
225 for (
unsigned int k = 0, kEnd = sortedTypeIDs.size();
k < kEnd; ++
k) {
234 std::make_shared<SingleChoiceNoProcessProductResolver>(lastMatchIndex);
236 bool productMadeAtEnd =
false;
238 for (
unsigned int j = 0;
j < matchingHolders.size(); ++
j) {
240 productResolvers_[matchingHolders[
j]]->branchDescription().availableOnlyAtEndTransition()) {
241 productMadeAtEnd =
true;
245 std::shared_ptr<ProductResolverBase> newHolder =
246 std::make_shared<NoProcessProductResolver>(matchingHolders, ambiguous, productMadeAtEnd);
250 ambiguous.assign(lookupProcessNames.size(),
false);
254 productResolverIndex = product.
index();
257 auto iter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(),
process);
258 assert(iter != lookupProcessNames.end());
260 lastMatchIndex = iMatchingIndex;
265 ambiguous.at(iter - lookupProcessNames.begin()) =
true;
267 matchingHolders.at(iter - lookupProcessNames.begin()) = iMatchingIndex;
276 std::make_shared<SingleChoiceNoProcessProductResolver>(lastMatchIndex);
278 bool productMadeAtEnd =
false;
279 for (
unsigned int i = 0;
i < matchingHolders.size(); ++
i) {
281 productResolvers_[matchingHolders[
i]]->branchDescription().availableOnlyAtEndTransition()) {
282 productMadeAtEnd =
true;
286 std::shared_ptr<ProductResolverBase> newHolder =
287 std::make_shared<NoProcessProductResolver>(matchingHolders, ambiguous, productMadeAtEnd);
300 for (
auto const&
prod : *
this) {
301 if (
prod->singleProduct() &&
302 !
prod->productUnavailable() && !
prod->unscheduledWasNotRun() && !
prod->branchDescription().dropped()) {
312 for (
auto const&
prod : prodsList) {
315 auto cbd = std::make_shared<BranchDescription const>(
bd);
317 if (phb ==
nullptr || phb->branchDescription().branchName() != cbd->branchName()) {
327 auto phb = std::make_unique<PuttableProductResolver>(
std::move(
bd));
332 auto phb = std::make_unique<PuttableProductResolver>(
std::move(
bd));
378 for (
auto&
prod : *
this) {
379 prod->resetProductData();
386 phb->unsafe_deleteProduct();
414 std::shared_ptr<ProcessHistory const> inputProcessHistory;
416 if (
hist.isValid()) {
418 auto noDel = [](
void const*) {};
419 inputProcessHistory = std::shared_ptr<ProcessHistory const>(
processHistory, noDel);
420 if (inputProcessHistory.get() ==
nullptr) {
422 <<
"Input ProcessHistory not found in registry\n"
423 <<
"Contact a Framework developer\n";
427 inputProcessHistory = std::shared_ptr<ProcessHistory const>(&
s_emptyProcessHistory, [](
void const*) {});
438 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
451 auto nameIterCurrentProcess =
453 if (nameIterCurrentProcess != lookupProcessNames.end()) {
467 auto nameIter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(), iter->processName());
468 if (nameIter == lookupProcessNames.end()) {
482 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
485 auto iter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processNameOfBlock);
486 if (iter != lookupProcessNames.end()) {
493 return const_cast<ProductResolverBase*>(const_cast<const Principal*>(
this)->
getExistingProduct(branchID));
509 <<
"Principal::getExistingProduct\n"
510 <<
" Branch " << newProduct.
branchName() <<
" has same branch ID as branch " <<
existing.branchName()
512 <<
"Workaround: change process name or product instance name of " << newProduct.
branchName() <<
"\n";
523 assert(!
bd.friendlyClassName().empty());
535 if (phb !=
nullptr) {
538 <<
"addProductOrThrow: Problem found while adding product, "
539 <<
"product already exists for (" <<
bd.friendlyClassName() <<
"," <<
bd.moduleLabel() <<
","
540 <<
bd.productInstanceName() <<
"," <<
bd.processName() <<
")\n";
603 bool skipCurrentProcess,
609 assert(
nullptr != productResolver.get());
610 auto resolution = productResolver->resolveProduct(*
this, skipCurrentProcess, sra, mcc);
618 if (productData ==
nullptr) {
623 return BasicHandle(productData->wrapper(), &(productData->provenance()));
628 bool skipCurrentProcess,
632 assert(
nullptr != productResolver.get());
633 productResolver->prefetchAsync(
task, *
this, skipCurrentProcess,
token,
nullptr, mcc);
647 failedToRegisterConsumesMany(typeID);
653 if (
matches.numberOfMatches() == 0) {
682 std::vector<ProductResolverBase const*> holders;
684 for (
unsigned int i = 0;
i <
matches.numberOfMatches(); ++
i) {
688 if (!holders.empty()) {
696 holders.push_back(productResolver);
700 if (!holders.empty()) {
713 for (
auto productResolver : holders) {
717 if (
bd.isAnyAlias()) {
721 ProductData const* productData = productResolver->resolveProduct(*
this,
false, sra, mcc).data();
737 bool skipCurrentProcess =
inputTag.willSkipCurrentProcess();
743 if (skipCurrentProcess) {
764 failedToRegisterConsumes(kindOfType,
773 auto resolution = productResolver->resolveProduct(*
this, skipCurrentProcess, sra, mcc);
807 auto resolution = productResolver->resolveProduct(*
this,
false, sra, mcc);
826 if (phb ==
nullptr) {
830 if (phb->unscheduledWasNotRun()) {
831 if (not phb->resolveProduct(*
this,
false,
nullptr, mcc).data()) {
835 return *phb->provenance();
843 for (
auto const& productResolver : *
this) {
844 if (productResolver->singleProduct() && productResolver->provenanceAvailable() &&
845 !productResolver->branchDescription().isAnyAlias()) {
848 if (productResolver->provenance()->branchDescription().present()) {
849 provenances.push_back(productResolver->provenance());
860 for (
auto const& productResolver : *
this) {
861 if (productResolver->singleProduct() && !productResolver->branchDescription().isAnyAlias()) {
862 if (productResolver->stableProvenance()->branchDescription().present()) {
863 provenances.push_back(productResolver->stableProvenance());
870 for (
auto&
prod : bids) {
886 unsigned int)
const {
892 std::vector<WrapperBase const*>&,
893 std::vector<unsigned int>&)
const {
899 return std::monostate{};
907 if (edp.get() ==
nullptr) {
909 <<
"put: Cannot put because unique_ptr to product is null."
920 bool changed =
false;
922 for (
auto const&
prod :
preg_->productList()) {
930 auto cbd = std::make_shared<BranchDescription const>(
bd);
948 for (
auto&
prod : *
this) {
949 prod->retrieveAndMerge(*
this, mergeableRunProductMetadata);