14 #include "cetlib_except/exception.h" 54 std::map<ProductID, bool>& oMap,
55 std::set<ProductID>& oMapperMissing)
59 if (oMap.find(
parent) == oMap.end()) {
68 oMapperMissing.insert(
parent);
80 std::map<ProductID, bool> seenParentInPrincipal;
81 std::set<ProductID> missingFromMapper;
82 std::set<ProductID> missingProductProvenance;
84 for (
auto const& group : e) {
85 auto const pid = group.first;
86 auto const& pd = group.second;
87 if (pd && pd->productAvailable()) {
88 e.getForOutput(
pid,
false);
89 if (not pd->productProvenance().get()) {
90 missingProductProvenance.insert(
pid);
93 auto pInfo = e.branchToProductProvenance(
pid);
95 missingFromMapper.insert(
pid);
99 seenParentInPrincipal,
102 seenParentInPrincipal[
pid] =
true;
108 std::set<ProductID> missingFromPrincipal;
109 std::set<ProductID> missingFromTables;
110 for (
auto const& seenParent : seenParentInPrincipal) {
111 if (!seenParent.second) {
112 missingFromPrincipal.insert(seenParent.first);
115 auto found = e.getProductDescription(
pid);
116 if (
found ==
nullptr) {
117 missingFromTables.insert(
pid);
121 auto logProductID = [](
auto const& missing) {
125 if (missingFromMapper.size()) {
127 <<
"Missing the following ProductIDs from BranchMapper\n";
131 if (missingFromPrincipal.size()) {
133 <<
"Missing the following ProductIDs from EventPrincipal\n";
137 if (missingProductProvenance.size()) {
138 mf::LogError(
"ProvenanceChecker") <<
"The Groups for the following " 139 "ProductIDs have no " 140 "ProductProvenance\n";
144 if (missingFromTables.size()) {
145 mf::LogError(
"ProvenanceChecker") <<
"Missing the following ProductIDs " 146 "from the principal's product " 151 if (missingFromMapper.size() or missingFromPrincipal.size() or
152 missingProductProvenance.size() or missingFromTables.size()) {
154 << (missingFromMapper.size() or missingFromPrincipal.size() ?
155 "Having missing ancestors" :
157 << (missingFromMapper.size() ?
" from BranchMapper" :
"")
158 << (missingFromMapper.size() and missingFromPrincipal.size() ?
" and" :
160 << (missingFromPrincipal.size() ?
" from EventPrincipal" :
"")
161 << (missingFromMapper.size() or missingFromPrincipal.size() ?
".\n" :
163 << (missingProductProvenance.size() ?
" Have missing " 164 "ProductProvenance's from Group " 165 "in EventPrincipal.\n" :
167 << (missingFromTables.size() ?
168 " 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)
auto const & get_PSet() const
void writeSubRun(SubRunPrincipal &) override
std::vector< ProductID > const & parents() const
constexpr pointer get() const noexcept
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 &)
static constexpr double ps
cet::exempt_ptr< ProductProvenance const > branchToProductProvenance(ProductID const &) const
void writeRun(RunPrincipal &) override
void write(EventPrincipal &e) override
auto for_all(FwdCont &, Func)
def parent(G, child, parent_type)
cet::coded_exception< error, detail::translate > exception