From f9475af86c7634ff9f3e44f4b120e1473b8b51c6 Mon Sep 17 00:00:00 2001 From: wmtan Date: Tue, 15 Mar 2016 00:32:49 +0100 Subject: [PATCH] Avoid unneeded retrievel of per event provenance --- .../src/ProducerAnalyzer.cc | 13 ++- .../plugins/Analyzer_minbias.cc | 13 ++- DataFormats/Provenance/interface/Provenance.h | 56 ++++++------- .../Provenance/interface/ProvenanceFwd.h | 1 + .../Provenance/interface/StableProvenance.h | 84 +++++++++++++++++++ DataFormats/Provenance/src/Provenance.cc | 33 +++----- .../Provenance/src/StableProvenance.cc | 52 ++++++++++++ FWCore/Framework/interface/Event.h | 3 + FWCore/Framework/interface/LuminosityBlock.h | 2 +- .../Framework/interface/OccurrenceForOutput.h | 3 + FWCore/Framework/interface/Principal.h | 2 + .../Framework/interface/ProductResolverBase.h | 5 +- FWCore/Framework/interface/Run.h | 2 +- FWCore/Framework/src/Event.cc | 8 +- FWCore/Framework/src/EventForOutput.cc | 1 - FWCore/Framework/src/EventPrincipal.cc | 2 +- FWCore/Framework/src/LuminosityBlock.cc | 4 +- FWCore/Framework/src/OccurrenceForOutput.cc | 8 +- FWCore/Framework/src/Principal.cc | 15 ++++ FWCore/Framework/src/ProductResolvers.h | 2 +- FWCore/Framework/src/Run.cc | 4 +- .../test/eventprincipal_t.cppunit.cc | 1 - .../Framework/test/stubs/TestMergeResults.cc | 2 +- .../test/stubs/TestPRegisterModule2.cc | 6 +- FWCore/Modules/src/EventContentAnalyzer.cc | 20 ++--- .../FWInterface/src/FWFFMetadataManager.cc | 17 ++-- IOPool/Input/test/IOExerciser.cc | 8 +- IOPool/Input/test/ProductInfo.h | 2 +- .../EcalDeadCellTriggerPrimitiveFilter.cc | 6 +- .../GlobalDigis/src/GlobalDigisAnalyzer.cc | 4 +- .../src/GlobalDigisHistogrammer.cc | 4 +- .../GlobalDigis/src/GlobalDigisProducer.cc | 4 +- .../GlobalHits/src/GlobalHitsAnalyzer.cc | 4 +- .../GlobalHits/src/GlobalHitsHistogrammer.cc | 4 +- .../GlobalHits/src/GlobalHitsProdHist.cc | 4 +- .../src/GlobalHitsProdHistStripper.cc | 4 +- .../GlobalHits/src/GlobalHitsProducer.cc | 4 +- .../src/GlobalRecHitsAnalyzer.cc | 4 +- .../src/GlobalRecHitsHistogrammer.cc | 4 +- .../src/GlobalRecHitsProducer.cc | 4 +- .../MuonHits/src/MuonSimHitsValidAnalyzer.cc | 4 +- .../TrackerHits/src/TrackerHitProducer.cc | 4 +- 42 files changed, 289 insertions(+), 138 deletions(-) create mode 100644 DataFormats/Provenance/interface/StableProvenance.h create mode 100644 DataFormats/Provenance/src/StableProvenance.cc diff --git a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc b/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc index c79d3c6090fd3..008de57d84f95 100644 --- a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc @@ -3,7 +3,7 @@ // user include files #include "Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h" -#include "FWCore/Common/interface/Provenance.h" +#include "DataFormats/Provenance/interface/StableProvenance.h" #include "DataFormats/MuonReco/interface/Muon.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" @@ -90,13 +90,12 @@ ProducerAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetu geo = pG.product(); - std::vector theProvenance; - iEvent.getAllProvenance(theProvenance); - for( std::vector::const_iterator ip = theProvenance.begin(); - ip != theProvenance.end(); ip++) + std::vector theProvenance; + iEvent.getAllStableProvenance(theProvenance); + for(auto const& provenance : theProvenance) { - cout<<" Print all module/label names "<moduleName()<<" "<moduleLabel()<< + " "<productInstanceName()< theProvenance; - iEvent.getAllProvenance(theProvenance); + std::vector theProvenance; + iEvent.getAllStableProvenance(theProvenance); - for( std::vector::const_iterator ip = theProvenance.begin(); - ip != theProvenance.end(); ip++) { + for(auto const& provenance : theProvenance) { edm::LogInfo("AnalyzerMB")<<" Print all process/modulelabel/product names " - <<(**ip).processName()<<" , "<<(**ip).moduleLabel()<<" , " - <<(**ip).productInstanceName(); + <processName()<<" , "<moduleLabel()<<" , " + <productInstanceName(); } /* edm::Handle rawdata; diff --git a/DataFormats/Provenance/interface/Provenance.h b/DataFormats/Provenance/interface/Provenance.h index ec1fdf99d9388..e3a110b0e0033 100644 --- a/DataFormats/Provenance/interface/Provenance.h +++ b/DataFormats/Provenance/interface/Provenance.h @@ -8,12 +8,9 @@ existence. ----------------------------------------------------------------------*/ -#include "DataFormats/Provenance/interface/BranchDescription.h" #include "DataFormats/Provenance/interface/ParameterSetID.h" -#include "DataFormats/Provenance/interface/ProcessHistory.h" #include "DataFormats/Provenance/interface/Parentage.h" -#include "DataFormats/Provenance/interface/ProductID.h" -#include "DataFormats/Provenance/interface/ReleaseVersion.h" +#include "DataFormats/Provenance/interface/StableProvenance.h" #include @@ -38,48 +35,47 @@ namespace edm { Provenance(std::shared_ptr const& p, ProductID const& pid); - BranchDescription const& product() const {return *branchDescription_;} + Provenance(StableProvenance const&); - BranchDescription const& branchDescription() const {return *branchDescription_;} - BranchDescription const& constBranchDescription() const {return *branchDescription_;} - std::shared_ptr const& constBranchDescriptionPtr() const {return branchDescription_;} + StableProvenance const& stable() const {return stableProvenance_;} + StableProvenance& stable() {return stableProvenance_;} + + BranchDescription const& product() const {return branchDescription();} + BranchDescription const& branchDescription() const {return stable().branchDescription();} + BranchDescription const& constBranchDescription() const {return branchDescription();} + std::shared_ptr const& constBranchDescriptionPtr() const {return stable().constBranchDescriptionPtr();} ProductProvenance const* productProvenance() const; - BranchID const& branchID() const {return product().branchID();} - std::string const& branchName() const {return product().branchName();} - std::string const& className() const {return product().className();} - std::string const& moduleLabel() const {return product().moduleLabel();} - std::string const& processName() const {return product().processName();} - std::string const& productInstanceName() const {return product().productInstanceName();} - std::string const& friendlyClassName() const {return product().friendlyClassName();} + BranchID const& branchID() const {return stable().branchID();} + std::string const& branchName() const {return stable().branchName();} + std::string const& className() const {return stable().className();} + std::string const& moduleLabel() const {return stable().moduleLabel();} + std::string const& moduleName() const {return stable().moduleName();} + std::string const& processName() const {return stable().processName();} + std::string const& productInstanceName() const {return stable().productInstanceName();} + std::string const& friendlyClassName() const {return stable().friendlyClassName();} ProductProvenanceRetriever const* store() const {return store_;} - ProcessHistory const& processHistory() const {return *processHistory_;} - bool getProcessConfiguration(ProcessConfiguration& pc) const; - ReleaseVersion releaseVersion() const; - std::set const& branchAliases() const {return product().branchAliases();} + ProcessHistory const& processHistory() const {return stable().processHistory();} + bool getProcessConfiguration(ProcessConfiguration& pc) const {return stable().getProcessConfiguration(pc);} + ReleaseVersion releaseVersion() const {return stable().releaseVersion();} + std::set const& branchAliases() const {return stable().branchAliases();} void write(std::ostream& os) const; void setStore(ProductProvenanceRetriever const* store) {store_ = store;} - void setProcessHistory(ProcessHistory const& ph) {processHistory_ = &ph;} + void setProcessHistory(ProcessHistory const& ph) {stable().setProcessHistory(ph);} - ProductID const& productID() const {return productID_;} + ProductID const& productID() const {return stable().productID();} - void setProductID(ProductID const& pid) { - productID_ = pid; - } + void setProductID(ProductID const& pid) {stable().setProductID(pid);} - void setBranchDescription(std::shared_ptr const& p) { - branchDescription_ = p; - } + void setBranchDescription(std::shared_ptr const& p) {stable().setBranchDescription(p);} void swap(Provenance&); private: - std::shared_ptr branchDescription_; - ProductID productID_; - ProcessHistory const* processHistory_; // We don't own this + StableProvenance stableProvenance_; ProductProvenanceRetriever const* store_; }; diff --git a/DataFormats/Provenance/interface/ProvenanceFwd.h b/DataFormats/Provenance/interface/ProvenanceFwd.h index d8fb27bbdcb22..ceac4ac248051 100644 --- a/DataFormats/Provenance/interface/ProvenanceFwd.h +++ b/DataFormats/Provenance/interface/ProvenanceFwd.h @@ -23,6 +23,7 @@ namespace edm { class Provenance; class RunAuxiliary; class RunID; + class StableProvenance; class Timestamp; class ProductProvenanceRetriever; } diff --git a/DataFormats/Provenance/interface/StableProvenance.h b/DataFormats/Provenance/interface/StableProvenance.h new file mode 100644 index 0000000000000..5eff08885eae8 --- /dev/null +++ b/DataFormats/Provenance/interface/StableProvenance.h @@ -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 + +#include +/* + 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 const& p, ProductID const& pid); + + BranchDescription const& branchDescription() const {return *branchDescription_;} + std::shared_ptr 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 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 const& p) { + branchDescription_ = p; + } + + void swap(StableProvenance&); + + private: + std::shared_ptr 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 diff --git a/DataFormats/Provenance/src/Provenance.cc b/DataFormats/Provenance/src/Provenance.cc index 3f167af66340c..18fff8adeec65 100644 --- a/DataFormats/Provenance/src/Provenance.cc +++ b/DataFormats/Provenance/src/Provenance.cc @@ -14,13 +14,16 @@ namespace edm { - Provenance::Provenance() : Provenance{std::shared_ptr(), ProductID()} { + Provenance::Provenance() : Provenance{StableProvenance()} { } Provenance::Provenance(std::shared_ptr const& p, ProductID const& pid) : - branchDescription_(p), - productID_(pid), - processHistory_(), + stableProvenance_(p, pid), + store_() { + } + + Provenance::Provenance(StableProvenance const& stable) : + stableProvenance_(stable), store_() { } @@ -29,26 +32,14 @@ namespace edm { if(!store_) { return nullptr; } - return store_->branchIDToProvenance(branchDescription_->branchID()); - } - - bool - Provenance::getProcessConfiguration(ProcessConfiguration& pc) const { - return processHistory_->getConfigurationForProcess(processName(), pc); - } - - ReleaseVersion - Provenance::releaseVersion() const { - ProcessConfiguration pc; - assert(getProcessConfiguration(pc)); - return pc.releaseVersion(); + return store_->branchIDToProvenance(branchID()); } void Provenance::write(std::ostream& os) const { // This is grossly inadequate, but it is not critical for the // first pass. - product().write(os); + stable().write(os); auto pp = productProvenance(); if (pp != nullptr) { pp->write(os); @@ -56,15 +47,13 @@ namespace edm { } bool operator==(Provenance const& a, Provenance const& b) { - return a.product() == b.product(); + return a.stable() == b.stable(); } void Provenance::swap(Provenance& iOther) { - branchDescription_.swap(iOther.branchDescription_); - productID_.swap(iOther.productID_); - std::swap(processHistory_, iOther.processHistory_); + stableProvenance_.swap(iOther.stableProvenance_); std::swap(store_,iOther.store_); } } diff --git a/DataFormats/Provenance/src/StableProvenance.cc b/DataFormats/Provenance/src/StableProvenance.cc new file mode 100644 index 0000000000000..106c1b6ab065c --- /dev/null +++ b/DataFormats/Provenance/src/StableProvenance.cc @@ -0,0 +1,52 @@ +#include "DataFormats/Provenance/interface/StableProvenance.h" +#include "DataFormats/Provenance/interface/ProcessConfiguration.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include +#include + +/*---------------------------------------------------------------------- + +----------------------------------------------------------------------*/ + +namespace edm { + + StableProvenance::StableProvenance() : StableProvenance{std::shared_ptr(), ProductID()} { + } + + StableProvenance::StableProvenance(std::shared_ptr 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_); + } +} diff --git a/FWCore/Framework/interface/Event.h b/FWCore/Framework/interface/Event.h index d12ffb68f9bd6..61d485d06d7a0 100644 --- a/FWCore/Framework/interface/Event.h +++ b/FWCore/Framework/interface/Event.h @@ -207,6 +207,9 @@ namespace edm { void getAllProvenance(std::vector& provenances) const; + void + getAllStableProvenance(std::vector& provenances) const; + // Return true if this Event has been subjected to a process with // the given processName, and false otherwise. // If true is returned, then ps is filled with the ParameterSet diff --git a/FWCore/Framework/interface/LuminosityBlock.h b/FWCore/Framework/interface/LuminosityBlock.h index cb77a6134e6f5..2b478b9bff148 100644 --- a/FWCore/Framework/interface/LuminosityBlock.h +++ b/FWCore/Framework/interface/LuminosityBlock.h @@ -125,7 +125,7 @@ namespace edm { getProvenance(BranchID const& theID) const; void - getAllProvenance(std::vector& provenances) const; + getAllStableProvenance(std::vector& provenances) const; ProcessHistoryID const& processHistoryID() const; diff --git a/FWCore/Framework/interface/OccurrenceForOutput.h b/FWCore/Framework/interface/OccurrenceForOutput.h index 052a5166c6c77..17f5b3511aeed 100644 --- a/FWCore/Framework/interface/OccurrenceForOutput.h +++ b/FWCore/Framework/interface/OccurrenceForOutput.h @@ -70,6 +70,9 @@ namespace edm { void getAllProvenance(std::vector& provenances) const; + void + getAllStableProvenance(std::vector& provenances) const; + virtual ProcessHistory const& processHistory() const; diff --git a/FWCore/Framework/interface/Principal.h b/FWCore/Framework/interface/Principal.h index 322c46a5e779b..5bd416a6e6249 100644 --- a/FWCore/Framework/interface/Principal.h +++ b/FWCore/Framework/interface/Principal.h @@ -166,6 +166,8 @@ namespace edm { void getAllProvenance(std::vector& provenances) const; + void getAllStableProvenance(std::vector& provenances) const; + BranchType const& branchType() const {return branchType_;} //This will never return 0 so you can use 0 to mean unset diff --git a/FWCore/Framework/interface/ProductResolverBase.h b/FWCore/Framework/interface/ProductResolverBase.h index 2cbb8554bcef4..2493241db3049 100644 --- a/FWCore/Framework/interface/ProductResolverBase.h +++ b/FWCore/Framework/interface/ProductResolverBase.h @@ -12,7 +12,7 @@ ProductResolver: Class to handle access to a WrapperBase and its related informa #include "DataFormats/Common/interface/ProductData.h" #include "DataFormats/Provenance/interface/BranchDescription.h" #include "DataFormats/Provenance/interface/BranchID.h" -#include "FWCore/Common/interface/Provenance.h" +#include "DataFormats/Provenance/interface/Provenance.h" #include "FWCore/Utilities/interface/ProductResolverIndex.h" #include "FWCore/Utilities/interface/TypeID.h" @@ -97,6 +97,9 @@ namespace edm { // Retrieves pointer to a class containing both the event independent and the per even provenance. Provenance const* provenance() const; + // Retrieves pointer to a class containing the event independent provenance. + StableProvenance const* stableProvenance() const {return &provenance()->stable();} + // Initializes the event independent portion of the provenance, plus the process history ID, the product ID, and the provRetriever. void setProvenance(ProductProvenanceRetriever const* provRetriever, ProcessHistory const& ph, ProductID const& pid) { setProvenance_(provRetriever, ph, pid); } diff --git a/FWCore/Framework/interface/Run.h b/FWCore/Framework/interface/Run.h index 3c2e3b5af3728..725cc0863d6eb 100644 --- a/FWCore/Framework/interface/Run.h +++ b/FWCore/Framework/interface/Run.h @@ -127,7 +127,7 @@ namespace edm { getProvenance(BranchID const& theID) const; void - getAllProvenance(std::vector& provenances) const; + getAllStableProvenance(std::vector& provenances) const; // Return true if this Run has been subjected to a process with // the given processName, and false otherwise. diff --git a/FWCore/Framework/src/Event.cc b/FWCore/Framework/src/Event.cc index 1e6af78b7c7de..fb3a2d016ce7e 100644 --- a/FWCore/Framework/src/Event.cc +++ b/FWCore/Framework/src/Event.cc @@ -2,7 +2,8 @@ #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h" -#include "FWCore/Common/interface/Provenance.h" +#include "DataFormats/Provenance/interface/Provenance.h" +#include "DataFormats/Provenance/interface/StableProvenance.h" #include "FWCore/Common/interface/TriggerResultsByName.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/LuminosityBlock.h" @@ -91,6 +92,11 @@ namespace edm { provRecorder_.principal().getAllProvenance(provenances); } + void + Event::getAllStableProvenance(std::vector& provenances) const { + provRecorder_.principal().getAllStableProvenance(provenances); + } + bool Event::getProcessParameterSet(std::string const& processName, ParameterSet& ps) const { diff --git a/FWCore/Framework/src/EventForOutput.cc b/FWCore/Framework/src/EventForOutput.cc index 85610bc51da9f..89766c7f50768 100644 --- a/FWCore/Framework/src/EventForOutput.cc +++ b/FWCore/Framework/src/EventForOutput.cc @@ -2,7 +2,6 @@ #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h" -#include "FWCore/Common/interface/Provenance.h" #include "FWCore/Common/interface/TriggerResultsByName.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/LuminosityBlockForOutput.h" diff --git a/FWCore/Framework/src/EventPrincipal.cc b/FWCore/Framework/src/EventPrincipal.cc index 34c42a1a1c477..df5a74cd8e9a3 100644 --- a/FWCore/Framework/src/EventPrincipal.cc +++ b/FWCore/Framework/src/EventPrincipal.cc @@ -10,8 +10,8 @@ #include "DataFormats/Provenance/interface/RunLumiEventNumber.h" #include "DataFormats/Provenance/interface/ProductIDToBranchID.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" +#include "DataFormats/Provenance/interface/Provenance.h" #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" -#include "FWCore/Common/interface/Provenance.h" #include "FWCore/Framework/interface/DelayedReader.h" #include "FWCore/Framework/interface/ProductResolverBase.h" #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" diff --git a/FWCore/Framework/src/LuminosityBlock.cc b/FWCore/Framework/src/LuminosityBlock.cc index 950416bf74374..4bd6a274e2619 100644 --- a/FWCore/Framework/src/LuminosityBlock.cc +++ b/FWCore/Framework/src/LuminosityBlock.cc @@ -55,8 +55,8 @@ namespace edm { } void - LuminosityBlock::getAllProvenance(std::vector& provenances) const { - luminosityBlockPrincipal().getAllProvenance(provenances); + LuminosityBlock::getAllStableProvenance(std::vector& provenances) const { + luminosityBlockPrincipal().getAllStableProvenance(provenances); } void diff --git a/FWCore/Framework/src/OccurrenceForOutput.cc b/FWCore/Framework/src/OccurrenceForOutput.cc index cab430f15ddd2..da6e95717569d 100644 --- a/FWCore/Framework/src/OccurrenceForOutput.cc +++ b/FWCore/Framework/src/OccurrenceForOutput.cc @@ -2,7 +2,8 @@ #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h" -#include "FWCore/Common/interface/Provenance.h" +#include "DataFormats/Provenance/interface/Provenance.h" +#include "DataFormats/Provenance/interface/StableProvenance.h" #include "FWCore/Common/interface/TriggerResultsByName.h" #include "FWCore/Framework/interface/Principal.h" #include "FWCore/ParameterSet/interface/Registry.h" @@ -45,6 +46,11 @@ namespace edm { provRecorder_.principal().getAllProvenance(provenances); } + void + OccurrenceForOutput::getAllStableProvenance(std::vector& provenances) const { + provRecorder_.principal().getAllStableProvenance(provenances); + } + ProcessHistory const& OccurrenceForOutput::processHistory() const { return provRecorder_.processHistory(); diff --git a/FWCore/Framework/src/Principal.cc b/FWCore/Framework/src/Principal.cc index 56da7ac5acb23..b1decfe0538fb 100644 --- a/FWCore/Framework/src/Principal.cc +++ b/FWCore/Framework/src/Principal.cc @@ -774,6 +774,21 @@ namespace edm { } } + // This one is also mostly for test printout purposes + // No attempt to trigger on demand execution + // Skips provenance for dropped branches. + void + Principal::getAllStableProvenance(std::vector& provenances) const { + provenances.clear(); + for(auto const& productResolver : *this) { + if(productResolver->singleProduct() && !productResolver->branchDescription().isAlias()) { + if(productResolver->stableProvenance()->branchDescription().present()) { + provenances.push_back(productResolver->stableProvenance()); + } + } + } + } + void Principal::recombine(Principal& other, std::vector const& bids) { for(auto& prod : bids) { diff --git a/FWCore/Framework/src/ProductResolvers.h b/FWCore/Framework/src/ProductResolvers.h index 564b12e3f5a7e..9d93529636fd3 100644 --- a/FWCore/Framework/src/ProductResolvers.h +++ b/FWCore/Framework/src/ProductResolvers.h @@ -12,7 +12,7 @@ a set of related EDProducts. This is the storage unit of such information. #include "DataFormats/Common/interface/ProductData.h" #include "DataFormats/Provenance/interface/BranchDescription.h" #include "DataFormats/Provenance/interface/BranchID.h" -#include "FWCore/Common/interface/Provenance.h" +#include "DataFormats/Provenance/interface/Provenance.h" #include "FWCore/Utilities/interface/ProductResolverIndex.h" #include "FWCore/Utilities/interface/TypeID.h" diff --git a/FWCore/Framework/src/Run.cc b/FWCore/Framework/src/Run.cc index 023e562e8856e..4db70276a44ae 100644 --- a/FWCore/Framework/src/Run.cc +++ b/FWCore/Framework/src/Run.cc @@ -34,8 +34,8 @@ namespace edm { } void - Run::getAllProvenance(std::vector& provenances) const { - runPrincipal().getAllProvenance(provenances); + Run::getAllStableProvenance(std::vector& provenances) const { + runPrincipal().getAllStableProvenance(provenances); } /* Not yet fully implemented diff --git a/FWCore/Framework/test/eventprincipal_t.cppunit.cc b/FWCore/Framework/test/eventprincipal_t.cppunit.cc index b52c780f0f401..c0de11b669d46 100644 --- a/FWCore/Framework/test/eventprincipal_t.cppunit.cc +++ b/FWCore/Framework/test/eventprincipal_t.cppunit.cc @@ -21,7 +21,6 @@ Test of the EventPrincipal class. #include "DataFormats/Provenance/interface/RunAuxiliary.h" #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" #include "DataFormats/TestObjects/interface/ToyProducts.h" -#include "FWCore/Common/interface/Provenance.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" #include "FWCore/Framework/interface/RunPrincipal.h" diff --git a/FWCore/Framework/test/stubs/TestMergeResults.cc b/FWCore/Framework/test/stubs/TestMergeResults.cc index 5b618184658d2..280002fe70226 100644 --- a/FWCore/Framework/test/stubs/TestMergeResults.cc +++ b/FWCore/Framework/test/stubs/TestMergeResults.cc @@ -13,10 +13,10 @@ #include "DataFormats/Provenance/interface/BranchDescription.h" #include "DataFormats/Provenance/interface/BranchID.h" #include "DataFormats/Provenance/interface/ProcessHistory.h" +#include "DataFormats/Provenance/interface/Provenance.h" #include "DataFormats/TestObjects/interface/Thing.h" #include "DataFormats/TestObjects/interface/ThingWithIsEqual.h" #include "DataFormats/TestObjects/interface/ThingWithMerge.h" -#include "FWCore/Common/interface/Provenance.h" #include "FWCore/Framework/interface/ConstProductRegistry.h" #include "FWCore/Framework/interface/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" diff --git a/FWCore/Framework/test/stubs/TestPRegisterModule2.cc b/FWCore/Framework/test/stubs/TestPRegisterModule2.cc index 3a262126eddbe..6cb8aeaa31613 100644 --- a/FWCore/Framework/test/stubs/TestPRegisterModule2.cc +++ b/FWCore/Framework/test/stubs/TestPRegisterModule2.cc @@ -26,10 +26,10 @@ TestPRegisterModule2::TestPRegisterModule2(edm::ParameterSet const&){ void TestPRegisterModule2::produce(Event& e, EventSetup const&) { - std::vector plist; - e.getAllProvenance(plist); + std::vector plist; + e.getAllStableProvenance(plist); - std::vector::const_iterator pd = plist.begin(); + std::vector::const_iterator pd = plist.begin(); CPPUNIT_ASSERT(0 !=plist.size()); CPPUNIT_ASSERT(2 ==plist.size()); diff --git a/FWCore/Modules/src/EventContentAnalyzer.cc b/FWCore/Modules/src/EventContentAnalyzer.cc index f1941e0dd0327..49dfbba62791e 100644 --- a/FWCore/Modules/src/EventContentAnalyzer.cc +++ b/FWCore/Modules/src/EventContentAnalyzer.cc @@ -333,10 +333,10 @@ namespace edm { // ------------ method called to produce the data ------------ void EventContentAnalyzer::analyze(Event const& iEvent, EventSetup const&) { - typedef std::vector Provenances; + typedef std::vector Provenances; Provenances provenances; - iEvent.getAllProvenance(provenances); + iEvent.getAllStableProvenance(provenances); if(listContent_) { LogAbsolute("EventContent") << "\n" << indentation_ << "Event " << std::setw(5) << evno_ << " contains " @@ -346,21 +346,19 @@ namespace edm { } std::string startIndent = indentation_+verboseIndentation_; - for(Provenances::iterator itProv = provenances.begin(), itProvEnd = provenances.end(); - itProv != itProvEnd; - ++itProv) { - std::string const& className = (*itProv)->className(); + for(auto const& provenance : provenances) { + std::string const& className = provenance->className(); - std::string const& friendlyName = (*itProv)->friendlyClassName(); + std::string const& friendlyName = provenance->friendlyClassName(); //if(friendlyName.empty()) friendlyName = std::string("||"); - std::string const& modLabel = (*itProv)->moduleLabel(); + std::string const& modLabel = provenance->moduleLabel(); //if(modLabel.empty()) modLabel = std::string("||"); - std::string const& instanceName = (*itProv)->productInstanceName(); + std::string const& instanceName = provenance->productInstanceName(); //if(instanceName.empty()) instanceName = std::string("||"); - std::string const& processName = (*itProv)->processName(); + std::string const& processName = provenance->processName(); bool doVerbose = verbose_ && (moduleLabels_.empty() || binary_search_all(moduleLabels_, modLabel)); @@ -370,7 +368,7 @@ namespace edm { << " \"" << modLabel << "\" \"" << instanceName << "\" \"" << processName << "\"" - << " (productId = " << (*itProv)->productID() << ")" + << " (productId = " << provenance->productID() << ")" << std::endl; } diff --git a/Fireworks/FWInterface/src/FWFFMetadataManager.cc b/Fireworks/FWInterface/src/FWFFMetadataManager.cc index 41b2126bfafe8..efb0b60f1c1cc 100644 --- a/Fireworks/FWInterface/src/FWFFMetadataManager.cc +++ b/Fireworks/FWInterface/src/FWFFMetadataManager.cc @@ -1,7 +1,7 @@ #include "Fireworks/FWInterface/src/FWFFMetadataManager.h" #include "Fireworks/FWInterface/src/FWFFMetadataUpdateRequest.h" #include "Fireworks/Core/interface/fwLog.h" -#include "DataFormats/Provenance/interface/Provenance.h" +#include "DataFormats/Provenance/interface/StableProvenance.h" #include "DataFormats/Provenance/interface/BranchDescription.h" #include "FWCore/Framework/interface/Event.h" #include "Fireworks/Core/interface/FWItemAccessorFactory.h" @@ -16,12 +16,12 @@ bool FWFFMetadataManager::hasModuleLabel(std::string& iModuleLabel) { if (m_event) { - std::vector provenances; - m_event->getAllProvenance(provenances); + std::vector provenances; + m_event->getAllStableProvenance(provenances); for (size_t pi = 0, pe = provenances.size(); pi != pe; ++pi) { - edm::Provenance const *provenance = provenances[pi]; + edm::StableProvenance const *provenance = provenances[pi]; if (provenance && (provenance->branchDescription().moduleLabel() == iModuleLabel)) return true; } @@ -44,21 +44,18 @@ FWFFMetadataManager::doUpdate(FWJobMetadataUpdateRequest* request) typedef std::set Purposes; Purposes purposes; - std::vector provenances; + std::vector provenances; - event.getAllProvenance(provenances); + event.getAllStableProvenance(provenances); for (size_t pi = 0, pe = provenances.size(); pi != pe; ++pi) { - edm::Provenance const *provenance = provenances[pi]; + edm::StableProvenance const *provenance = provenances[pi]; if (!provenance) continue; Data d; const edm::BranchDescription &desc = provenance->branchDescription(); - if (!desc.present()) - continue; - const std::vector& infos = m_typeAndReps->representationsForType(desc.fullClassName()); diff --git a/IOPool/Input/test/IOExerciser.cc b/IOPool/Input/test/IOExerciser.cc index 4c3909d814796..d10a28fcfc53b 100644 --- a/IOPool/Input/test/IOExerciser.cc +++ b/IOPool/Input/test/IOExerciser.cc @@ -23,7 +23,7 @@ to use this plugin. #include // user include files -#include "FWCore/Common/interface/Provenance.h" +#include "DataFormats/Provenance/interface/StableProvenance.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/OutputModule.h" #include "FWCore/Framework/interface/EventForOutput.h" @@ -179,11 +179,11 @@ void IOExerciser::computeProducts(edm::EventForOutput const& e, TokenMap const& tokens) { using namespace edm; - typedef std::vector Provenances; + typedef std::vector Provenances; m_fetchedProducts = true; Provenances provenances; - e.getAllProvenance(provenances); + e.getAllStableProvenance(provenances); if (!m_eventsTree) { @@ -205,7 +205,7 @@ IOExerciser::computeProducts(edm::EventForOutput const& e, TokenMap const& token LogWarning("IOExerciser") << "Ignoring missing branch " << branchName; continue; } - edm::BranchID bid = provenance->product().branchID(); + edm::BranchID bid = provenance->branchID(); auto const iter = m_tokens.find(bid); if (iter == m_tokens.end()) { // product not kept diff --git a/IOPool/Input/test/ProductInfo.h b/IOPool/Input/test/ProductInfo.h index 44ff7e36891db..b12139f508a59 100644 --- a/IOPool/Input/test/ProductInfo.h +++ b/IOPool/Input/test/ProductInfo.h @@ -1,8 +1,8 @@ +#include "DataFormats/Provenance/interface/Provenance.h" #include "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Utilities/interface/TypeID.h" -#include "FWCore/Common/interface/Provenance.h" #include diff --git a/RecoMET/METFilters/plugins/EcalDeadCellTriggerPrimitiveFilter.cc b/RecoMET/METFilters/plugins/EcalDeadCellTriggerPrimitiveFilter.cc index 7593e65f41383..da52fba70604b 100644 --- a/RecoMET/METFilters/plugins/EcalDeadCellTriggerPrimitiveFilter.cc +++ b/RecoMET/METFilters/plugins/EcalDeadCellTriggerPrimitiveFilter.cc @@ -234,11 +234,11 @@ EcalDeadCellTriggerPrimitiveFilter::~EcalDeadCellTriggerPrimitiveFilter() { void EcalDeadCellTriggerPrimitiveFilter::loadEventInfoForFilter(const edm::Event &iEvent){ - std::vector provenances; - iEvent.getAllProvenance(provenances); + std::vector provenances; + iEvent.getAllStableProvenance(provenances); const unsigned int nProvenance = provenances.size(); for (unsigned int ip = 0; ip < nProvenance; ip++) { - const edm::Provenance& provenance = *( provenances[ip] ); + const edm::StableProvenance& provenance = *( provenances[ip] ); if( provenance.moduleLabel().data() == tpDigiCollection_.label() ){ hastpDigiCollection_ = 1; } if( provenance.moduleLabel().data() == ebReducedRecHitCollection_.label() || provenance.moduleLabel().data() == eeReducedRecHitCollection_.label() ){ hasReducedRecHits_++; diff --git a/Validation/GlobalDigis/src/GlobalDigisAnalyzer.cc b/Validation/GlobalDigis/src/GlobalDigisAnalyzer.cc index 6cff543c1799d..1bf4dfa9cf250 100644 --- a/Validation/GlobalDigis/src/GlobalDigisAnalyzer.cc +++ b/Validation/GlobalDigis/src/GlobalDigisAnalyzer.cc @@ -460,8 +460,8 @@ void GlobalDigisAnalyzer::analyze(const edm::Event& iEvent, // look at information available in the event if (getAllProvenances) { - std::vector AllProv; - iEvent.getAllProvenance(AllProv); + std::vector AllProv; + iEvent.getAllStableProvenance(AllProv); if (verbosity >= 0) edm::LogInfo(MsgLoggerCat) diff --git a/Validation/GlobalDigis/src/GlobalDigisHistogrammer.cc b/Validation/GlobalDigis/src/GlobalDigisHistogrammer.cc index 05fb6a7ccc28f..929ba9c10e20d 100644 --- a/Validation/GlobalDigis/src/GlobalDigisHistogrammer.cc +++ b/Validation/GlobalDigis/src/GlobalDigisHistogrammer.cc @@ -358,8 +358,8 @@ void GlobalDigisHistogrammer::analyze(const edm::Event& iEvent, // look at information available in the event if (getAllProvenances) { - std::vector AllProv; - iEvent.getAllProvenance(AllProv); + std::vector AllProv; + iEvent.getAllStableProvenance(AllProv); if (verbosity >= 0) edm::LogInfo(MsgLoggerCat) diff --git a/Validation/GlobalDigis/src/GlobalDigisProducer.cc b/Validation/GlobalDigis/src/GlobalDigisProducer.cc index 961f26c59d6a7..5367c75e7164b 100644 --- a/Validation/GlobalDigis/src/GlobalDigisProducer.cc +++ b/Validation/GlobalDigis/src/GlobalDigisProducer.cc @@ -206,8 +206,8 @@ void GlobalDigisProducer::produce(edm::Event& iEvent, // look at information available in the event if (getAllProvenances) { - std::vector AllProv; - iEvent.getAllProvenance(AllProv); + std::vector AllProv; + iEvent.getAllStableProvenance(AllProv); if (verbosity >= 0) edm::LogInfo(MsgLoggerCat) diff --git a/Validation/GlobalHits/src/GlobalHitsAnalyzer.cc b/Validation/GlobalHits/src/GlobalHitsAnalyzer.cc index 57636dd69d745..29c741c0dffae 100644 --- a/Validation/GlobalHits/src/GlobalHitsAnalyzer.cc +++ b/Validation/GlobalHits/src/GlobalHitsAnalyzer.cc @@ -707,8 +707,8 @@ void GlobalHitsAnalyzer::analyze(const edm::Event& iEvent, // look at information available in the event if (getAllProvenances) { - std::vector AllProv; - iEvent.getAllProvenance(AllProv); + std::vector AllProv; + iEvent.getAllStableProvenance(AllProv); if (verbosity >= 0) edm::LogInfo(MsgLoggerCat) diff --git a/Validation/GlobalHits/src/GlobalHitsHistogrammer.cc b/Validation/GlobalHits/src/GlobalHitsHistogrammer.cc index 6d879a367a705..4c068a9edf159 100644 --- a/Validation/GlobalHits/src/GlobalHitsHistogrammer.cc +++ b/Validation/GlobalHits/src/GlobalHitsHistogrammer.cc @@ -530,8 +530,8 @@ void GlobalHitsHistogrammer::analyze(const edm::Event& iEvent, // look at information available in the event if (getAllProvenances) { - std::vector AllProv; - iEvent.getAllProvenance(AllProv); + std::vector AllProv; + iEvent.getAllStableProvenance(AllProv); if (verbosity >= 0) edm::LogInfo(MsgLoggerCat) diff --git a/Validation/GlobalHits/src/GlobalHitsProdHist.cc b/Validation/GlobalHits/src/GlobalHitsProdHist.cc index ba5044b129561..d8add75b0b33c 100644 --- a/Validation/GlobalHits/src/GlobalHitsProdHist.cc +++ b/Validation/GlobalHits/src/GlobalHitsProdHist.cc @@ -655,8 +655,8 @@ void GlobalHitsProdHist::produce(edm::Event& iEvent, // look at information available in the event if (getAllProvenances) { - std::vector AllProv; - iEvent.getAllProvenance(AllProv); + std::vector AllProv; + iEvent.getAllStableProvenance(AllProv); if (verbosity >= 0) edm::LogInfo(MsgLoggerCat) diff --git a/Validation/GlobalHits/src/GlobalHitsProdHistStripper.cc b/Validation/GlobalHits/src/GlobalHitsProdHistStripper.cc index 39ee5b55e6aa1..812712e6cafdd 100644 --- a/Validation/GlobalHits/src/GlobalHitsProdHistStripper.cc +++ b/Validation/GlobalHits/src/GlobalHitsProdHistStripper.cc @@ -112,8 +112,8 @@ void GlobalHitsProdHistStripper::beginRun(const edm::Run& iRun, if (getAllProvenances) { - std::vector AllProv; - iRun.getAllProvenance(AllProv); + std::vector AllProv; + iRun.getAllStableProvenance(AllProv); if (verbosity >= 0) edm::LogInfo(MsgLoggerCat) diff --git a/Validation/GlobalHits/src/GlobalHitsProducer.cc b/Validation/GlobalHits/src/GlobalHitsProducer.cc index e3c75ff452d5c..e7b7d167b9259 100644 --- a/Validation/GlobalHits/src/GlobalHitsProducer.cc +++ b/Validation/GlobalHits/src/GlobalHitsProducer.cc @@ -198,8 +198,8 @@ void GlobalHitsProducer::produce(edm::Event& iEvent, // look at information available in the event if (getAllProvenances) { - std::vector AllProv; - iEvent.getAllProvenance(AllProv); + std::vector AllProv; + iEvent.getAllStableProvenance(AllProv); if (verbosity >= 0) edm::LogInfo(MsgLoggerCat) diff --git a/Validation/GlobalRecHits/src/GlobalRecHitsAnalyzer.cc b/Validation/GlobalRecHits/src/GlobalRecHitsAnalyzer.cc index 53775218d1e6c..5cac39cbfc8ac 100644 --- a/Validation/GlobalRecHits/src/GlobalRecHitsAnalyzer.cc +++ b/Validation/GlobalRecHits/src/GlobalRecHitsAnalyzer.cc @@ -316,8 +316,8 @@ void GlobalRecHitsAnalyzer::analyze(const edm::Event& iEvent, // look at information available in the event if (getAllProvenances) { - std::vector AllProv; - iEvent.getAllProvenance(AllProv); + std::vector AllProv; + iEvent.getAllStableProvenance(AllProv); if (verbosity >= 0) edm::LogInfo(MsgLoggerCat) diff --git a/Validation/GlobalRecHits/src/GlobalRecHitsHistogrammer.cc b/Validation/GlobalRecHits/src/GlobalRecHitsHistogrammer.cc index 633daae34e682..e130dc4c020c6 100644 --- a/Validation/GlobalRecHits/src/GlobalRecHitsHistogrammer.cc +++ b/Validation/GlobalRecHits/src/GlobalRecHitsHistogrammer.cc @@ -286,8 +286,8 @@ void GlobalRecHitsHistogrammer::analyze(const edm::Event& iEvent, // look at information available in the event if (getAllProvenances) { - std::vector AllProv; - iEvent.getAllProvenance(AllProv); + std::vector AllProv; + iEvent.getAllStableProvenance(AllProv); if (verbosity >= 0) edm::LogInfo(MsgLoggerCat) diff --git a/Validation/GlobalRecHits/src/GlobalRecHitsProducer.cc b/Validation/GlobalRecHits/src/GlobalRecHitsProducer.cc index b5d04dfcd155a..70576842c6fb0 100644 --- a/Validation/GlobalRecHits/src/GlobalRecHitsProducer.cc +++ b/Validation/GlobalRecHits/src/GlobalRecHitsProducer.cc @@ -166,8 +166,8 @@ void GlobalRecHitsProducer::produce(edm::Event& iEvent, // look at information available in the event if (getAllProvenances) { - std::vector AllProv; - iEvent.getAllProvenance(AllProv); + std::vector AllProv; + iEvent.getAllStableProvenance(AllProv); if (verbosity >= 0) edm::LogInfo(MsgLoggerCat) diff --git a/Validation/MuonHits/src/MuonSimHitsValidAnalyzer.cc b/Validation/MuonHits/src/MuonSimHitsValidAnalyzer.cc index 06d496b4f9230..010269e05b58a 100644 --- a/Validation/MuonHits/src/MuonSimHitsValidAnalyzer.cc +++ b/Validation/MuonHits/src/MuonSimHitsValidAnalyzer.cc @@ -269,8 +269,8 @@ void MuonSimHitsValidAnalyzer::analyze(const edm::Event& iEvent, /// look at information available in the event if (getAllProvenances) { - std::vector AllProv; - iEvent.getAllProvenance(AllProv); + std::vector AllProv; + iEvent.getAllStableProvenance(AllProv); if (verbosity > 0) edm::LogInfo ("MuonSimHitsValidAnalyzer::analyze") diff --git a/Validation/TrackerHits/src/TrackerHitProducer.cc b/Validation/TrackerHits/src/TrackerHitProducer.cc index a466b25d8941c..e59225d7fa7c2 100644 --- a/Validation/TrackerHits/src/TrackerHitProducer.cc +++ b/Validation/TrackerHits/src/TrackerHitProducer.cc @@ -152,8 +152,8 @@ void TrackerHitProducer::produce(edm::Event& iEvent, // look at information available in the event if (getAllProvenances) { - std::vector AllProv; - iEvent.getAllProvenance(AllProv); + std::vector AllProv; + iEvent.getAllStableProvenance(AllProv); if (verbosity > 0) edm::LogInfo ("TrackerHitProducer::produce")