102 std::map<BranchID, bool> seenParentInPrincipal;
103 std::set<BranchID> missingFromMapper;
104 std::set<BranchID> missingProductProvenance;
106 std::map<BranchID, const BranchDescription*> idToBranchDescriptions;
108 BranchDescription
const* branchDescription = product.first;
109 BranchID branchID = branchDescription->branchID();
110 idToBranchDescriptions[branchID] = branchDescription;
111 TypeID
const& tid(branchDescription->unwrappedTypeID());
113 BasicHandle bh =
e.getByToken(
token, tid);
114 bool cannotFindProductProvenance =
false;
115 if (!(bh.provenance() and bh.provenance()->productProvenance())) {
116 missingProductProvenance.insert(branchID);
117 cannotFindProductProvenance =
true;
119 ProductProvenance
const* pInfo =
e.getProvenance(branchID).productProvenance();
121 missingFromMapper.insert(branchID);
124 if (cannotFindProductProvenance) {
127 markAncestors(
e, *(bh.provenance()->productProvenance()), seenParentInPrincipal, missingFromMapper);
128 seenParentInPrincipal[branchID] =
true;
134 std::set<BranchID> branchesInReg;
135 for (
auto const& product : prodList) {
136 branchesInReg.insert(product.second.branchID());
137 idToBranchDescriptions[product.second.branchID()] = &product.second;
140 std::set<BranchID> missingFromReg;
141 for (
auto const&
item : seenParentInPrincipal) {
142 if (branchesInReg.find(
item.first) == branchesInReg.end()) {
143 missingFromReg.insert(
item.first);
147 if (!missingFromMapper.empty()) {
148 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from ProductProvenanceRetriever\n";
149 for (std::set<BranchID>::iterator it = missingFromMapper.begin(), itEnd = missingFromMapper.end(); it != itEnd;
151 LogProblem(
"ProvenanceChecker") << *it <<
" " << *(idToBranchDescriptions[*it]);
155 if (!missingProductProvenance.empty()) {
156 LogError(
"ProvenanceChecker") <<
"The ProductResolvers for the following BranchIDs have no ProductProvenance\n";
157 for (std::set<BranchID>::iterator it = missingProductProvenance.begin(), itEnd = missingProductProvenance.end();
160 LogProblem(
"ProvenanceChecker") << *it <<
" " << *(idToBranchDescriptions[*it]);
164 if (!missingFromReg.empty()) {
165 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from ProductRegistry\n";
166 for (
auto const&
item : missingFromReg) {
171 if (!missingFromMapper.empty() || !missingProductProvenance.empty() || !missingFromReg.empty()) {
173 << (!missingFromMapper.empty() ?
"Having missing ancestors from ProductProvenanceRetriever.\n" :
"")
174 << (!missingProductProvenance.empty() ?
" Have missing ProductProvenance's from ProductResolver in Event.\n" 176 << (!missingFromReg.empty() ?
" Have missing info from ProductRegistry.\n" :
"");
std::map< BranchKey, BranchDescription > ProductList
Log< level::Error, false > LogError
SelectedProductsForBranchType const & keptProducts() const
Log< level::Error, true > LogProblem