109 auto mapperPtr =
e.productProvenanceRetrieverPtr();
111 std::map<BranchID, bool> seenParentInPrincipal;
112 std::set<BranchID> missingFromMapper;
113 std::set<BranchID> missingProductProvenance;
115 std::map<BranchID, std::shared_ptr<ProductHolderBase const>> idToProductHolder;
116 for(
auto const& product :
e) {
117 if(product && product->singleProduct()) {
118 BranchID branchID = product->branchDescription().branchID();
120 if(product->productUnavailable()) {
122 OutputHandle
const oh = e.getForOutput(branchID,
false, mcc);
124 bool cannotFindProductProvenance=
false;
125 if(!product->productProvenancePtr()) {
126 missingProductProvenance.insert(branchID);
127 cannotFindProductProvenance=
true;
129 ProductProvenance
const* pInfo = mapperPtr->branchIDToProvenance(branchID);
131 missingFromMapper.insert(branchID);
134 if(cannotFindProductProvenance) {
137 markAncestors(*(product->productProvenancePtr()), *mapperPtr, seenParentInPrincipal, missingFromMapper);
139 seenParentInPrincipal[branchID] =
true;
144 ProductRegistry
const& reg = e.productRegistry();
146 std::set<BranchID> branchesInReg;
147 for(ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end();
150 branchesInReg.insert(it->second.branchID());
153 std::set<BranchID> missingFromPrincipal;
154 std::set<BranchID> missingFromReg;
155 for(std::map<BranchID, bool>::iterator it = seenParentInPrincipal.begin(), itEnd = seenParentInPrincipal.end();
159 missingFromPrincipal.insert(it->first);
161 if(branchesInReg.find(it->first) == branchesInReg.end()) {
162 missingFromReg.insert(it->first);
166 if(missingFromMapper.size()) {
167 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from ProductProvenanceRetriever\n";
168 for(std::set<BranchID>::iterator it = missingFromMapper.begin(), itEnd = missingFromMapper.end();
171 LogProblem(
"ProvenanceChecker") << *it<<
" "<<idToProductHolder[*it]->branchDescription();
174 if(missingFromPrincipal.size()) {
175 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from EventPrincipal\n";
176 for(std::set<BranchID>::iterator it = missingFromPrincipal.begin(), itEnd = missingFromPrincipal.end();
179 LogProblem(
"ProvenanceChecker") << *it;
183 if(missingProductProvenance.size()) {
184 LogError(
"ProvenanceChecker") <<
"The ProductHolders for the following BranchIDs have no ProductProvenance\n";
185 for(std::set<BranchID>::iterator it = missingProductProvenance.begin(), itEnd = missingProductProvenance.end();
188 LogProblem(
"ProvenanceChecker") << *it<<
" "<<idToProductHolder[*it]->branchDescription();
192 if(missingFromReg.size()) {
193 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from ProductRegistry\n";
194 for(std::set<BranchID>::iterator it = missingFromReg.begin(), itEnd = missingFromReg.end();
197 LogProblem(
"ProvenanceChecker") << *it;
201 if(missingFromMapper.size() || missingFromPrincipal.size() || missingProductProvenance.size() || missingFromReg.size()) {
203 << (missingFromMapper.size() || missingFromPrincipal.size() ?
"Having missing ancestors" :
"")
204 << (missingFromMapper.size() ?
" from ProductProvenanceRetriever" :
"")
205 << (missingFromMapper.size() && missingFromPrincipal.size() ?
" and" :
"")
206 << (missingFromPrincipal.size() ?
" from EventPrincipal" :
"")
207 << (missingFromMapper.size() || missingFromPrincipal.size() ?
".\n" :
"")
208 << (missingProductProvenance.size() ?
" Have missing ProductProvenance's from ProductHolder in EventPrincipal.\n" :
"")
209 << (missingFromReg.size() ?
" Have missing info from ProductRegistry.\n" :
"");
std::map< BranchKey, BranchDescription > ProductList
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)