13 #include "cetlib_except/exception.h" 53 std::map<ProductID, bool>& oMap,
54 std::set<ProductID>& oMapperMissing)
58 if (oMap.find(parent) == oMap.end()) {
62 cet::exempt_ptr<ProductProvenance const> pInfo =
67 oMapperMissing.insert(parent);
79 std::map<ProductID, bool> seenParentInPrincipal;
80 std::set<ProductID> missingFromMapper;
81 std::set<ProductID> missingProductProvenance;
83 for (
auto const& [
pid, pd] : e) {
84 if (pd && pd->productAvailable()) {
85 e.getForOutput(
pid,
false);
86 if (not pd->productProvenance().get()) {
87 missingProductProvenance.insert(
pid);
90 auto pInfo = e.branchToProductProvenance(
pid);
92 missingFromMapper.insert(
pid);
96 seenParentInPrincipal,
99 seenParentInPrincipal[
pid] =
true;
105 std::set<ProductID> missingFromPrincipal;
106 std::set<ProductID> missingFromTables;
107 for (
auto const& [parent_pid, seen] : seenParentInPrincipal) {
109 missingFromPrincipal.insert(parent_pid);
111 auto found = e.getProductDescription(parent_pid);
112 if (found ==
nullptr) {
113 missingFromTables.insert(parent_pid);
117 auto logProductID = [](
auto const& missing) {
121 if (missingFromMapper.size()) {
123 <<
"Missing the following ProductIDs from BranchMapper";
124 cet::for_all(missingFromMapper, logProductID);
127 if (missingFromPrincipal.size()) {
129 <<
"Missing the following ProductIDs from EventPrincipal";
130 cet::for_all(missingFromPrincipal, logProductID);
133 if (missingProductProvenance.size()) {
134 mf::LogError(
"ProvenanceChecker") <<
"The Groups for the following " 135 "ProductIDs have no " 137 cet::for_all(missingProductProvenance, logProductID);
140 if (missingFromTables.size()) {
141 mf::LogError(
"ProvenanceChecker") <<
"Missing the following ProductIDs " 142 "from the principal's product " 144 cet::for_all(missingFromTables, logProductID);
147 if (missingFromMapper.size() or missingFromPrincipal.size() or
148 missingProductProvenance.size() or missingFromTables.size()) {
150 << (missingFromMapper.size() or missingFromPrincipal.size() ?
151 "Having missing ancestors" :
153 << (missingFromMapper.size() ?
" from BranchMapper" :
"")
154 << (missingFromMapper.size() and missingFromPrincipal.size() ?
" and" :
156 << (missingFromPrincipal.size() ?
" from EventPrincipal" :
"")
157 << (missingFromMapper.size() or missingFromPrincipal.size() ?
".\n" :
159 << (missingProductProvenance.size() ?
" Have missing " 160 "ProductProvenance's from Group " 161 "in EventPrincipal.\n" :
163 << (missingFromTables.size() ?
164 " Have missing info from the principal's product tables.\n" :
static void markAncestors(ProductProvenance const &iInfo, EventPrincipal &e, std::map< ProductID, bool > &oMap, std::set< ProductID > &oMapperMissing)
void writeSubRun(SubRunPrincipal &) override
std::vector< ProductID > const & parents() const
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
MaybeLogger_< ELseverityLevel::ELsev_error, true > LogProblem
#define DEFINE_ART_MODULE(klass)
Parentage const & parentage() const
fhicl::TableFragment< OutputModule::Config > omConfig
ProvenanceCheckerOutput(Parameters const &)
cet::exempt_ptr< ProductProvenance const > branchToProductProvenance(ProductID const &) const
void writeRun(RunPrincipal &) override
void write(EventPrincipal &e) override
cet::coded_exception< error, detail::translate > exception