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.
5 
6 /*----------------------------------------------------------------------
7 
8 ----------------------------------------------------------------------*/
9 
10 namespace edm {
11 
12  Provenance::Provenance(boost::shared_ptr<ConstBranchDescription> const& p, ProductID const& pid) :
13  branchDescription_(p),
14  productID_(pid),
15  productProvenancePtr_() {
16  }
17 
18  boost::shared_ptr<ProductProvenance>
20  if (productProvenancePtr_.get() == 0) {
21  productProvenancePtr_ = store_->branchIDToProvenance(branchDescription_->branchID());
22  }
23  return productProvenancePtr_;
24  }
25 
28  if (parameterSetIDs().size() == 1) {
29  return parameterSetIDs().begin()->first;
30  }
31  if (moduleNames().size() == 1) {
32  return moduleNames().begin()->first;
33  }
34  // Get the ProcessHistory for this event.
36  ProcessHistory ph;
37  if (!phr->getMapped(store_->processHistoryID(), ph)) {
38  return ProcessConfigurationID();
39  }
40 
42  if (!ph.getConfigurationForProcess(processName(), config)) {
43  return ProcessConfigurationID();
44  }
45  return config.id();
46  }
47 
48  ReleaseVersion const&
52  return pc.releaseVersion();
53  }
54 
57  if (product().parameterSetID().isValid()) {
58  return product().parameterSetID();
59  }
60  if (parameterSetIDs().size() == 1) {
61  return parameterSetIDs().begin()->second;
62  }
63  std::map<ProcessConfigurationID, ParameterSetID>::const_iterator it =
65  if (it == parameterSetIDs().end()) {
66  return ParameterSetID();
67  }
68  return it->second;
69  }
70 
71  std::string
73  if (!product().moduleName().empty()) {
74  return product().moduleName();
75  }
76  if (moduleNames().size() == 1) {
77  return moduleNames().begin()->second;
78  }
79  std::map<ProcessConfigurationID, std::string>::const_iterator it =
81  if (it == moduleNames().end()) {
82  return std::string();
83  }
84  return it->second;
85  }
86 
87  void
88  Provenance::write(std::ostream& os) const {
89  // This is grossly inadequate, but it is not critical for the
90  // first pass.
91  product().write(os);
92  productProvenancePtr()->write(os);
93  }
94 
95 
96  bool operator==(Provenance const& a, Provenance const& b) {
97  return a.product() == b.product();
98  }
99 
100 
101  void
104  productID_.swap(iOther.productID_);
106  store_.swap(iOther.store_);
107  }
108 
109 }
110 
boost::shared_ptr< BranchMapper > store_
Definition: Provenance.h:111
ProcessConfigurationID id() const
bool getMapped(key_type const &k, value_type &result) const
ProductID productID_
Definition: Provenance.h:109
std::string const & processName() const
Definition: Provenance.h:63
void swap(ProductID &other)
Definition: ProductID.cc:17
void write(std::ostream &os) const
Definition: Provenance.cc:88
void write(std::ostream &os) const
ParameterSetID psetID() const
Definition: Provenance.cc:56
boost::shared_ptr< ProductProvenance > resolve() const
Definition: Provenance.cc:19
bool getConfigurationForProcess(std::string const &name, ProcessConfiguration &config) const
Provenance(boost::shared_ptr< ConstBranchDescription > const &p, ProductID const &pid)
Definition: Provenance.cc:12
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
boost::shared_ptr< ProductProvenance > productProvenancePtr() const
Definition: Provenance.h:54
std::map< ProcessConfigurationID, ParameterSetID > const & parameterSetIDs() const
Definition: Provenance.h:72
ParameterSetID const & parameterSetID() const
std::string moduleName() const
Definition: Provenance.cc:72
boost::shared_ptr< ProductProvenance > productProvenancePtr_
Definition: Provenance.h:110
ReleaseVersion const & releaseVersion() const
boost::shared_ptr< ConstBranchDescription > branchDescription_
Definition: Provenance.h:108
double b
Definition: hdecay.h:120
std::string ReleaseVersion
Definition: ReleaseVersion.h:7
std::map< ProcessConfigurationID, std::string > const & moduleNames() const
Definition: Provenance.h:75
double a
Definition: hdecay.h:121
ReleaseVersion const & releaseVersion() const
Definition: Provenance.cc:49
tuple config
Definition: cmsDriver.py:17
ProcessConfigurationID processConfigurationID() const
Definition: Provenance.cc:27
static ThreadSafeRegistry * instance()
void swap(Provenance &)
Definition: Provenance.cc:102
tuple size
Write out results.