82 std::map<BranchID, bool>& oMap,
83 std::set<BranchID>& oMapperMissing) {
84 for(std::vector<BranchID>::const_iterator it = iInfo.
parentage().
parents().begin(),
89 if(oMap.find(*it) == oMap.end()) {
94 markAncestors(*pInfo, iMapper, oMap, oMapperMissing);
96 oMapperMissing.insert(*it);
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()) {
123 bool cannotFindProductProvenance=
false;
124 if(!(*it)->productProvenancePtr()) {
125 missingProductProvenance.insert(branchID);
126 cannotFindProductProvenance=
true;
130 missingFromMapper.insert(branchID);
133 if(cannotFindProductProvenance) {
136 markAncestors(*((*it)->productProvenancePtr()), *mapperPtr, seenParentInPrincipal, missingFromMapper);
138 seenParentInPrincipal[branchID] =
true;
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();
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();
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" :
"");
223 descriptions.
add(
"provenanceChecker", desc);
ProductProvenance const * branchIDToProvenance(BranchID const &bid) const
ProductRegistry const & productRegistry() const
const_iterator end() const
#define DEFINE_FWK_MODULE(type)
std::map< BranchKey, BranchDescription > ProductList
virtual void writeRun(RunPrincipal const &)
std::vector< BranchID > const & parents() const
ProductList const & productList() const
boost::shared_ptr< BranchMapper > branchMapperPtr() const
OutputHandle getForOutput(BranchID const &bid, bool getProd) const
virtual ~ProvenanceCheckerOutputModule()
virtual void writeLuminosityBlock(LuminosityBlockPrincipal const &)
virtual void write(EventPrincipal const &e)
const_iterator begin() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
ProvenanceCheckerOutputModule(ParameterSet const &pset)
static void fillDescription(ParameterSetDescription &desc)
boost::filter_iterator< FilledGroupPtr, GroupCollection::const_iterator > const_iterator
author Stefano ARGIRO author Bill Tanenbaum
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Parentage const & parentage() const