106 boost::shared_ptr<BranchMapper> mapperPtr =
e.branchMapperPtr();
108 std::map<BranchID, bool> seenParentInPrincipal;
109 std::set<BranchID> missingFromMapper;
110 std::set<BranchID> missingProductProvenance;
112 std::map<BranchID, boost::shared_ptr<Group> > idToGroup;
117 BranchID branchID = (*it)->branchDescription().branchID();
118 idToGroup[branchID] = (*it);
119 if((*it)->productUnavailable()) {
121 OutputHandle
const oh =
e.getForOutput(branchID,
false);
123 bool cannotFindProductProvenance=
false;
124 if(!(*it)->productProvenancePtr()) {
125 missingProductProvenance.insert(branchID);
126 cannotFindProductProvenance=
true;
128 ProductProvenance
const* pInfo = mapperPtr->branchIDToProvenance(branchID);
130 missingFromMapper.insert(branchID);
133 if(cannotFindProductProvenance) {
136 markAncestors(*((*it)->productProvenancePtr()), *mapperPtr, seenParentInPrincipal, missingFromMapper);
138 seenParentInPrincipal[branchID] =
true;
143 ProductRegistry
const& reg =
e.productRegistry();
145 std::set<BranchID> branchesInReg;
146 for(ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end();
149 branchesInReg.insert(it->second.branchID());
152 std::set<BranchID> missingFromPrincipal;
153 std::set<BranchID> missingFromReg;
154 for(std::map<BranchID, bool>::iterator it = seenParentInPrincipal.begin(), itEnd = seenParentInPrincipal.end();
158 missingFromPrincipal.insert(it->first);
160 if(branchesInReg.find(it->first) == branchesInReg.end()) {
161 missingFromReg.insert(it->first);
165 if(missingFromMapper.size()) {
166 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from BranchMapper\n";
167 for(std::set<BranchID>::iterator it = missingFromMapper.begin(), itEnd = missingFromMapper.end();
170 LogProblem(
"ProvenanceChecker") << *it<<
" "<<idToGroup[*it]->branchDescription();
173 if(missingFromPrincipal.size()) {
174 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from EventPrincipal\n";
175 for(std::set<BranchID>::iterator it = missingFromPrincipal.begin(), itEnd = missingFromPrincipal.end();
178 LogProblem(
"ProvenanceChecker") << *it;
182 if(missingProductProvenance.size()) {
183 LogError(
"ProvenanceChecker") <<
"The Groups for the following BranchIDs have no ProductProvenance\n";
184 for(std::set<BranchID>::iterator it = missingProductProvenance.begin(), itEnd = missingProductProvenance.end();
187 LogProblem(
"ProvenanceChecker") << *it<<
" "<<idToGroup[*it]->branchDescription();
191 if(missingFromReg.size()) {
192 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from ProductRegistry\n";
193 for(std::set<BranchID>::iterator it = missingFromReg.begin(), itEnd = missingFromReg.end();
196 LogProblem(
"ProvenanceChecker") << *it;
200 if(missingFromMapper.size() || missingFromPrincipal.size() || missingProductProvenance.size() || missingFromReg.size()) {
202 << (missingFromMapper.size() || missingFromPrincipal.size() ?
"Having missing ancestors" :
"")
203 << (missingFromMapper.size() ?
" from BranchMapper" :
"")
204 << (missingFromMapper.size() && missingFromPrincipal.size() ?
" and" :
"")
205 << (missingFromPrincipal.size() ?
" from EventPrincipal" :
"")
206 << (missingFromMapper.size() || missingFromPrincipal.size() ?
".\n" :
"")
207 << (missingProductProvenance.size() ?
" Have missing ProductProvenance's from Group in EventPrincipal.\n" :
"")
208 << (missingFromReg.size() ?
" Have missing info from ProductRegistry.\n" :
"");
std::map< BranchKey, BranchDescription > ProductList
boost::filter_iterator< FilledGroupPtr, GroupCollection::const_iterator > const_iterator