14 #include "cetlib/exempt_ptr.h" 15 #include "cetlib_except/exception.h" 56 std::map<ProductID, bool>& oMap,
57 std::set<ProductID>& oMapperMissing)
61 if (oMap.find(parent) == oMap.end()) {
65 cet::exempt_ptr<ProductProvenance const> pInfo =
70 oMapperMissing.insert(parent);
84 std::map<ProductID, bool> seenParentInPrincipal;
85 std::set<ProductID> missingFromMapper;
86 std::set<ProductID> missingProductProvenance;
88 for (
auto const& group : e) {
89 if (group.second && !group.second->productUnavailable()) {
94 if (not group.second->productProvenancePtr().get()) {
95 missingProductProvenance.insert(group.first);
98 cet::exempt_ptr<ProductProvenance const> pInfo =
101 missingFromMapper.insert(group.first);
105 seenParentInPrincipal,
108 seenParentInPrincipal[group.first] =
true;
113 std::set<ProductID> branchesInReg;
114 for (
auto const& prod : prodList) {
115 branchesInReg.insert(prod.second.productID());
118 std::set<ProductID> missingFromPrincipal;
119 std::set<ProductID> missingFromReg;
120 for (
auto const& seenParent : seenParentInPrincipal) {
121 if (!seenParent.second) {
122 missingFromPrincipal.insert(seenParent.first);
125 if (branchesInReg.find(
pid) == branchesInReg.end()) {
126 missingFromReg.insert(
pid);
130 auto logProductID = [](
auto const& missing) {
134 if (missingFromMapper.size()) {
136 <<
"Missing the following ProductIDs from BranchMapper\n";
137 cet::for_all(missingFromMapper, logProductID);
140 if (missingFromPrincipal.size()) {
142 <<
"Missing the following ProductIDs from EventPrincipal\n";
143 cet::for_all(missingFromPrincipal, logProductID);
146 if (missingProductProvenance.size()) {
147 mf::LogError(
"ProvenanceChecker") <<
"The Groups for the following " 148 "ProductIDs have no " 149 "ProductProvenance\n";
150 cet::for_all(missingProductProvenance, logProductID);
153 if (missingFromReg.size()) {
155 <<
"Missing the following ProductIDs from ProductRegistry\n";
156 cet::for_all(missingFromReg, logProductID);
159 if (missingFromMapper.size() or missingFromPrincipal.size() or
160 missingProductProvenance.size() or missingFromReg.size()) {
162 << (missingFromMapper.size() or missingFromPrincipal.size() ?
163 "Having missing ancestors" :
165 << (missingFromMapper.size() ?
" from BranchMapper" :
"")
166 << (missingFromMapper.size() and missingFromPrincipal.size() ?
" and" :
168 << (missingFromPrincipal.size() ?
" from EventPrincipal" :
"")
169 << (missingFromMapper.size() or missingFromPrincipal.size() ?
".\n" :
171 << (missingProductProvenance.size() ?
" Have missing " 172 "ProductProvenance's from Group " 173 "in EventPrincipal.\n" :
175 << (missingFromReg.size() ?
176 " Have missing info from ProductRegistry.\n" :
auto const & get_PSet() const
void writeSubRun(SubRunPrincipal &) override
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
MaybeLogger_< ELseverityLevel::ELsev_error, true > LogProblem
std::vector< ProductID > const & parents() const
OutputHandle getForOutput(ProductID const, bool resolveProd) const
#define DEFINE_ART_MODULE(klass)
Parentage const & parentage() const
fhicl::TableFragment< OutputModule::Config > omConfig
ProvenanceCheckerOutput(Parameters const &)
result_t branchToProductProvenance(ProductID const) const
void writeRun(RunPrincipal &) override
static void markAncestors(ProductProvenance const &iInfo, BranchMapper const &iMapper, std::map< ProductID, bool > &oMap, std::set< ProductID > &oMapperMissing)
void write(EventPrincipal &e) override
cet::coded_exception< error, detail::translate > exception