Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13722 from wmtan/DoNotReadPerEventProvenanceIfNot…
…Needed Avoid unneeded retrievel of per event provenance
- Loading branch information
Showing
42 changed files
with
293 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#ifndef DataFormats_Provenance_StableProvenance_h | ||
#define DataFormats_Provenance_StableProvenance_h | ||
|
||
/*---------------------------------------------------------------------- | ||
StableProvenance: The full description of a product, excluding the parentage. | ||
The parentage can change from event to event. | ||
----------------------------------------------------------------------*/ | ||
|
||
#include "DataFormats/Provenance/interface/BranchDescription.h" | ||
#include "DataFormats/Provenance/interface/ParameterSetID.h" | ||
#include "DataFormats/Provenance/interface/ProcessHistory.h" | ||
#include "DataFormats/Provenance/interface/ProductID.h" | ||
#include "DataFormats/Provenance/interface/ReleaseVersion.h" | ||
|
||
#include <memory> | ||
|
||
#include <iosfwd> | ||
/* | ||
StableProvenance | ||
definitions: | ||
Product: The EDProduct to which a provenance object is associated | ||
Creator: The EDProducer that made the product. | ||
*/ | ||
|
||
namespace edm { | ||
class StableProvenance { | ||
public: | ||
StableProvenance(); | ||
|
||
StableProvenance(std::shared_ptr<BranchDescription const> const& p, ProductID const& pid); | ||
|
||
BranchDescription const& branchDescription() const {return *branchDescription_;} | ||
std::shared_ptr<BranchDescription const> const& constBranchDescriptionPtr() const {return branchDescription_;} | ||
|
||
BranchID const& branchID() const {return branchDescription().branchID();} | ||
std::string const& branchName() const {return branchDescription().branchName();} | ||
std::string const& className() const {return branchDescription().className();} | ||
std::string const& moduleLabel() const {return branchDescription().moduleLabel();} | ||
std::string const& moduleName() const {return branchDescription().moduleName();} | ||
std::string const& processName() const {return branchDescription().processName();} | ||
std::string const& productInstanceName() const {return branchDescription().productInstanceName();} | ||
std::string const& friendlyClassName() const {return branchDescription().friendlyClassName();} | ||
ProcessHistory const& processHistory() const {return *processHistory_;} | ||
bool getProcessConfiguration(ProcessConfiguration& pc) const; | ||
ReleaseVersion releaseVersion() const; | ||
std::set<std::string> const& branchAliases() const {return branchDescription().branchAliases();} | ||
|
||
void write(std::ostream& os) const; | ||
|
||
void setProcessHistory(ProcessHistory const& ph) {processHistory_ = &ph;} | ||
|
||
ProductID const& productID() const {return productID_;} | ||
|
||
void setProductID(ProductID const& pid) { | ||
productID_ = pid; | ||
} | ||
|
||
void setBranchDescription(std::shared_ptr<BranchDescription const> const& p) { | ||
branchDescription_ = p; | ||
} | ||
|
||
void swap(StableProvenance&); | ||
|
||
private: | ||
std::shared_ptr<BranchDescription const> branchDescription_; | ||
ProductID productID_; | ||
ProcessHistory const* processHistory_; // We don't own this | ||
}; | ||
|
||
inline | ||
std::ostream& | ||
operator<<(std::ostream& os, StableProvenance const& p) { | ||
p.write(os); | ||
return os; | ||
} | ||
|
||
bool operator==(StableProvenance const& a, StableProvenance const& b); | ||
|
||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include "DataFormats/Provenance/interface/StableProvenance.h" | ||
#include "DataFormats/Provenance/interface/ProcessConfiguration.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
#include <algorithm> | ||
#include <cassert> | ||
|
||
/*---------------------------------------------------------------------- | ||
----------------------------------------------------------------------*/ | ||
|
||
namespace edm { | ||
|
||
StableProvenance::StableProvenance() : StableProvenance{std::shared_ptr<BranchDescription const>(), ProductID()} { | ||
} | ||
|
||
StableProvenance::StableProvenance(std::shared_ptr<BranchDescription const> const& p, ProductID const& pid) : | ||
branchDescription_(p), | ||
productID_(pid), | ||
processHistory_() { | ||
} | ||
|
||
bool | ||
StableProvenance::getProcessConfiguration(ProcessConfiguration& pc) const { | ||
return processHistory_->getConfigurationForProcess(processName(), pc); | ||
} | ||
|
||
ReleaseVersion | ||
StableProvenance::releaseVersion() const { | ||
ProcessConfiguration pc; | ||
assert(getProcessConfiguration(pc)); | ||
return pc.releaseVersion(); | ||
} | ||
|
||
void | ||
StableProvenance::write(std::ostream& os) const { | ||
// This is grossly inadequate, but it is not critical for the first pass. | ||
branchDescription().write(os); | ||
} | ||
|
||
bool operator==(StableProvenance const& a, StableProvenance const& b) { | ||
return a.branchDescription() == b.branchDescription(); | ||
} | ||
|
||
|
||
void | ||
StableProvenance::swap(StableProvenance& iOther) { | ||
branchDescription_.swap(iOther.branchDescription_); | ||
productID_.swap(iOther.productID_); | ||
std::swap(processHistory_, iOther.processHistory_); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.