LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::detail::PrincipalProcessor< DETAIL > Class Template Reference

#include "ProvenanceDumperImpl.h"

Public Member Functions

 PrincipalProcessor (DETAIL &detail, bool const wantPresentOnly, bool const resolveProducts, bool const wantResolvedOnly)
 
void operator() (art::Principal const &p, void(DETAIL::*func)(art::Provenance const &)) const
 

Private Attributes

DETAIL & detail_
 
bool const wantPresentOnly_
 
bool const resolveProducts_
 
bool const wantResolvedOnly_
 

Detailed Description

template<typename DETAIL>
class art::detail::PrincipalProcessor< DETAIL >

Definition at line 26 of file ProvenanceDumperImpl.h.

Constructor & Destructor Documentation

template<typename DETAIL>
art::detail::PrincipalProcessor< DETAIL >::PrincipalProcessor ( DETAIL &  detail,
bool const  wantPresentOnly,
bool const  resolveProducts,
bool const  wantResolvedOnly 
)
inline

Definition at line 28 of file ProvenanceDumperImpl.h.

References art::detail::PrincipalProcessor< DETAIL >::operator()().

32  : detail_(detail)
33  , wantPresentOnly_(wantPresentOnly)
34  , resolveProducts_(resolveProducts)
35  , wantResolvedOnly_(wantResolvedOnly)
36  {}

Member Function Documentation

template<typename DETAIL >
void art::detail::PrincipalProcessor< DETAIL >::operator() ( art::Principal const &  p,
void(DETAIL::*)(art::Provenance const &)  func 
) const

Definition at line 50 of file ProvenanceDumperImpl.h.

References art::Group::anyProduct(), art::errors::DataCorruption, art::detail::PrincipalProcessor< DETAIL >::detail_, e, art::Provenance::isPresent(), art::errors::LogicError, art::Group::producedWrapperType(), art::Group::productProvenancePtr(), art::Group::resolveProduct(), art::detail::PrincipalProcessor< DETAIL >::resolveProducts_, art::detail::PrincipalProcessor< DETAIL >::wantPresentOnly_, and art::detail::PrincipalProcessor< DETAIL >::wantResolvedOnly_.

Referenced by art::detail::PrincipalProcessor< DETAIL >::PrincipalProcessor().

53  {
54  for (auto const& pr : p) {
55  Group const& g = *pr.second;
56  if (resolveProducts_) {
57  try {
58  if (!g.resolveProduct(g.producedWrapperType())) {
59  throw Exception(errors::DataCorruption, "data corruption");
60  }
61  }
62  catch (art::Exception const& e) {
63  if (e.category() != "ProductNotFound") {
64  throw;
65  }
66  if (g.anyProduct())
67  throw art::Exception(errors::LogicError, "ProvenanceDumper", e)
68  << "Product reported as not present, but is pointed to "
69  "nonetheless!";
70  }
71  }
72  bool wantCallFunc = true;
73  Provenance const prov{cet::make_exempt_ptr(&g)};
74  if (wantResolvedOnly_) {
75  wantCallFunc = (g.anyProduct() != nullptr);
76  } else if (wantPresentOnly_) {
77  // Unfortunately, there are files in which the product
78  // provenance has not been appropriately stored for dropped
79  // products. The first check below on the product
80  // provenance pointer is a precondition to calling
81  // prov.isPresent(), getting around this incorrect
82  // persistency behavior.
83  wantCallFunc =
84  (g.productProvenancePtr() != nullptr) && prov.isPresent();
85  }
86 
87  if (wantCallFunc) {
88  (detail_.*func)(prov);
89  }
90  }
91  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Float_t e
Definition: plot.C:34

Member Data Documentation

template<typename DETAIL>
DETAIL& art::detail::PrincipalProcessor< DETAIL >::detail_
private
template<typename DETAIL>
bool const art::detail::PrincipalProcessor< DETAIL >::resolveProducts_
private
template<typename DETAIL>
bool const art::detail::PrincipalProcessor< DETAIL >::wantPresentOnly_
private
template<typename DETAIL>
bool const art::detail::PrincipalProcessor< DETAIL >::wantResolvedOnly_
private

The documentation for this class was generated from the following file: