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();
410 std::shared_ptr<ProcessHistory const> inputProcessHistory;
412 if (
hist.isValid()) {
414 auto noDel = [](
void const*) {};
415 inputProcessHistory = std::shared_ptr<ProcessHistory const>(
processHistory, noDel);
416 if (inputProcessHistory.get() ==
nullptr) {
418 <<
"Input ProcessHistory not found in registry\n"
419 <<
"Contact a Framework developer\n";
423 inputProcessHistory = std::shared_ptr<ProcessHistory const>(&
s_emptyProcessHistory, [](
void const*) {});
434 std::vector<std::string>
const& lookupProcessNames =
productLookup_->lookupProcessNames();
447 auto nameIterCurrentProcess =
449 if (nameIterCurrentProcess != lookupProcessNames.end()) {
463 auto nameIter =
std::find(lookupProcessNames.begin(), lookupProcessNames.end(), iter->processName());
464 if (nameIter == lookupProcessNames.end()) {
475 return const_cast<ProductResolverBase*>(const_cast<const Principal*>(
this)->
getExistingProduct(branchID));
491 <<
"Principal::getExistingProduct\n"
492 <<
" Branch " << newProduct.
branchName() <<
" has same branch ID as branch " <<
existing.branchName()
494 <<
"Workaround: change process name or product instance name of " << newProduct.
branchName() <<
"\n";
505 assert(!
bd.friendlyClassName().empty());
517 if (phb !=
nullptr) {
520 <<
"addProductOrThrow: Problem found while adding product, "
521 <<
"product already exists for (" <<
bd.friendlyClassName() <<
"," <<
bd.moduleLabel() <<
","
522 <<
bd.productInstanceName() <<
"," <<
bd.processName() <<
")\n";
581 bool skipCurrentProcess,
587 assert(
nullptr != productResolver.get());
588 auto resolution = productResolver->resolveProduct(*
this, skipCurrentProcess, sra, mcc);
596 if (productData ==
nullptr) {
601 return BasicHandle(productData->wrapper(), &(productData->provenance()));
606 bool skipCurrentProcess,
610 assert(
nullptr != productResolver.get());
611 productResolver->prefetchAsync(
task, *
this, skipCurrentProcess,
token,
nullptr, mcc);
622 failedToRegisterConsumesMany(typeID);
628 if (
matches.numberOfMatches() == 0) {
657 std::vector<ProductResolverBase const*> holders;
659 for (
unsigned int i = 0;
i <
matches.numberOfMatches(); ++
i) {
663 if (!holders.empty()) {
671 holders.push_back(productResolver);
675 if (!holders.empty()) {
688 for (
auto productResolver : holders) {
692 if (
bd.isAnyAlias()) {
696 ProductData const* productData = productResolver->resolveProduct(*
this,
false, sra, mcc).data();
712 bool skipCurrentProcess =
inputTag.willSkipCurrentProcess();
718 if (skipCurrentProcess) {
739 failedToRegisterConsumes(kindOfType,
748 auto resolution = productResolver->resolveProduct(*
this, skipCurrentProcess, sra, mcc);
782 auto resolution = productResolver->resolveProduct(*
this,
false, sra, mcc);
798 if (phb ==
nullptr) {
802 if (phb->unscheduledWasNotRun()) {
803 if (not phb->resolveProduct(*
this,
false,
nullptr, mcc).data()) {
807 return *phb->provenance();
815 for (
auto const& productResolver : *
this) {
816 if (productResolver->singleProduct() && productResolver->provenanceAvailable() &&
817 !productResolver->branchDescription().isAnyAlias()) {
820 if (productResolver->provenance()->branchDescription().present()) {
821 provenances.push_back(productResolver->provenance());
832 for (
auto const& productResolver : *
this) {
833 if (productResolver->singleProduct() && !productResolver->branchDescription().isAnyAlias()) {
834 if (productResolver->stableProvenance()->branchDescription().present()) {
835 provenances.push_back(productResolver->stableProvenance());
842 for (
auto&
prod : bids) {
863 std::vector<WrapperBase const*>&,
864 std::vector<unsigned int>&)
const {
873 if (edp.get() ==
nullptr) {
875 <<
"put: Cannot put because unique_ptr to product is null."
886 bool changed =
false;
888 for (
auto const&
prod :
preg_->productList()) {
896 auto cbd = std::make_shared<BranchDescription const>(
bd);
914 for (
auto&
prod : *
this) {
915 prod->retrieveAndMerge(*
this, mergeableRunProductMetadata);