101 std::map<BranchID, bool> seenParentInPrincipal;
102 std::set<BranchID> missingFromMapper;
103 std::set<BranchID> missingProductProvenance;
105 std::map<BranchID, const BranchDescription*> idToBranchDescriptions;
107 BranchDescription
const* branchDescription = product.first;
108 BranchID branchID = branchDescription->branchID();
109 idToBranchDescriptions[branchID] = branchDescription;
110 TypeID
const& tid(branchDescription->unwrappedTypeID());
112 BasicHandle bh =
e.getByToken(token, tid);
113 bool cannotFindProductProvenance =
false;
114 if (!(bh.provenance() and bh.provenance()->productProvenance())) {
115 missingProductProvenance.insert(branchID);
116 cannotFindProductProvenance =
true;
118 ProductProvenance
const* pInfo =
e.getProvenance(branchID).productProvenance();
120 missingFromMapper.insert(branchID);
123 if (cannotFindProductProvenance) {
126 markAncestors(
e, *(bh.provenance()->productProvenance()), seenParentInPrincipal, missingFromMapper);
127 seenParentInPrincipal[branchID] =
true;
133 std::set<BranchID> branchesInReg;
134 for (
auto const& product : prodList) {
135 branchesInReg.insert(product.second.branchID());
136 idToBranchDescriptions[product.second.branchID()] = &product.second;
139 std::set<BranchID> missingFromReg;
140 for (
auto const&
item : seenParentInPrincipal) {
141 if (branchesInReg.find(
item.first) == branchesInReg.end()) {
142 missingFromReg.insert(
item.first);
146 if (!missingFromMapper.empty()) {
147 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from ProductProvenanceRetriever\n";
148 for (std::set<BranchID>::iterator it = missingFromMapper.begin(), itEnd = missingFromMapper.end(); it != itEnd;
150 LogProblem(
"ProvenanceChecker") << *it <<
" " << *(idToBranchDescriptions[*it]);
154 if (!missingProductProvenance.empty()) {
155 LogError(
"ProvenanceChecker") <<
"The ProductResolvers for the following BranchIDs have no ProductProvenance\n";
156 for (std::set<BranchID>::iterator it = missingProductProvenance.begin(), itEnd = missingProductProvenance.end();
159 LogProblem(
"ProvenanceChecker") << *it <<
" " << *(idToBranchDescriptions[*it]);
163 if (!missingFromReg.empty()) {
164 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from ProductRegistry\n";
165 for (
auto const&
item : missingFromReg) {
166 LogProblem(
"ProvenanceChecker") <<
item <<
" " << *(idToBranchDescriptions[
item]);
170 if (!missingFromMapper.empty() || !missingProductProvenance.empty() || !missingFromReg.empty()) {
172 << (!missingFromMapper.empty() ?
"Having missing ancestors from ProductProvenanceRetriever.\n" :
"")
173 << (!missingProductProvenance.empty() ?
" Have missing ProductProvenance's from ProductResolver in Event.\n" 175 << (!missingFromReg.empty() ?
" Have missing info from ProductRegistry.\n" :
"");
std::map< BranchKey, BranchDescription > ProductList
SelectedProductsForBranchType const & keptProducts() const