CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Provenance.cc
Go to the documentation of this file.
6 
7 #include <algorithm>
8 
9 /*----------------------------------------------------------------------
10 
11 ----------------------------------------------------------------------*/
12 
13 namespace edm {
14 
15  Provenance::Provenance() : Provenance{boost::shared_ptr<ConstBranchDescription>(), ProductID()} {
16  }
17 
18  Provenance::Provenance(boost::shared_ptr<ConstBranchDescription> const& p, ProductID const& pid) :
19  branchDescription_(p),
20  productID_(pid),
21  processHistoryID_(),
22  productProvenanceValid_(false),
23  productProvenancePtr_(new ProductProvenance),
24  store_() {
25  }
26 
29  if(!store_) {
30  return 0;
31  }
33  ProductProvenance const* prov = store_->branchIDToProvenance(branchDescription_->branchID());
34  if (prov) {
35  *productProvenancePtr_ = *prov;
37  }
38  }
39  return productProvenancePtr_.get();
40  }
41 
44  if (parameterSetIDs().size() == 1) {
45  return parameterSetIDs().begin()->first;
46  }
47  if (moduleNames().size() == 1) {
48  return moduleNames().begin()->first;
49  }
50  // Get the ProcessHistory for this event.
52  ProcessHistory ph;
53  if (!phr->getMapped(processHistoryID(), ph)) {
54  return ProcessConfigurationID();
55  }
56 
58  if (!ph.getConfigurationForProcess(processName(), config)) {
59  return ProcessConfigurationID();
60  }
61  return config.id();
62  }
63 
68  return pc.releaseVersion();
69  }
70 
73  if (product().parameterSetID().isValid()) {
74  return product().parameterSetID();
75  }
76  if (parameterSetIDs().size() == 1) {
77  return parameterSetIDs().begin()->second;
78  }
79  std::map<ProcessConfigurationID, ParameterSetID>::const_iterator it =
81  if (it == parameterSetIDs().end()) {
82  return ParameterSetID();
83  }
84  return it->second;
85  }
86 
89  if (!product().moduleName().empty()) {
90  return product().moduleName();
91  }
92  if (moduleNames().size() == 1) {
93  return moduleNames().begin()->second;
94  }
95  std::map<ProcessConfigurationID, std::string>::const_iterator it =
97  if (it == moduleNames().end()) {
98  return std::string();
99  }
100  return it->second;
101  }
102 
103  void
104  Provenance::write(std::ostream& os) const {
105  // This is grossly inadequate, but it is not critical for the
106  // first pass.
107  product().write(os);
109  if (pp != 0) {
110  pp->write(os);
111  }
112  }
113 
114  bool operator==(Provenance const& a, Provenance const& b) {
115  return a.product() == b.product();
116  }
117 
118  void
121  productProvenanceValid_ = false;
122  }
123 
124  void
126  *productProvenancePtr_ = prov;
128  }
129 
130  void
133  productID_.swap(iOther.productID_);
137  store_.swap(iOther.store_);
138  }
139 }
boost::shared_ptr< BranchMapper > store_
Definition: Provenance.h:110
tuple pp
Definition: createTree.py:15
ProcessConfigurationID id() const
static ThreadSafeRegistry * instance()
ReleaseVersion releaseVersion() const
Definition: Provenance.cc:65
ProductProvenance * productProvenance() const
Definition: Provenance.h:51
bool getMapped(key_type const &k, value_type &result) const
ProductID productID_
Definition: Provenance.h:106
std::string const & processName() const
Definition: Provenance.h:63
void swap(ProductID &other)
Definition: ProductID.cc:17
void resetProductProvenance() const
Definition: Provenance.cc:119
void write(std::ostream &os) const
Definition: Provenance.cc:104
void write(std::ostream &os) const
ParameterSetID psetID() const
Definition: Provenance.cc:72
bool getConfigurationForProcess(std::string const &name, ProcessConfiguration &config) const
void write(std::ostream &os) const
ProductProvenance * resolve() const
Definition: Provenance.cc:28
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
Hash< ProcessConfigurationType > ProcessConfigurationID
#define end
Definition: vmac.h:38
BranchDescription const & product() const
Definition: Provenance.h:44
Hash< ParameterSetType > ParameterSetID
std::string const & moduleName() const
bool productProvenanceValid_
Definition: Provenance.h:108
std::map< ProcessConfigurationID, ParameterSetID > const & parameterSetIDs() const
Definition: Provenance.h:72
ParameterSetID const & parameterSetID() const
std::string moduleName() const
Definition: Provenance.cc:88
boost::shared_ptr< ProductProvenance > productProvenancePtr_
Definition: Provenance.h:109
ReleaseVersion const & releaseVersion() const
boost::shared_ptr< ConstBranchDescription > branchDescription_
Definition: Provenance.h:105
double b
Definition: hdecay.h:120
std::string ReleaseVersion
Definition: ReleaseVersion.h:7
ProcessHistoryID const & processHistoryID() const
Definition: Provenance.h:67
std::map< ProcessConfigurationID, std::string > const & moduleNames() const
Definition: Provenance.h:75
ProcessHistoryID const * processHistoryID_
Definition: Provenance.h:107
double a
Definition: hdecay.h:121
void setProductProvenance(ProductProvenance const &prov) const
Definition: Provenance.cc:125
ProcessConfigurationID processConfigurationID() const
Definition: Provenance.cc:43
void swap(Provenance &)
Definition: Provenance.cc:131
tuple size
Write out results.