28 class ModuleCallingContext;
85 std::map<BranchID, bool>& oMap,
86 std::set<BranchID>& oMapperMissing) {
87 for(std::vector<BranchID>::const_iterator it = iInfo.
parentage().
parents().begin(),
92 if(oMap.find(*it) == oMap.end()) {
97 markAncestors(*pInfo, iMapper, oMap, oMapperMissing);
99 oMapperMissing.insert(*it);
111 std::map<BranchID, bool> seenParentInPrincipal;
112 std::set<BranchID> missingFromMapper;
113 std::set<BranchID> missingProductProvenance;
115 std::map<BranchID, std::shared_ptr<ProductHolderBase> > idToProductHolder;
119 if(*it && (*it)->singleProduct()) {
120 BranchID branchID = (*it)->branchDescription().branchID();
121 idToProductHolder[branchID] = (*it);
122 if((*it)->productUnavailable()) {
126 bool cannotFindProductProvenance=
false;
127 if(!(*it)->productProvenancePtr()) {
128 missingProductProvenance.insert(branchID);
129 cannotFindProductProvenance=
true;
133 missingFromMapper.insert(branchID);
136 if(cannotFindProductProvenance) {
139 markAncestors(*((*it)->productProvenancePtr()), *mapperPtr, seenParentInPrincipal, missingFromMapper);
141 seenParentInPrincipal[branchID] =
true;
148 std::set<BranchID> branchesInReg;
149 for(ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end();
152 branchesInReg.insert(it->second.branchID());
155 std::set<BranchID> missingFromPrincipal;
156 std::set<BranchID> missingFromReg;
157 for(std::map<BranchID, bool>::iterator it = seenParentInPrincipal.begin(), itEnd = seenParentInPrincipal.end();
161 missingFromPrincipal.insert(it->first);
163 if(branchesInReg.find(it->first) == branchesInReg.end()) {
164 missingFromReg.insert(it->first);
168 if(missingFromMapper.size()) {
169 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from ProductProvenanceRetriever\n";
170 for(std::set<BranchID>::iterator it = missingFromMapper.begin(), itEnd = missingFromMapper.end();
173 LogProblem(
"ProvenanceChecker") << *it<<
" "<<idToProductHolder[*it]->branchDescription();
176 if(missingFromPrincipal.size()) {
177 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from EventPrincipal\n";
178 for(std::set<BranchID>::iterator it = missingFromPrincipal.begin(), itEnd = missingFromPrincipal.end();
185 if(missingProductProvenance.size()) {
186 LogError(
"ProvenanceChecker") <<
"The ProductHolders for the following BranchIDs have no ProductProvenance\n";
187 for(std::set<BranchID>::iterator it = missingProductProvenance.begin(), itEnd = missingProductProvenance.end();
190 LogProblem(
"ProvenanceChecker") << *it<<
" "<<idToProductHolder[*it]->branchDescription();
194 if(missingFromReg.size()) {
195 LogError(
"ProvenanceChecker") <<
"Missing the following BranchIDs from ProductRegistry\n";
196 for(std::set<BranchID>::iterator it = missingFromReg.begin(), itEnd = missingFromReg.end();
203 if(missingFromMapper.size() || missingFromPrincipal.size() || missingProductProvenance.size() || missingFromReg.size()) {
205 << (missingFromMapper.size() || missingFromPrincipal.size() ?
"Having missing ancestors" :
"")
206 << (missingFromMapper.size() ?
" from ProductProvenanceRetriever" :
"")
207 << (missingFromMapper.size() && missingFromPrincipal.size() ?
" and" :
"")
208 << (missingFromPrincipal.size() ?
" from EventPrincipal" :
"")
209 << (missingFromMapper.size() || missingFromPrincipal.size() ?
".\n" :
"")
210 << (missingProductProvenance.size() ?
" Have missing ProductProvenance's from ProductHolder in EventPrincipal.\n" :
"")
211 << (missingFromReg.size() ?
" Have missing info from ProductRegistry.\n" :
"");
226 descriptions.
add(
"provenanceChecker", desc);
ProductRegistry const & productRegistry() const
const_iterator end() const
#define DEFINE_FWK_MODULE(type)
std::map< BranchKey, BranchDescription > ProductList
virtual void write(EventPrincipal const &e, ModuleCallingContext const *) override
std::vector< BranchID > const & parents() const
ProductList const & productList() const
std::shared_ptr< ProductProvenanceRetriever > productProvenanceRetrieverPtr() const
virtual ~ProvenanceCheckerOutputModule()
OutputHandle getForOutput(BranchID const &bid, bool getProd, ModuleCallingContext const *mcc) const
virtual void writeLuminosityBlock(LuminosityBlockPrincipal const &, ModuleCallingContext const *) override
virtual void writeRun(RunPrincipal const &, ModuleCallingContext const *) override
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< FilledProductPtr, ProductHolderCollection::const_iterator > const_iterator
ProductProvenance const * branchIDToProvenance(BranchID const &bid) const
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Parentage const & parentage() const