LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
KeptProvenance.cc
Go to the documentation of this file.
4 
5 using namespace art;
6 
8  DropMetaData const dropMetaData,
9  bool const dropMetaDataForDroppedData,
10  std::set<ProductID>& branchesWithStoredHistory)
11  : dropMetaData_{dropMetaData}
12  , dropMetaDataForDroppedData_{dropMetaDataForDroppedData}
13  , branchesWithStoredHistory_{branchesWithStoredHistory}
14 {}
15 
16 ProductProvenance const&
18 {
19  return *provenance_.insert(pp).first;
20 }
21 
22 ProductProvenance const&
24 {
25  return *provenance_.emplace(pid, status).first;
26 }
27 
28 void
30  Principal const& principal)
31 {
33  return;
34  }
36  return;
37  }
38  auto const& parents = iGetParents.parentage().parents();
39  for (auto const pid : parents) {
40  auto info = principal.branchMapper().branchToProductProvenance(pid);
41  if (!info || dropMetaData_ != DropMetaData::DropNone) {
42  continue;
43  }
44  // These two data structures should be in sync.
46  (void)provenance_.insert(*info).second;
47 
48  auto const* pd = principal.getForOutput(info->productID(), false).desc();
49  if (pd && pd->produced()) {
50  // FIXME: Remove recursion!
51  insertAncestors(*info, principal);
52  }
53  }
54 }
55 
56 void
58  ProductStatus const status)
59 {
60  if (provenance_.erase(key) != 1ull)
61  throw Exception(errors::LogicError, "detail::KeptProvenance::setStatus")
62  << "Attempt to set product status for product whose provenance is not "
63  "being recorded.\n";
64  provenance_.emplace(key.productID(), status);
65 }
ProductID productID() const
DropMetaData const dropMetaData_
ProductProvenance const & insert(ProductProvenance const &)
unsigned char ProductStatus
Definition: ProductStatus.h:12
bool const dropMetaDataForDroppedData_
std::vector< ProductID > const & parents() const
Definition: Parentage.h:30
ProductProvenance const & emplace(ProductID, ProductStatus)
OutputHandle getForOutput(ProductID const, bool resolveProd) const
Definition: Principal.cc:424
Parentage const & parentage() const
BranchMapper const & branchMapper() const
Definition: Principal.h:144
void insertAncestors(ProductProvenance const &iGetParents, Principal const &principal)
KeptProvenance(DropMetaData dropMetaData, bool dropMetaDataForDroppedData, std::set< ProductID > &branchesWithStoredHistory)
std::set< ProductProvenance > provenance_
result_t branchToProductProvenance(ProductID const) const
Definition: BranchMapper.cc:33
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::set< ProductID > & branchesWithStoredHistory_
HLT enums.
void setStatus(ProductProvenance const &, ProductStatus)