LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Provenance.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
6 
8 
9 using namespace std;
10 
11 namespace art {
12 
13  Provenance::Provenance() = default;
14 
15  Provenance::Provenance(cet::exempt_ptr<Group const> g) noexcept : group_{g} {}
16 
17  bool
18  Provenance::isValid() const noexcept
19  {
20  return static_cast<bool>(group_);
21  }
22 
23  BranchDescription const&
24  Provenance::productDescription() const noexcept
25  {
26  return group_->productDescription();
27  }
28 
29  bool
30  Provenance::produced() const noexcept
31  {
32  return productDescription().produced();
33  }
34 
35  string const&
36  Provenance::producedClassName() const noexcept
37  {
38  return productDescription().producedClassName();
39  }
40 
41  string const&
42  Provenance::branchName() const noexcept
43  {
44  return productDescription().branchName();
45  }
46 
47  string const&
48  Provenance::friendlyClassName() const noexcept
49  {
50  return productDescription().friendlyClassName();
51  }
52 
53  string const&
54  Provenance::moduleLabel() const noexcept
55  {
56  return productDescription().moduleLabel();
57  }
58 
59  string const&
60  Provenance::productInstanceName() const noexcept
61  {
62  return productDescription().productInstanceName();
63  }
64 
65  string const&
66  Provenance::processName() const noexcept
67  {
68  return productDescription().processName();
69  }
70 
71  ProductID
72  Provenance::productID() const noexcept
73  {
74  return productDescription().productID();
75  }
76 
77  set<fhicl::ParameterSetID> const&
78  Provenance::psetIDs() const noexcept
79  {
80  return productDescription().psetIDs();
81  }
82 
83  fhicl::ParameterSet const&
84  Provenance::parameterSet() const
85  {
87  *productDescription().psetIDs().begin());
88  }
89 
90  InputTag
91  Provenance::inputTag() const
92  {
93  return productDescription().inputTag();
94  }
95 
97  Provenance::productStatus() const
98  {
99  return productProvenance().productStatus();
100  }
101 
102  Parentage const&
103  Provenance::parentage() const
104  {
105  return productProvenance().parentage();
106  }
107 
108  vector<ProductID> const&
109  Provenance::parents() const
110  {
111  return productProvenance().parentage().parents();
112  }
113 
114  bool
115  Provenance::isPresent() const
116  {
117  return productstatus::present(productProvenance().productStatus());
118  }
119 
120  RangeSet const&
121  Provenance::rangeOfValidity() const
122  {
123  return group_->rangeOfValidity();
124  }
125 
126  bool
127  Provenance::equals(Provenance const& other) const noexcept
128  {
129  return group_ == other.group_;
130  }
131 
132  ProductProvenance const&
133  Provenance::productProvenance() const
134  {
135  auto prov = group_->productProvenance();
136  assert(prov != nullptr);
137  return *prov;
138  }
139 
140  bool
141  operator==(Provenance const& a, Provenance const& b) noexcept
142  {
143  return a.equals(b);
144  }
145 
146  ostream&
147  Provenance::write(ostream& os) const
148  {
149  // This is grossly inadequate, but it is not critical for the
150  // first pass.
151  productDescription().write(os);
152  productProvenance().write(os);
153  return os;
154  }
155 
156  ostream&
157  operator<<(ostream& os, Provenance const& p)
158  {
159  return p.write(os);
160  }
161 
162 } // namespace art
bool produced() const noexcept
bool operator==(Provenance const &a, Provenance const &b) noexcept
Definition: Provenance.cc:141
static collection_type const & get() noexcept
std::vector< ProductID > const & parents() const
Definition: Parentage.cc:37
STL namespace.
unsigned char ProductStatus
Definition: ProductStatus.h:6
Definition: MVAAlg.h:12
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
constexpr ProductStatus present() noexcept
Definition: ProductStatus.h:10
ostream & operator<<(ostream &os, Provenance const &p)
Definition: Provenance.cc:157
std::ostream & write(std::ostream &) const
Definition: Provenance.cc:147