Provenance.h
Go to the documentation of this file.
1 #ifndef art_Framework_Principal_Provenance_h
2 #define art_Framework_Principal_Provenance_h
3 
4 // ======================================================================
5 //
6 // Provenance: The full description of a product and how it came into
7 // existence.
8 //
9 // definitions:
10 // Product: The EDProduct to which a provenance object is associated
11 // Creator: The EDProducer that made the product.
12 // Parents: The EDProducts used as input by the creator.
13 //
14 // ======================================================================
15 
24 #include "cetlib/exempt_ptr.h"
26 
27 #include <cassert>
28 #include <iosfwd>
29 
30 namespace art {
31  class Provenance;
32  std::ostream& operator<<(std::ostream&, Provenance const&);
33  bool operator==(Provenance const& a, Provenance const& b);
34  void swap(Provenance& x, Provenance& y);
35 }
36 
37 // ----------------------------------------------------------------------
38 
40 public:
41  explicit constexpr Provenance() = default;
43 
44  // Full product description
45  BranchDescription const&
47  {
48  return group_->productDescription();
49  }
50 
51  // Selected components of the product description
52  std::string const&
53  branchName() const
54  {
55  return productDescription().branchName();
56  }
57  std::string const&
59  {
61  }
62  std::string const&
64  {
66  }
67  std::string const&
68  moduleLabel() const
69  {
71  }
72  std::string const&
74  {
76  }
77  std::string const&
78  processName() const
79  {
81  }
82  InputTag
83  inputTag() const
84  {
85  return productDescription().inputTag();
86  }
87 
88  // Metadata about the product's origin
89  RangeSet const&
91  {
92  return group_->rangeOfValidity();
93  }
94  Parentage const&
95  parentage() const
96  {
97  return productProvenance().parentage();
98  }
99  std::vector<ProductID> const&
100  parents() const
101  {
102  return parentage().parents();
103  }
104  fhicl::ParameterSet const& parameterSet() const;
105  std::set<fhicl::ParameterSetID> const&
106  psetIDs() const
107  {
108  return productDescription().psetIDs();
109  }
110 
111  // Identifiers corresponding to this product, necessary for art::Ptr support.
112  ProductID const&
113  productID() const
114  {
115  return group_->productID();
116  }
117 
118  // Functions for querying the validity/presence of a product.
119  bool
120  isValid() const
121  {
122  return static_cast<bool>(group_);
123  }
124  bool
125  isPresent() const
126  {
128  }
129  bool
130  produced() const
131  {
132  return productDescription().produced();
133  }
136  {
137  return productProvenance().productStatus();
138  }
139 
140  // General utilities
141  std::ostream& write(std::ostream& os) const;
142  bool
143  equals(Provenance const& other) const
144  {
145  return group_ == other.group_;
146  }
147 
148 private:
150 
151  ProductProvenance const&
153  {
154  auto prov = group_->productProvenancePtr();
155  assert(prov != nullptr);
156  return *prov;
157  }
158 
159 }; // Provenance
160 
161 inline std::ostream&
162 art::operator<<(std::ostream& os, Provenance const& p)
163 {
164  return p.write(os);
165 }
166 
167 inline bool
169 {
170  return a.equals(b);
171 }
172 
173 // ======================================================================
174 
175 #endif /* art_Framework_Principal_Provenance_h */
176 
177 // Local Variables:
178 // mode: c++
179 // End:
std::vector< ProductID > const & parents() const
Definition: Provenance.h:100
std::ostream & operator<<(std::ostream &os, EDAnalyzer::Table< T > const &t)
Definition: EDAnalyzer.h:184
fhicl::ParameterSet const & parameterSet() const
ProductProvenance const & productProvenance() const
Definition: Provenance.h:152
std::set< fhicl::ParameterSetID > const & psetIDs() const
std::string const & productInstanceName() const
Definition: Provenance.h:73
std::string const & friendlyClassName() const
Definition: Provenance.h:63
const char * p
Definition: xmltok.h:285
std::string const & processName() const
Definition: Provenance.h:78
RangeSet const & rangeOfValidity() const
Definition: Provenance.h:90
Provenance(cet::exempt_ptr< Group const > g)
Definition: Provenance.h:42
InputTag inputTag() const
InputTag inputTag() const
Definition: Provenance.h:83
std::string const & producedClassName() const
bool isValid() const
Definition: Provenance.h:120
std::string const & producedClassName() const
Definition: Provenance.h:58
ProductID const & productID() const
Definition: Provenance.h:113
std::ostream & write(std::ostream &os) const
std::string const & branchName() const
Definition: Provenance.h:53
std::vector< ProductID > const & parents() const
Definition: Parentage.h:30
bool produced() const
Definition: Provenance.h:130
void swap(Handle< T > &a, Handle< T > &b)
Parentage const & parentage() const
std::string const & moduleLabel() const
const double a
unsigned char ProductStatus
Definition: ProductStatus.h:6
ProductStatus productStatus() const noexcept
bool equals(Provenance const &other) const
Definition: Provenance.h:143
std::set< fhicl::ParameterSetID > const & psetIDs() const
Definition: Provenance.h:106
Parentage const & parentage() const
Definition: Provenance.h:95
std::string const & moduleLabel() const
Definition: Provenance.h:68
cet::exempt_ptr< Group const > group_
Definition: Provenance.h:149
std::string const & productInstanceName() const
const hit & b
Definition: hits.cxx:21
assert(nhit_max >=nhit_nbins)
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
bool isPresent() const
Definition: Provenance.h:125
std::string const & processName() const
BranchDescription const & productDescription() const
Definition: Provenance.h:46
bool operator==(Provenance const &a, Provenance const &b)
Definition: Provenance.h:168
std::string const & branchName() const
ProductStatus productStatus() const
Definition: Provenance.h:135
std::string const & friendlyClassName() const
constexpr ProductStatus present() noexcept
Definition: ProductStatus.h:10
constexpr Provenance()=default
enum BeamMode string