41 returnValue += currentProcess;
45 return processFromInputTag;
49 throw Exception(
error,
"InvalidID") <<
"Principal::" << where <<
": no product with given branch id: " << bid
62 <<
": Found zero products matching all criteria\nLooking for type: " << productType <<
"\n"
63 <<
"Looking for module label: " <<
label <<
"\n"
64 <<
"Looking for productInstanceName: " <<
instance <<
"\n"
65 << (
process.empty() ?
"" :
"Looking for process: ") <<
process <<
"\n";
68 <<
": Found zero products matching all criteria\nLooking for a container with elements of type: "
69 << productType <<
"\n"
70 <<
"Looking for module label: " <<
label <<
"\n"
71 <<
"Looking for productInstanceName: " <<
instance <<
"\n"
72 << (
process.empty() ?
"" :
"Looking for process: ") <<
process <<
"\n";
84 <<
": More than 1 product matches all criteria\nLooking for type: " << productType <<
"\n"
85 <<
"Looking for module label: " <<
label <<
"\n"
86 <<
"Looking for productInstanceName: " <<
instance <<
"\n"
87 << (
process.empty() ?
"" :
"Looking for process: ") <<
process <<
"\n"
88 <<
"This can only occur with get function calls using a Handle<View> argument.\n"
89 <<
"Try a get not using a View or change the instance name of one of the products";
94 void failedToRegisterConsumesMany(
edm::TypeID const& iType) {
96 exception <<
"::getManyByType called for " << iType
97 <<
" without a corresponding consumesMany being called for this module. \n";
101 void failedToRegisterConsumes(
KindOfType kindOfType,
102 TypeID
const& productType,
107 exception <<
"::getByLabel without corresponding call to consumes or mayConsumes for this module.\n"
108 << (kindOfType ==
PRODUCT_TYPE ?
" type: " :
" type: edm::View<") << productType
110 <<
"\n product instance name: '" << productInstanceName <<
"'\n process name: '" <<
processName
123 std::shared_ptr<ProductResolverIndexHelper const> productLookup,
127 bool isForPrimaryProcess)
129 processHistoryPtr_(),
131 processHistoryIDBeforeConfig_(),
132 processConfiguration_(&pc),
135 productLookup_(productLookup),
136 lookupProcessOrder_(productLookup->lookupProcessNames().
size(), 0),
139 historyAppender_(historyAppender),
148 bool hasAliases =
false;
149 bool hasSwitchAliases =
false;
150 for (
auto const&
prod : prodsList) {
156 }
else if (
bd.isSwitchAlias()) {
157 hasSwitchAliases =
true;
159 auto cbd = std::make_shared<BranchDescription const>(
bd);
163 }
else if (
bd.onDemand()) {
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));
387 for (
auto&
prod : *
this) {
388 prod->resetProductData();
395 phb->unsafe_deleteProduct();
423 std::shared_ptr<ProcessHistory const> inputProcessHistory;
425 if (
hist.isValid()) {
427 auto noDel = [](
void const*) {};
428 inputProcessHistory = std::shared_ptr<ProcessHistory const>(
processHistory, noDel);
429 if (inputProcessHistory.get() ==
nullptr) {
431 <<
"Input ProcessHistory not found in registry\n"
432 <<
"Contact a Framework developer\n";
436 inputProcessHistory = std::shared_ptr<ProcessHistory const>(&
s_emptyProcessHistory, [](
void const*) {});
447 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
460 auto nameIterCurrentProcess =
462 if (nameIterCurrentProcess != lookupProcessNames.end()) {
476 auto nameIter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(), iter->processName());
477 if (nameIter == lookupProcessNames.end()) {
491 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
494 auto iter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(), processNameOfBlock);
495 if (iter != lookupProcessNames.end()) {
502 return const_cast<ProductResolverBase*>(const_cast<const Principal*>(
this)->
getExistingProduct(branchID));
518 <<
"Principal::getExistingProduct\n"
519 <<
" Branch " << newProduct.
branchName() <<
" has same branch ID as branch " <<
existing.branchName()
521 <<
"Workaround: change process name or product instance name of " << newProduct.
branchName() <<
"\n";
532 assert(!
bd.friendlyClassName().empty());
544 if (phb !=
nullptr) {
547 <<
"addProductOrThrow: Problem found while adding product, "
548 <<
"product already exists for (" <<
bd.friendlyClassName() <<
"," <<
bd.moduleLabel() <<
","
549 <<
bd.productInstanceName() <<
"," <<
bd.processName() <<
")\n";
612 bool skipCurrentProcess,
618 assert(
nullptr != productResolver.get());
619 auto resolution = productResolver->resolveProduct(*
this, skipCurrentProcess, sra, mcc);
627 if (productData ==
nullptr) {
632 return BasicHandle(productData->wrapper(), &(productData->provenance()));
637 bool skipCurrentProcess,
641 assert(
nullptr != productResolver.get());
642 productResolver->prefetchAsync(
task, *
this, skipCurrentProcess,
token,
nullptr, mcc);
656 failedToRegisterConsumesMany(typeID);
662 if (
matches.numberOfMatches() == 0) {
691 std::vector<ProductResolverBase const*> holders;
693 for (
unsigned int i = 0;
i <
matches.numberOfMatches(); ++
i) {
697 if (!holders.empty()) {
705 holders.push_back(productResolver);
709 if (!holders.empty()) {
722 for (
auto productResolver : holders) {
726 if (
bd.isAnyAlias()) {
730 ProductData const* productData = productResolver->resolveProduct(*
this,
false, sra, mcc).data();
746 bool skipCurrentProcess =
inputTag.willSkipCurrentProcess();
752 if (skipCurrentProcess) {
773 failedToRegisterConsumes(kindOfType,
782 auto resolution = productResolver->resolveProduct(*
this, skipCurrentProcess, sra, mcc);
816 auto resolution = productResolver->resolveProduct(*
this,
false, sra, mcc);
835 if (phb ==
nullptr) {
839 if (phb->unscheduledWasNotRun()) {
841 <<
"Requesting provenance from unrun EDProducer. The requested branch ID was: " << bid;
843 return *phb->provenance();
848 if (phb ==
nullptr) {
852 return *phb->stableProvenance();
860 for (
auto const& productResolver : *
this) {
861 if (productResolver->singleProduct() && productResolver->provenanceAvailable() &&
862 !productResolver->branchDescription().isAnyAlias()) {
865 if (productResolver->provenance()->branchDescription().present()) {
866 provenances.push_back(productResolver->provenance());
877 for (
auto const& productResolver : *
this) {
878 if (productResolver->singleProduct() && !productResolver->branchDescription().isAnyAlias()) {
879 if (productResolver->stableProvenance()->branchDescription().present()) {
880 provenances.push_back(productResolver->stableProvenance());
887 for (
auto&
prod : bids) {
903 unsigned int)
const {
909 std::vector<WrapperBase const*>&,
910 std::vector<unsigned int>&)
const {
916 return std::monostate{};
920 dynamic_cast<ProductPutterBase const*>(phb)->putProduct(
std::move(
prod));
924 if (edp.get() ==
nullptr) {
926 <<
"put: Cannot put because unique_ptr to product is null."
937 bool changed =
false;
939 for (
auto const&
prod :
preg_->productList()) {
947 auto cbd = std::make_shared<BranchDescription const>(
bd);
969 for (
auto&
prod : *
this) {
970 prod->retrieveAndMerge(*
this, mergeableRunProductMetadata);