diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc index 48f3a47afaad3..3277308ec566c 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc @@ -16,6 +16,7 @@ #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h" #include "DataFormats/SiStripCommon/interface/SiStripFedKey.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/GetPassID.h" @@ -64,6 +65,7 @@ namespace sistrip { productRegistry_->setFrozen(); eventPrincipal_ = std::make_unique(source_->productRegistry(), + edm::productResolversFactory::makePrimary, std::make_shared(), std::make_shared(), *processConfiguration_, @@ -183,22 +185,22 @@ namespace sistrip { CountersPtr inputL1ACounters = getCounters(event, l1aCountersTag_); CountersPtr inputAPVAddresses = getCounters(event, apvAddressesTag_, false); const edm::DetSetVector* inputScopeDigis = - getProduct >(event, scopeDigisTag_); + getProduct>(event, scopeDigisTag_); const edm::DetSetVector* inputPayloadDigis = - getProduct >(event, payloadDigisTag_); + getProduct>(event, payloadDigisTag_); const edm::DetSetVector* inputReorderedDigis = - getProduct >(event, reorderedDigisTag_); + getProduct>(event, reorderedDigisTag_); const edm::DetSetVector* inputVirginRawDigis = - getProduct >(event, virginRawDigisTag_); + getProduct>(event, virginRawDigisTag_); //construct the output vectors if the digis were found and they do not exist if (inputScopeDigis && !mo.outputScopeDigisVector_.get()) - mo.outputScopeDigisVector_.reset(new std::vector >); + mo.outputScopeDigisVector_ = std::make_shared>>(); if (inputPayloadDigis && !mo.outputPayloadDigisVector_.get()) - mo.outputPayloadDigisVector_.reset(new std::vector >); + mo.outputPayloadDigisVector_ = std::make_shared>>(); if (inputReorderedDigis && !mo.outputReorderedDigisVector_.get()) - mo.outputReorderedDigisVector_.reset(new std::vector >); + mo.outputReorderedDigisVector_ = std::make_shared>>(); if (inputVirginRawDigis && !mo.outputVirginRawDigisVector_.get()) - mo.outputVirginRawDigisVector_.reset(new std::vector >); + mo.outputVirginRawDigisVector_ = std::make_shared>>(); //find matching FEDs std::set matchingFeds; findMatchingFeds(eventId, apvAddress, inputTotalEventCounters, inputL1ACounters, inputAPVAddresses, matchingFeds); @@ -309,10 +311,10 @@ namespace sistrip { std::vector& outputTotalEventCounters, std::vector& outputL1ACounters, std::vector& outputAPVAddresses, - std::vector >* outputScopeDigisVector, - std::vector >* outputPayloadDigisVector, - std::vector >* outputReorderedDigisVector, - std::vector >* outputVirginRawDigisVector, + std::vector>* outputScopeDigisVector, + std::vector>* outputPayloadDigisVector, + std::vector>* outputReorderedDigisVector, + std::vector>* outputVirginRawDigisVector, const SiStripFedCabling& cabling) { //reserve space in vectors if (inputScopeDigis) { @@ -391,12 +393,12 @@ namespace sistrip { SpyEventMatcher::CountersPtr SpyEventMatcher::getCounters(const edm::EventPrincipal& event, const edm::InputTag& tag, const bool mapKeyIsByFedID) { - const std::vector* vectorFromEvent = getProduct >(event, tag); + const std::vector* vectorFromEvent = getProduct>(event, tag); if (vectorFromEvent) { //vector is from event so, will be deleted when the event is destroyed (and not before) return std::make_shared(vectorFromEvent); } else { - const std::map* mapFromEvent = getProduct >(event, tag); + const std::map* mapFromEvent = getProduct>(event, tag); if (mapFromEvent) { std::vector* newVector = new std::vector(FED_ID_MAX + 1, 0); if (mapKeyIsByFedID) { @@ -428,10 +430,10 @@ namespace sistrip { std::vector& theTotalEventCounters, std::vector& theL1ACounters, std::vector& theAPVAddresses, - std::vector >* theScopeDigisVector, - std::vector >* thePayloadDigisVector, - std::vector >* theReorderedDigisVector, - std::vector >* theVirginRawDigisVector) + std::vector>* theScopeDigisVector, + std::vector>* thePayloadDigisVector, + std::vector>* theReorderedDigisVector, + std::vector>* theVirginRawDigisVector) : rawData(new FEDRawDataCollection), totalEventCounters(new std::vector), l1aCounters(new std::vector), diff --git a/FWCore/Framework/interface/EventPrincipal.h b/FWCore/Framework/interface/EventPrincipal.h index 7e7df959bb806..c91a698a08ff6 100644 --- a/FWCore/Framework/interface/EventPrincipal.h +++ b/FWCore/Framework/interface/EventPrincipal.h @@ -23,6 +23,7 @@ is the DataBlock. #include "FWCore/Utilities/interface/Signal.h" #include "FWCore/Utilities/interface/get_underlying_safe.h" #include "FWCore/Framework/interface/Principal.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include #include @@ -51,16 +52,26 @@ namespace edm { typedef Principal Base; typedef Base::ConstProductResolverPtr ConstProductResolverPtr; - static int const invalidBunchXing = EventAuxiliary::invalidBunchXing; - static int const invalidStoreNumber = EventAuxiliary::invalidStoreNumber; + static constexpr int invalidBunchXing = EventAuxiliary::invalidBunchXing; + static constexpr int invalidStoreNumber = EventAuxiliary::invalidStoreNumber; + template EventPrincipal(std::shared_ptr reg, + FACTORY&& iFactory, std::shared_ptr branchIDListHelper, std::shared_ptr thinnedAssociationsHelper, ProcessConfiguration const& pc, HistoryAppender* historyAppender, unsigned int streamIndex = 0, - bool isForPrimaryProcess = true, - ProcessBlockHelperBase const* processBlockHelper = nullptr); + ProcessBlockHelperBase const* processBlockHelper = nullptr) + : EventPrincipal(reg, + iFactory(InEvent, pc.processName(), *reg), + branchIDListHelper, + thinnedAssociationsHelper, + pc, + historyAppender, + streamIndex, + processBlockHelper) {} + ~EventPrincipal() override {} void fillEventPrincipal(EventAuxiliary const& aux, @@ -161,6 +172,15 @@ namespace edm { unsigned int processBlockIndex(std::string const& processName) const override; private: + EventPrincipal(std::shared_ptr reg, + std::vector>&& resolvers, + std::shared_ptr branchIDListHelper, + std::shared_ptr thinnedAssociationsHelper, + ProcessConfiguration const& pc, + HistoryAppender* historyAppender, + unsigned int streamIndex, + ProcessBlockHelperBase const* processBlockHelper); + BranchID pidToBid(ProductID const& pid) const; edm::ThinnedAssociation const* getThinnedAssociation(edm::BranchID const& branchID) const; diff --git a/FWCore/Framework/interface/LuminosityBlockPrincipal.h b/FWCore/Framework/interface/LuminosityBlockPrincipal.h index 5e6f58c3932c0..037f0e139876a 100644 --- a/FWCore/Framework/interface/LuminosityBlockPrincipal.h +++ b/FWCore/Framework/interface/LuminosityBlockPrincipal.h @@ -16,6 +16,7 @@ is the DataBlock. #include "DataFormats/Provenance/interface/RunID.h" #include "FWCore/Utilities/interface/LuminosityBlockIndex.h" #include "FWCore/Framework/interface/Principal.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "FWCore/Utilities/interface/propagate_const.h" #include @@ -33,11 +34,13 @@ namespace edm { typedef LuminosityBlockAuxiliary Auxiliary; typedef Principal Base; + template LuminosityBlockPrincipal(std::shared_ptr reg, + FACTORY&& iFactory, ProcessConfiguration const& pc, HistoryAppender* historyAppender, - unsigned int index, - bool isForPrimaryProcess = true); + unsigned int index) + : LuminosityBlockPrincipal(reg, iFactory(InLumi, pc.processName(), *reg), pc, historyAppender, index) {} ~LuminosityBlockPrincipal() override {} @@ -77,6 +80,11 @@ namespace edm { void setShouldWriteLumi(ShouldWriteLumi value) { shouldWriteLumi_ = value; } private: + LuminosityBlockPrincipal(std::shared_ptr reg, + std::vector>&& resolvers, + ProcessConfiguration const& pc, + HistoryAppender* historyAppender, + unsigned int index); unsigned int transitionIndex_() const override; edm::propagate_const> runPrincipal_; diff --git a/FWCore/Framework/interface/Principal.h b/FWCore/Framework/interface/Principal.h index 241427b63b88e..e39e15b8d0b5a 100644 --- a/FWCore/Framework/interface/Principal.h +++ b/FWCore/Framework/interface/Principal.h @@ -67,11 +67,10 @@ namespace edm { typedef std::string ProcessName; Principal(std::shared_ptr reg, - std::shared_ptr productLookup, + std::vector>&& resolvers, ProcessConfiguration const& pc, BranchType bt, - HistoryAppender* historyAppender, - bool isForPrimaryProcess = true); + HistoryAppender* historyAppender); ~Principal() override; @@ -218,16 +217,9 @@ namespace edm { //called by adjustIndexesAfterProductRegistryAddition only if an index actually changed virtual void changedIndexes_() {} - void addScheduledProduct(std::shared_ptr bd); - void addSourceProduct(std::shared_ptr bd); + //called by adjustIndexesAfterProductRegistryAddition void addDelayedReaderInputProduct(std::shared_ptr bd); void addPutOnReadInputProduct(std::shared_ptr bd); - void addUnscheduledProduct(std::shared_ptr bd); - void addTransformProduct(std::shared_ptr bd); - void addAliasedProduct(std::shared_ptr bd); - void addSwitchProducerProduct(std::shared_ptr bd); - void addSwitchAliasProduct(std::shared_ptr bd); - void addParentProcessProduct(std::shared_ptr bd); WrapperBase const* getIt(ProductID const&) const override; std::optional> getThinnedProduct(ProductID const&, diff --git a/FWCore/Framework/interface/ProcessBlockPrincipal.h b/FWCore/Framework/interface/ProcessBlockPrincipal.h index 3a2e74326a8ba..c5f10965dfd9c 100644 --- a/FWCore/Framework/interface/ProcessBlockPrincipal.h +++ b/FWCore/Framework/interface/ProcessBlockPrincipal.h @@ -21,9 +21,12 @@ namespace edm { class ProcessBlockPrincipal : public Principal { public: - ProcessBlockPrincipal(std::shared_ptr, - ProcessConfiguration const&, - bool isForPrimaryProcess = true); + template + requires(requires(FACTORY&& f, std::string const& name, ProductRegistry const& reg) { f(InProcess, name, reg); }) + ProcessBlockPrincipal(std::shared_ptr iReg, + FACTORY&& iFactory, + ProcessConfiguration const& iConfig) + : ProcessBlockPrincipal(iReg, iFactory(InProcess, iConfig.processName(), *iReg), iConfig) {} void fillProcessBlockPrincipal(std::string const& processName, DelayedReader* reader = nullptr); @@ -35,6 +38,9 @@ namespace edm { unsigned int index() const { return 0; } private: + ProcessBlockPrincipal(std::shared_ptr, + std::vector>&& resolvers, + ProcessConfiguration const&); unsigned int transitionIndex_() const final; std::string processName_; diff --git a/FWCore/Framework/interface/ProductResolversFactory.h b/FWCore/Framework/interface/ProductResolversFactory.h new file mode 100644 index 0000000000000..ba003c1cd1774 --- /dev/null +++ b/FWCore/Framework/interface/ProductResolversFactory.h @@ -0,0 +1,56 @@ +#ifndef FWCore_Framework_ProductResolversFactory_h +#define FWCore_Framework_ProductResolversFactory_h +// -*- C++ -*- +// +// Package: FWCore/Framework +// Class : ProductResolversFactory +// +/**\class edm::ProductResolversFactory ProductResolversFactory.h "ProductResolversFactory.h" + + Description: Creates ProductResolvers + + Usage: + + +*/ +// +// Original Author: Chris Jones +// Created: Mon, 30 Dec 2024 +// + +// system include files +#include +#include "DataFormats/Provenance/interface/ProductRegistry.h" + +// user include files + +// forward declarations +namespace edm { + + class ProductResolverBase; + class ProductResolverIndexHelper; + + template + concept ProductResolversFactory = + requires(F&& f, std::string const& name, ProductRegistry const& reg) { f(InEvent, name, reg); }; + + namespace productResolversFactory { + std::vector> make(BranchType bt, + std::string_view iProcessName, + ProductRegistry const& iReg, + bool isForPrimaryProcess); + inline std::vector> makePrimary(BranchType bt, + std::string_view iProcessName, + ProductRegistry const& iReg) { + return make(bt, iProcessName, iReg, true); + } + inline std::vector> makeSubProcess(BranchType bt, + std::string_view iProcessName, + ProductRegistry const& iReg) { + return make(bt, iProcessName, iReg, false); + } + + }; // namespace productResolversFactory +} // namespace edm + +#endif diff --git a/FWCore/Framework/interface/RunPrincipal.h b/FWCore/Framework/interface/RunPrincipal.h index d4ff1923a79d1..6d2402590662d 100644 --- a/FWCore/Framework/interface/RunPrincipal.h +++ b/FWCore/Framework/interface/RunPrincipal.h @@ -22,6 +22,7 @@ is the DataBlock. #include "FWCore/Utilities/interface/propagate_const.h" #include "FWCore/Utilities/interface/RunIndex.h" #include "FWCore/Framework/interface/Principal.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" namespace edm { @@ -36,12 +37,19 @@ namespace edm { typedef RunAuxiliary Auxiliary; typedef Principal Base; + template RunPrincipal(std::shared_ptr reg, + FACTORY&& iFactory, ProcessConfiguration const& pc, HistoryAppender* historyAppender, unsigned int iRunIndex, - bool isForPrimaryProcess = true, - MergeableRunProductProcesses const* mergeableRunProductProcesses = nullptr); + MergeableRunProductProcesses const* mergeableRunProductProcesses = nullptr) + : RunPrincipal(reg, + iFactory(InRun, pc.processName(), *reg), + pc, + historyAppender, + iRunIndex, + mergeableRunProductProcesses) {} ~RunPrincipal() override; void fillRunPrincipal(ProcessHistoryRegistry const& processHistoryRegistry, DelayedReader* reader = nullptr); @@ -87,6 +95,12 @@ namespace edm { void setShouldWriteRun(ShouldWriteRun value) { shouldWriteRun_ = value; } private: + RunPrincipal(std::shared_ptr reg, + std::vector>&& resolvers, + ProcessConfiguration const& pc, + HistoryAppender* historyAppender, + unsigned int iRunIndex, + MergeableRunProductProcesses const* mergeableRunProductProcesses); unsigned int transitionIndex_() const override; RunAuxiliary aux_; diff --git a/FWCore/Framework/src/EventPrincipal.cc b/FWCore/Framework/src/EventPrincipal.cc index 438ffb82ff05e..176d4d81d9286 100644 --- a/FWCore/Framework/src/EventPrincipal.cc +++ b/FWCore/Framework/src/EventPrincipal.cc @@ -32,14 +32,14 @@ namespace edm { EventPrincipal::EventPrincipal(std::shared_ptr reg, + std::vector>&& resolvers, std::shared_ptr branchIDListHelper, std::shared_ptr thinnedAssociationsHelper, ProcessConfiguration const& pc, HistoryAppender* historyAppender, unsigned int streamIndex, - bool isForPrimaryProcess, ProcessBlockHelperBase const* processBlockHelper) - : Base(reg, reg->productLookup(InEvent), pc, InEvent, historyAppender, isForPrimaryProcess), + : Base(reg, std::move(resolvers), pc, InEvent, historyAppender), aux_(), luminosityBlockPrincipal_(nullptr), provRetrieverPtr_(new ProductProvenanceRetriever(streamIndex, *reg)), diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index a3c4999c7341a..cd2e6b0d3fb09 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -42,6 +42,7 @@ #include "FWCore/Framework/interface/globalTransitionAsync.h" #include "FWCore/Framework/interface/TriggerNamesService.h" #include "FWCore/Framework/src/SendSourceTerminationSignalIfException.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -543,33 +544,39 @@ namespace edm { for (unsigned int index = 0; index < preallocations_.numberOfStreams(); ++index) { // Reusable event principal auto ep = std::make_shared(preg(), + productResolversFactory::makePrimary, branchIDListHelper(), thinnedAssociationsHelper(), *processConfiguration_, historyAppender_.get(), index, - true /*primary process*/, &*processBlockHelper_); principalCache_.insert(std::move(ep)); } for (unsigned int index = 0; index < preallocations_.numberOfRuns(); ++index) { - auto rp = std::make_unique( - preg(), *processConfiguration_, historyAppender_.get(), index, true, &mergeableRunProductProcesses_); + auto rp = std::make_unique(preg(), + productResolversFactory::makePrimary, + *processConfiguration_, + historyAppender_.get(), + index, + &mergeableRunProductProcesses_); principalCache_.insert(std::move(rp)); } for (unsigned int index = 0; index < preallocations_.numberOfLuminosityBlocks(); ++index) { - auto lp = - std::make_unique(preg(), *processConfiguration_, historyAppender_.get(), index); + auto lp = std::make_unique( + preg(), productResolversFactory::makePrimary, *processConfiguration_, historyAppender_.get(), index); principalCache_.insert(std::move(lp)); } { - auto pb = std::make_unique(preg(), *processConfiguration_); + auto pb = std::make_unique( + preg(), productResolversFactory::makePrimary, *processConfiguration_); principalCache_.insert(std::move(pb)); - auto pbForInput = std::make_unique(preg(), *processConfiguration_); + auto pbForInput = std::make_unique( + preg(), productResolversFactory::makePrimary, *processConfiguration_); principalCache_.insertForInput(std::move(pbForInput)); } diff --git a/FWCore/Framework/src/LuminosityBlockPrincipal.cc b/FWCore/Framework/src/LuminosityBlockPrincipal.cc index 63994ccb77de9..03915be523068 100644 --- a/FWCore/Framework/src/LuminosityBlockPrincipal.cc +++ b/FWCore/Framework/src/LuminosityBlockPrincipal.cc @@ -3,15 +3,12 @@ #include "DataFormats/Provenance/interface/ProductRegistry.h" namespace edm { - LuminosityBlockPrincipal::LuminosityBlockPrincipal(std::shared_ptr reg, + std::vector>&& resolvers, ProcessConfiguration const& pc, HistoryAppender* historyAppender, - unsigned int index, - bool isForPrimaryProcess) - : Base(reg, reg->productLookup(InLumi), pc, InLumi, historyAppender, isForPrimaryProcess), - runPrincipal_(), - index_(index) {} + unsigned int index) + : Base(reg, std::move(resolvers), pc, InLumi, historyAppender), runPrincipal_(), index_(index) {} void LuminosityBlockPrincipal::fillLuminosityBlockPrincipal(ProcessHistory const* processHistory, DelayedReader* reader) { diff --git a/FWCore/Framework/src/Principal.cc b/FWCore/Framework/src/Principal.cc index bf1a07357435e..8cfb9ae9c4db9 100644 --- a/FWCore/Framework/src/Principal.cc +++ b/FWCore/Framework/src/Principal.cc @@ -116,185 +116,23 @@ namespace edm { } Principal::Principal(std::shared_ptr reg, - std::shared_ptr productLookup, + std::vector>&& resolvers, ProcessConfiguration const& pc, BranchType bt, - HistoryAppender* historyAppender, - bool isForPrimaryProcess) + HistoryAppender* historyAppender) : EDProductGetter(), processHistoryPtr_(), processHistoryID_(), processHistoryIDBeforeConfig_(), processConfiguration_(&pc), - productResolvers_(), + productResolvers_(resolvers.begin(), resolvers.end()), preg_(reg), - productLookup_(productLookup), - lookupProcessOrder_(productLookup->lookupProcessNames().size(), 0), + productLookup_(reg->productLookup(bt)), + lookupProcessOrder_(productLookup_->lookupProcessNames().size(), 0), reader_(), branchType_(bt), historyAppender_(historyAppender), - cacheIdentifier_(nextIdentifier()) { - productResolvers_.resize(reg->getNextIndexValue(bt)); - //Now that these have been set, we can create the list of Branches we need. - std::string const source("source"); - ProductRegistry::ProductList const& prodsList = reg->productList(); - // The constructor of an alias product holder takes as an argument the product holder for which it is an alias. - // So, the non-alias product holders must be created first. - // Therefore, on this first pass, skip current EDAliases. - bool hasAliases = false; - bool hasSwitchAliases = false; - for (auto const& prod : prodsList) { - BranchDescription const& bd = prod.second; - if (bd.branchType() == branchType_) { - if (isForPrimaryProcess or bd.processName() == pc.processName()) { - if (bd.isAlias()) { - hasAliases = true; - } else if (bd.isSwitchAlias()) { - hasSwitchAliases = true; - } else { - auto cbd = std::make_shared(bd); - if (bd.produced()) { - if (bd.moduleLabel() == source) { - addSourceProduct(cbd); - } else if (bd.onDemand()) { - assert(branchType_ == InEvent); - if (bd.isTransform()) { - addTransformProduct(cbd); - } else { - addUnscheduledProduct(cbd); - } - } else { - addScheduledProduct(cbd); - } - } else { - if (bd.onDemand()) { - addDelayedReaderInputProduct(cbd); - } else { - addPutOnReadInputProduct(cbd); - } - } - } - } else { - //We are in a SubProcess and this branch is from the parent - auto cbd = std::make_shared(bd); - addParentProcessProduct(cbd); - } - } - } - // Now process any EDAliases - if (hasAliases) { - for (auto const& prod : prodsList) { - BranchDescription const& bd = prod.second; - if (bd.isAlias() && bd.branchType() == branchType_) { - addAliasedProduct(std::make_shared(bd)); - } - } - } - // Finally process any SwitchProducer aliases - if (hasSwitchAliases) { - for (auto const& prod : prodsList) { - BranchDescription const& bd = prod.second; - if (bd.isSwitchAlias() && bd.branchType() == branchType_) { - assert(branchType_ == InEvent); - auto cbd = std::make_shared(bd); - // Need different implementation for SwitchProducers not - // in any Path (onDemand) and for those in a Path in order - // to prevent the switch-aliased-for EDProducers from - // being run when the SwitchProducer is in a Path after a - // failing EDFilter. - if (bd.onDemand()) { - addSwitchAliasProduct(cbd); - } else { - addSwitchProducerProduct(cbd); - } - } - } - } - - // Now create the ProductResolvers that search in reverse process - // order and are used for queries where the process name is the - // empty string - std::vector const& lookupProcessNames = productLookup_->lookupProcessNames(); - std::vector matchingHolders(lookupProcessNames.size(), ProductResolverIndexInvalid); - std::vector ambiguous(lookupProcessNames.size(), false); - unsigned int beginElements = productLookup_->beginElements(); - std::vector const& sortedTypeIDs = productLookup_->sortedTypeIDs(); - std::vector const& ranges = productLookup_->ranges(); - std::vector const& indexAndNames = productLookup_->indexAndNames(); - std::vector const& processNamesCharArray = productLookup_->processNames(); - - unsigned int numberOfMatches = 0; - ProductResolverIndex lastMatchIndex = ProductResolverIndexInvalid; - if (!sortedTypeIDs.empty()) { - ProductResolverIndex productResolverIndex = ProductResolverIndexInvalid; - for (unsigned int k = 0, kEnd = sortedTypeIDs.size(); k < kEnd; ++k) { - ProductResolverIndexHelper::Range const& range = ranges.at(k); - for (unsigned int i = range.begin(); i < range.end(); ++i) { - ProductResolverIndexHelper::IndexAndNames const& product = indexAndNames.at(i); - if (product.startInProcessNames() == 0) { - if (productResolverIndex != ProductResolverIndexInvalid) { - if ((numberOfMatches == 1) and (lastMatchIndex != ProductResolverIndexAmbiguous)) { - //only one choice so use a special resolver - productResolvers_.at(productResolverIndex) = - std::make_shared(lastMatchIndex); - } else { - bool productMadeAtEnd = false; - //Need to know if the product from this processes is added at end of transition - for (unsigned int j = 0; j < matchingHolders.size(); ++j) { - if ((not ambiguous[j]) and ProductResolverIndexInvalid != matchingHolders[j] and - productResolvers_[matchingHolders[j]]->branchDescription().availableOnlyAtEndTransition()) { - productMadeAtEnd = true; - break; - } - } - std::shared_ptr newHolder = - std::make_shared(matchingHolders, ambiguous, productMadeAtEnd); - productResolvers_.at(productResolverIndex) = newHolder; - } - matchingHolders.assign(lookupProcessNames.size(), ProductResolverIndexInvalid); - ambiguous.assign(lookupProcessNames.size(), false); - numberOfMatches = 0; - lastMatchIndex = ProductResolverIndexInvalid; - } - productResolverIndex = product.index(); - } else { - std::string process(&processNamesCharArray.at(product.startInProcessNames())); - auto iter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), process); - assert(iter != lookupProcessNames.end()); - ProductResolverIndex iMatchingIndex = product.index(); - lastMatchIndex = iMatchingIndex; - assert(iMatchingIndex != ProductResolverIndexInvalid); - ++numberOfMatches; - if (iMatchingIndex == ProductResolverIndexAmbiguous) { - assert(k >= beginElements); - ambiguous.at(iter - lookupProcessNames.begin()) = true; - } else { - matchingHolders.at(iter - lookupProcessNames.begin()) = iMatchingIndex; - } - } - } - } - //Need to know if the product from this processes is added at end of transition - if ((numberOfMatches == 1) and (lastMatchIndex != ProductResolverIndexAmbiguous)) { - //only one choice so use a special resolver - productResolvers_.at(productResolverIndex) = - std::make_shared(lastMatchIndex); - } else { - bool productMadeAtEnd = false; - for (unsigned int i = 0; i < matchingHolders.size(); ++i) { - if ((not ambiguous[i]) and ProductResolverIndexInvalid != matchingHolders[i] and - productResolvers_[matchingHolders[i]]->branchDescription().availableOnlyAtEndTransition()) { - productMadeAtEnd = true; - break; - } - } - std::shared_ptr newHolder = - std::make_shared(matchingHolders, ambiguous, productMadeAtEnd); - productResolvers_.at(productResolverIndex) = newHolder; - } - } - } - + cacheIdentifier_(nextIdentifier()) {} Principal::~Principal() {} // Number of products in the Principal. @@ -328,16 +166,6 @@ namespace edm { return true; } - void Principal::addScheduledProduct(std::shared_ptr bd) { - auto phb = std::make_unique(std::move(bd)); - addProductOrThrow(std::move(phb)); - } - - void Principal::addSourceProduct(std::shared_ptr bd) { - auto phb = std::make_unique(std::move(bd)); - addProductOrThrow(std::move(phb)); - } - void Principal::addDelayedReaderInputProduct(std::shared_ptr bd) { addProductOrThrow(std::make_unique(std::move(bd))); } @@ -346,42 +174,6 @@ namespace edm { addProductOrThrow(std::make_unique(std::move(bd))); } - void Principal::addUnscheduledProduct(std::shared_ptr bd) { - addProductOrThrow(std::make_unique(std::move(bd))); - } - - void Principal::addTransformProduct(std::shared_ptr bd) { - addProductOrThrow(std::make_unique(std::move(bd))); - } - - void Principal::addAliasedProduct(std::shared_ptr bd) { - ProductResolverIndex index = preg_->indexFrom(bd->originalBranchID()); - assert(index != ProductResolverIndexInvalid); - - addProductOrThrow(std::make_unique( - std::move(bd), dynamic_cast(*productResolvers_[index]))); - } - - void Principal::addSwitchProducerProduct(std::shared_ptr bd) { - ProductResolverIndex index = preg_->indexFrom(bd->switchAliasForBranchID()); - assert(index != ProductResolverIndexInvalid); - - addProductOrThrow(std::make_unique( - std::move(bd), dynamic_cast(*productResolvers_[index]))); - } - - void Principal::addSwitchAliasProduct(std::shared_ptr bd) { - ProductResolverIndex index = preg_->indexFrom(bd->switchAliasForBranchID()); - assert(index != ProductResolverIndexInvalid); - - addProductOrThrow(std::make_unique( - std::move(bd), dynamic_cast(*productResolvers_[index]))); - } - - void Principal::addParentProcessProduct(std::shared_ptr bd) { - addProductOrThrow(std::make_unique(std::move(bd))); - } - // "Zero" the principal so it can be reused for another Event. void Principal::clearPrincipal() { //We do not clear the product history information diff --git a/FWCore/Framework/src/ProcessBlockPrincipal.cc b/FWCore/Framework/src/ProcessBlockPrincipal.cc index 2fd05a2a36478..46d691b3c7ba9 100644 --- a/FWCore/Framework/src/ProcessBlockPrincipal.cc +++ b/FWCore/Framework/src/ProcessBlockPrincipal.cc @@ -9,9 +9,9 @@ namespace edm { ProcessBlockPrincipal::ProcessBlockPrincipal(std::shared_ptr reg, - ProcessConfiguration const& pc, - bool isForPrimaryProcess) - : Principal(reg, reg->productLookup(InProcess), pc, InProcess, nullptr, isForPrimaryProcess) {} + std::vector>&& resolvers, + ProcessConfiguration const& pc) + : Principal(reg, std::move(resolvers), pc, InProcess, nullptr) {} void ProcessBlockPrincipal::fillProcessBlockPrincipal(std::string const& processNameOfBlock, DelayedReader* reader) { processName_ = processNameOfBlock; diff --git a/FWCore/Framework/src/ProductResolversFactory.cc b/FWCore/Framework/src/ProductResolversFactory.cc new file mode 100644 index 0000000000000..e99f015374bf4 --- /dev/null +++ b/FWCore/Framework/src/ProductResolversFactory.cc @@ -0,0 +1,253 @@ +#include "FWCore/Framework/interface/ProductResolversFactory.h" +#include "FWCore/Framework/interface/ProductResolverBase.h" +#include "DataFormats/Provenance/interface/ProductResolverIndexHelper.h" +#include "ProductResolvers.h" + +#include + +namespace edm::productResolversFactory { + namespace { + std::shared_ptr makeScheduledProduct(std::shared_ptr bd) { + return std::make_shared(std::move(bd)); + } + std::shared_ptr makeSourceProduct(std::shared_ptr bd) { + return std::make_shared(std::move(bd)); + } + std::shared_ptr makeDelayedReaderInputProduct(std::shared_ptr bd) { + return std::make_shared(std::move(bd)); + } + std::shared_ptr makePutOnReadInputProduct(std::shared_ptr bd) { + return std::make_shared(std::move(bd)); + } + std::shared_ptr makeUnscheduledProduct(std::shared_ptr bd) { + return std::make_shared(std::move(bd)); + } + std::shared_ptr makeTransformProduct(std::shared_ptr bd) { + return std::make_shared(std::move(bd)); + } + std::shared_ptr makeAliasedProduct( + std::shared_ptr bd, + ProductRegistry const& iReg, + std::vector> const& iResolvers) { + ProductResolverIndex index = iReg.indexFrom(bd->originalBranchID()); + assert(index != ProductResolverIndexInvalid); + return std::make_shared( + std::move(bd), dynamic_cast(*iResolvers[index])); + } + std::shared_ptr makeSwitchProducerProduct( + std::shared_ptr bd, + ProductRegistry const& iReg, + std::vector> const& iResolvers) { + ProductResolverIndex index = iReg.indexFrom(bd->switchAliasForBranchID()); + assert(index != ProductResolverIndexInvalid); + + return std::make_shared( + std::move(bd), dynamic_cast(*iResolvers[index])); + } + + std::shared_ptr makeSwitchAliasProduct( + std::shared_ptr bd, + ProductRegistry const& iReg, + std::vector> const& iResolvers) { + ProductResolverIndex index = iReg.indexFrom(bd->switchAliasForBranchID()); + assert(index != ProductResolverIndexInvalid); + + return std::make_shared( + std::move(bd), dynamic_cast(*iResolvers[index])); + } + + std::shared_ptr makeParentProcessProduct(std::shared_ptr bd) { + return std::make_shared(std::move(bd)); + } + + void addProductOrThrow(std::shared_ptr iResolver, + std::vector>& oResolvers, + ProductRegistry const& iReg) { + assert(bool(iResolver)); + BranchDescription const& bd = iResolver->branchDescription(); + assert(!bd.className().empty()); + assert(!bd.friendlyClassName().empty()); + assert(!bd.moduleLabel().empty()); + assert(!bd.processName().empty()); + auto index = iReg.indexFrom(bd.branchID()); + if (oResolvers[index]) { + throw Exception(errors::InsertFailure, "AlreadyPresent") + << "Problem found while adding a new ProductResolver, " + << "product already exists for (" << bd.friendlyClassName() << "," << bd.moduleLabel() << "," + << bd.productInstanceName() << "," << bd.processName() << ")\n"; + } + oResolvers[index] = std::move(iResolver); + } + + std::shared_ptr makeForPrimary(BranchDescription const& bd, + ProductRegistry const& iReg, + ProductResolverIndexHelper const& iHelper) { + auto cbd = std::make_shared(bd); + if (bd.produced()) { + using namespace std::literals; + if (bd.moduleLabel() == "source"sv) { + return makeSourceProduct(cbd); + } else if (bd.onDemand()) { + assert(bd.branchType() == InEvent); + if (bd.isTransform()) { + return makeTransformProduct(cbd); + } else { + return makeUnscheduledProduct(cbd); + } + } + return makeScheduledProduct(cbd); + } + /* not produced so comes from source */ + if (bd.onDemand()) { + return makeDelayedReaderInputProduct(cbd); + } + return makePutOnReadInputProduct(cbd); + } + bool isProductMadeAtEnd(edm::BranchIDList const& matchingHolders, + std::vector const& ambiguous, + std::vector> const& productResolvers) { + for (unsigned int j = 0; j < matchingHolders.size(); ++j) { + if ((not ambiguous[j]) and ProductResolverIndexInvalid != matchingHolders[j] and + productResolvers[matchingHolders[j]]->branchDescription().availableOnlyAtEndTransition()) { + return true; + } + } + return false; + } + std::shared_ptr makeNoProcess( + unsigned int numberOfMatches, + ProductResolverIndex lastMatchIndex, + edm::BranchIDList const& matchingHolders, + std::vector const& ambiguous, + std::vector> const& productResolvers) { + if ((numberOfMatches == 1) and (lastMatchIndex != ProductResolverIndexAmbiguous)) { + //only one choice so use a special resolver + return std::make_shared(lastMatchIndex); + } + //Need to know if the product from this processes is added at end of transition + bool productMadeAtEnd = isProductMadeAtEnd(matchingHolders, ambiguous, productResolvers); + return std::make_shared(matchingHolders, ambiguous, productMadeAtEnd); + } + + void addUnspecifiedProcess(ProductResolverIndexHelper const& iHelper, + std::vector>& productResolvers) { + // Now create the ProductResolvers that search in reverse process + // order and are used for queries where the process name is the + // empty string + std::vector const& lookupProcessNames = iHelper.lookupProcessNames(); + std::vector matchingHolders(lookupProcessNames.size(), ProductResolverIndexInvalid); + std::vector ambiguous(lookupProcessNames.size(), false); + unsigned int beginElements = iHelper.beginElements(); + std::vector const& sortedTypeIDs = iHelper.sortedTypeIDs(); + std::vector const& ranges = iHelper.ranges(); + std::vector const& indexAndNames = iHelper.indexAndNames(); + std::vector const& processNamesCharArray = iHelper.processNames(); + + unsigned int numberOfMatches = 0; + ProductResolverIndex lastMatchIndex = ProductResolverIndexInvalid; + if (!sortedTypeIDs.empty()) { + ProductResolverIndex productResolverIndex = ProductResolverIndexInvalid; + for (unsigned int k = 0, kEnd = sortedTypeIDs.size(); k < kEnd; ++k) { + ProductResolverIndexHelper::Range const& range = ranges.at(k); + for (unsigned int i = range.begin(); i < range.end(); ++i) { + ProductResolverIndexHelper::IndexAndNames const& product = indexAndNames.at(i); + if (product.startInProcessNames() == 0) { + if (productResolverIndex != ProductResolverIndexInvalid) { + productResolvers.at(productResolverIndex) = + makeNoProcess(numberOfMatches, lastMatchIndex, matchingHolders, ambiguous, productResolvers); + matchingHolders.assign(lookupProcessNames.size(), ProductResolverIndexInvalid); + ambiguous.assign(lookupProcessNames.size(), false); + numberOfMatches = 0; + lastMatchIndex = ProductResolverIndexInvalid; + } + productResolverIndex = product.index(); + } else { + const std::string_view process(&processNamesCharArray.at(product.startInProcessNames())); + auto iter = std::find(lookupProcessNames.begin(), lookupProcessNames.end(), process); + assert(iter != lookupProcessNames.end()); + ProductResolverIndex iMatchingIndex = product.index(); + lastMatchIndex = iMatchingIndex; + assert(iMatchingIndex != ProductResolverIndexInvalid); + ++numberOfMatches; + if (iMatchingIndex == ProductResolverIndexAmbiguous) { + assert(k >= beginElements); + ambiguous.at(iter - lookupProcessNames.begin()) = true; + } else { + matchingHolders.at(iter - lookupProcessNames.begin()) = iMatchingIndex; + } + } + } + } + productResolvers.at(productResolverIndex) = + makeNoProcess(numberOfMatches, lastMatchIndex, matchingHolders, ambiguous, productResolvers); + } + } + } // namespace + + std::vector> make(BranchType bt, + std::string_view iProcessName, + ProductRegistry const& iReg, + bool isForPrimaryProcess) { + auto const& helper = iReg.productLookup(bt); + std::vector> productResolvers(iReg.getNextIndexValue(bt)); + ProductRegistry::ProductList const& prodsList = iReg.productList(); + // The constructor of an alias product holder takes as an argument the product holder for which it is an alias. + // So, the non-alias product holders must be created first. + // Therefore, on this first pass, skip current EDAliases. + bool hasAliases = false; + bool hasSwitchAliases = false; + for (auto const& prod : prodsList) { + BranchDescription const& bd = prod.second; + if (bd.branchType() == bt) { + if (isForPrimaryProcess or bd.processName() == iProcessName) { + if (bd.isAlias()) { + hasAliases = true; + } else if (bd.isSwitchAlias()) { + hasSwitchAliases = true; + } else { + addProductOrThrow(makeForPrimary(bd, iReg, *helper), productResolvers, iReg); + } + } else { + //We are in a SubProcess and this branch is from the parent + auto cbd = std::make_shared(bd); + addProductOrThrow(makeParentProcessProduct(cbd), productResolvers, iReg); + } + } + } + // Now process any EDAliases + if (hasAliases) { + for (auto const& prod : prodsList) { + BranchDescription const& bd = prod.second; + if (bd.isAlias() && bd.branchType() == bt) { + addProductOrThrow(makeAliasedProduct(std::make_shared(bd), iReg, productResolvers), + productResolvers, + iReg); + } + } + } + // Finally process any SwitchProducer aliases + if (hasSwitchAliases) { + for (auto const& prod : prodsList) { + BranchDescription const& bd = prod.second; + if (bd.isSwitchAlias() && bd.branchType() == bt) { + assert(bt == InEvent); + auto cbd = std::make_shared(bd); + // Need different implementation for SwitchProducers not + // in any Path (onDemand) and for those in a Path in order + // to prevent the switch-aliased-for EDProducers from + // being run when the SwitchProducer is in a Path after a + // failing EDFilter. + if (bd.onDemand()) { + addProductOrThrow(makeSwitchAliasProduct(cbd, iReg, productResolvers), productResolvers, iReg); + } else { + addProductOrThrow(makeSwitchProducerProduct(cbd, iReg, productResolvers), productResolvers, iReg); + } + } + } + } + + addUnspecifiedProcess(*helper, productResolvers); + + return productResolvers; + } +} // namespace edm::productResolversFactory \ No newline at end of file diff --git a/FWCore/Framework/src/RunPrincipal.cc b/FWCore/Framework/src/RunPrincipal.cc index 50dd37be60bd5..98a8793e18f44 100644 --- a/FWCore/Framework/src/RunPrincipal.cc +++ b/FWCore/Framework/src/RunPrincipal.cc @@ -9,12 +9,12 @@ namespace edm { RunPrincipal::RunPrincipal(std::shared_ptr reg, + std::vector>&& resolvers, ProcessConfiguration const& pc, HistoryAppender* historyAppender, unsigned int iRunIndex, - bool isForPrimaryProcess, MergeableRunProductProcesses const* mergeableRunProductProcesses) - : Base(reg, reg->productLookup(InRun), pc, InRun, historyAppender, isForPrimaryProcess), index_(iRunIndex) { + : Base(reg, std::move(resolvers), pc, InRun, historyAppender), index_(iRunIndex) { if (mergeableRunProductProcesses) { // primary RunPrincipals of EventProcessor mergeableRunProductMetadataPtr_ = (std::make_unique(*mergeableRunProductProcesses)); } diff --git a/FWCore/Framework/src/SubProcess.cc b/FWCore/Framework/src/SubProcess.cc index d62785eb57a7b..6addfea6dee5c 100644 --- a/FWCore/Framework/src/SubProcess.cc +++ b/FWCore/Framework/src/SubProcess.cc @@ -31,6 +31,7 @@ #include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/globalTransitionAsync.h" #include "FWCore/Framework/interface/ESRecordsToProductResolverIndices.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "FWCore/ParameterSet/interface/IllegalParameters.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/validateTopLevelParameterSets.h" @@ -185,33 +186,41 @@ namespace edm { principalCache_.setNumberOfConcurrentPrincipals(preallocConfig); for (unsigned int index = 0; index < preallocConfig.numberOfStreams(); ++index) { auto ep = std::make_shared(preg_, + productResolversFactory::makeSubProcess, branchIDListHelper(), thinnedAssociationsHelper(), *processConfiguration_, &(historyAppenders_[index]), index, - false /*not primary process*/, &*processBlockHelper_); principalCache_.insert(ep); } for (unsigned int index = 0; index < preallocConfig.numberOfRuns(); ++index) { - auto rpp = std::make_unique( - preg_, *processConfiguration_, &(historyAppenders_[historyRunOffset_ + index]), index, false); + auto rpp = std::make_unique(preg_, + productResolversFactory::makeSubProcess, + *processConfiguration_, + &(historyAppenders_[historyRunOffset_ + index]), + index); principalCache_.insert(std::move(rpp)); } for (unsigned int index = 0; index < preallocConfig.numberOfLuminosityBlocks(); ++index) { - auto lbpp = std::make_unique( - preg_, *processConfiguration_, &(historyAppenders_[historyLumiOffset_ + index]), index, false); + auto lbpp = std::make_unique(preg_, + productResolversFactory::makeSubProcess, + *processConfiguration_, + &(historyAppenders_[historyLumiOffset_ + index]), + index); principalCache_.insert(std::move(lbpp)); } { - auto pb = std::make_unique(preg_, *processConfiguration_, false); + auto pb = std::make_unique( + preg_, productResolversFactory::makeSubProcess, *processConfiguration_); principalCache_.insert(std::move(pb)); - auto pbForInput = std::make_unique(preg_, *processConfiguration_, false); + auto pbForInput = std::make_unique( + preg_, productResolversFactory::makeSubProcess, *processConfiguration_); principalCache_.insertForInput(std::move(pbForInput)); } diff --git a/FWCore/Framework/test/Event_t.cpp b/FWCore/Framework/test/Event_t.cpp index 408ea1688fba5..3d4007192c186 100644 --- a/FWCore/Framework/test/Event_t.cpp +++ b/FWCore/Framework/test/Event_t.cpp @@ -29,6 +29,7 @@ Test program for edm::Event. #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/Framework/interface/EDConsumerBase.h" #include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h" #include "FWCore/Utilities/interface/Algorithms.h" @@ -447,15 +448,21 @@ void testEvent::setUp() { Timestamp time = make_timestamp(); EventID id = make_id(); ProcessConfiguration const& pc = currentModuleDescription_->processConfiguration(); - auto rp = std::make_shared(preg, pc, &historyAppender_, 0); + auto rp = std::make_shared(preg, edm::productResolversFactory::makePrimary, pc, &historyAppender_, 0); rp->setAux(RunAuxiliary(id.run(), time, time)); - lbp_ = std::make_shared(preg, pc, &historyAppender_, 0); + lbp_ = std::make_shared( + preg, edm::productResolversFactory::makePrimary, pc, &historyAppender_, 0); lbp_->setAux(LuminosityBlockAuxiliary(rp->run(), 1, time, time)); lbp_->setRunPrincipal(rp); EventAuxiliary eventAux(id, uuid, time, true); const_cast(eventAux.processHistoryID()) = processHistoryID; - principal_.reset(new edm::EventPrincipal( - preg, branchIDListHelper_, thinnedAssociationsHelper_, pc, &historyAppender_, edm::StreamID::invalidStreamID())); + principal_.reset(new edm::EventPrincipal(preg, + edm::productResolversFactory::makePrimary, + branchIDListHelper_, + thinnedAssociationsHelper_, + pc, + &historyAppender_, + edm::StreamID::invalidStreamID())); principal_->fillEventPrincipal(eventAux, processHistoryRegistry_.getMapped(eventAux.processHistoryID())); principal_->setLuminosityBlockPrincipal(lbp_.get()); ModuleCallingContext mcc(currentModuleDescription_.get()); diff --git a/FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc b/FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc index 0171be11158b3..388cb00888cf4 100644 --- a/FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc +++ b/FWCore/Framework/test/event_getrefbeforeput_t.cppunit.cc @@ -21,6 +21,7 @@ Test of the EventPrincipal class. #include "FWCore/Framework/interface/ProducesCollector.h" #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/GetPassID.h" @@ -76,15 +77,22 @@ void testEventGetRefBeforePut::failGetProductNotRegisteredTest() { edm::Timestamp fakeTime; edm::ProcessConfiguration pc("PROD", edm::ParameterSetID(), edm::getReleaseVersion(), edm::getPassID()); std::shared_ptr pregc(preg.release()); - auto rp = std::make_shared(pregc, pc, &historyAppender_, 0); + auto rp = + std::make_shared(pregc, edm::productResolversFactory::makePrimary, pc, &historyAppender_, 0); rp->setAux(edm::RunAuxiliary(col.run(), fakeTime, fakeTime)); edm::LuminosityBlockAuxiliary lumiAux(rp->run(), 1, fakeTime, fakeTime); - auto lbp = std::make_shared(pregc, pc, &historyAppender_, 0); + auto lbp = std::make_shared( + pregc, edm::productResolversFactory::makePrimary, pc, &historyAppender_, 0); lbp->setAux(lumiAux); lbp->setRunPrincipal(rp); edm::EventAuxiliary eventAux(col, uuid, fakeTime, true); - edm::EventPrincipal ep( - pregc, branchIDListHelper, thinnedAssociationsHelper, pc, &historyAppender_, edm::StreamID::invalidStreamID()); + edm::EventPrincipal ep(pregc, + edm::productResolversFactory::makePrimary, + branchIDListHelper, + thinnedAssociationsHelper, + pc, + &historyAppender_, + edm::StreamID::invalidStreamID()); ep.fillEventPrincipal(eventAux, nullptr); ep.setLuminosityBlockPrincipal(lbp.get()); try { @@ -170,15 +178,22 @@ void testEventGetRefBeforePut::getRefTest() { processName, dummyProcessPset.id(), edm::getReleaseVersion(), edm::getPassID()); edm::ProcessConfiguration& pc = *pcPtr; std::shared_ptr pregc(preg.release()); - auto rp = std::make_shared(pregc, pc, &historyAppender_, 0); + auto rp = + std::make_shared(pregc, edm::productResolversFactory::makePrimary, pc, &historyAppender_, 0); rp->setAux(edm::RunAuxiliary(col.run(), fakeTime, fakeTime)); edm::LuminosityBlockAuxiliary lumiAux(rp->run(), 1, fakeTime, fakeTime); - auto lbp = std::make_shared(pregc, pc, &historyAppender_, 0); + auto lbp = std::make_shared( + pregc, edm::productResolversFactory::makePrimary, pc, &historyAppender_, 0); lbp->setAux(lumiAux); lbp->setRunPrincipal(rp); edm::EventAuxiliary eventAux(col, uuid, fakeTime, true); - edm::EventPrincipal ep( - pregc, branchIDListHelper, thinnedAssociationsHelper, pc, &historyAppender_, edm::StreamID::invalidStreamID()); + edm::EventPrincipal ep(pregc, + edm::productResolversFactory::makePrimary, + branchIDListHelper, + thinnedAssociationsHelper, + pc, + &historyAppender_, + edm::StreamID::invalidStreamID()); ep.fillEventPrincipal(eventAux, nullptr); ep.setLuminosityBlockPrincipal(lbp.get()); diff --git a/FWCore/Framework/test/eventprincipal_t.cppunit.cc b/FWCore/Framework/test/eventprincipal_t.cppunit.cc index 882d186375c4a..703a90aeea3d7 100644 --- a/FWCore/Framework/test/eventprincipal_t.cppunit.cc +++ b/FWCore/Framework/test/eventprincipal_t.cppunit.cc @@ -24,6 +24,7 @@ Test of the EventPrincipal class. #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" #include "FWCore/Framework/interface/RunPrincipal.h" #include "FWCore/Framework/interface/HistoryAppender.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/GetPassID.h" @@ -171,14 +172,17 @@ void test_ep::setUp() { assert(process); std::string uuid = edm::createGlobalIdentifier(); edm::Timestamp now(1234567UL); - auto rp = std::make_shared(pProductRegistry_, *process, &historyAppender_, 0); + auto rp = std::make_shared( + pProductRegistry_, edm::productResolversFactory::makePrimary, *process, &historyAppender_, 0); rp->setAux(edm::RunAuxiliary(eventID_.run(), now, now)); edm::LuminosityBlockAuxiliary lumiAux(rp->run(), 1, now, now); - lbp_ = std::make_shared(pProductRegistry_, *process, &historyAppender_, 0); + lbp_ = std::make_shared( + pProductRegistry_, edm::productResolversFactory::makePrimary, *process, &historyAppender_, 0); lbp_->setAux(lumiAux); lbp_->setRunPrincipal(rp); edm::EventAuxiliary eventAux(eventID_, uuid, now, true); pEvent_.reset(new edm::EventPrincipal(pProductRegistry_, + edm::productResolversFactory::makePrimary, branchIDListHelper, thinnedAssociationsHelper, *process, diff --git a/FWCore/Framework/test/generichandle_t.cppunit.cc b/FWCore/Framework/test/generichandle_t.cppunit.cc index 30815f7284374..8a096571e7482 100644 --- a/FWCore/Framework/test/generichandle_t.cppunit.cc +++ b/FWCore/Framework/test/generichandle_t.cppunit.cc @@ -20,6 +20,8 @@ Test of GenericHandle class. #include "FWCore/Framework/interface/HistoryAppender.h" #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" #include "FWCore/Framework/interface/RunPrincipal.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" + #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/GetPassID.h" #include "FWCore/Utilities/interface/GlobalIdentifier.h" @@ -78,17 +80,24 @@ void testGenericHandle::failgetbyLabelTest() { edm::ProcessConfiguration pc("PROD", edm::ParameterSetID(), edm::getReleaseVersion(), edm::getPassID()); auto preg = std::make_shared(); preg->setFrozen(); - auto rp = std::make_shared(preg, pc, &historyAppender_, 0); + auto rp = + std::make_shared(preg, edm::productResolversFactory::makePrimary, pc, &historyAppender_, 0); rp->setAux(edm::RunAuxiliary(id.run(), time, time)); - auto lbp = std::make_shared(preg, pc, &historyAppender_, 0); + auto lbp = std::make_shared( + preg, edm::productResolversFactory::makePrimary, pc, &historyAppender_, 0); lbp->setAux(edm::LuminosityBlockAuxiliary(rp->run(), 1, time, time)); lbp->setRunPrincipal(rp); auto branchIDListHelper = std::make_shared(); branchIDListHelper->updateFromRegistry(*preg); auto thinnedAssociationsHelper = std::make_shared(); edm::EventAuxiliary eventAux(id, uuid, time, true); - edm::EventPrincipal ep( - preg, branchIDListHelper, thinnedAssociationsHelper, pc, &historyAppender_, edm::StreamID::invalidStreamID()); + edm::EventPrincipal ep(preg, + edm::productResolversFactory::makePrimary, + branchIDListHelper, + thinnedAssociationsHelper, + pc, + &historyAppender_, + edm::StreamID::invalidStreamID()); ep.fillEventPrincipal(eventAux, nullptr); ep.setLuminosityBlockPrincipal(lbp.get()); edm::GenericHandle h("edmtest::DummyProduct"); @@ -164,14 +173,21 @@ void testGenericHandle::getbyLabelTest() { std::string uuid = edm::createGlobalIdentifier(); edm::ProcessConfiguration pc("PROD", dummyProcessPset.id(), edm::getReleaseVersion(), edm::getPassID()); std::shared_ptr pregc(preg.release()); - auto rp = std::make_shared(pregc, pc, &historyAppender_, 0); + auto rp = + std::make_shared(pregc, edm::productResolversFactory::makePrimary, pc, &historyAppender_, 0); rp->setAux(edm::RunAuxiliary(col.run(), fakeTime, fakeTime)); - auto lbp = std::make_shared(pregc, pc, &historyAppender_, 0); + auto lbp = std::make_shared( + pregc, edm::productResolversFactory::makePrimary, pc, &historyAppender_, 0); lbp->setAux(edm::LuminosityBlockAuxiliary(rp->run(), 1, fakeTime, fakeTime)); lbp->setRunPrincipal(rp); edm::EventAuxiliary eventAux(col, uuid, fakeTime, true); - edm::EventPrincipal ep( - pregc, branchIDListHelper, thinnedAssociationsHelper, pc, &historyAppender_, edm::StreamID::invalidStreamID()); + edm::EventPrincipal ep(pregc, + edm::productResolversFactory::makePrimary, + branchIDListHelper, + thinnedAssociationsHelper, + pc, + &historyAppender_, + edm::StreamID::invalidStreamID()); ep.fillEventPrincipal(eventAux, nullptr); ep.setLuminosityBlockPrincipal(lbp.get()); edm::BranchDescription const& branchFromRegistry = it->second; diff --git a/FWCore/Framework/test/global_filter_t.cppunit.cc b/FWCore/Framework/test/global_filter_t.cppunit.cc index af85e7fc9fc5e..e6cffc3386d4a 100644 --- a/FWCore/Framework/test/global_filter_t.cppunit.cc +++ b/FWCore/Framework/test/global_filter_t.cppunit.cc @@ -17,6 +17,7 @@ #include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" @@ -410,15 +411,18 @@ testGlobalFilter::testGlobalFilter() std::string uuid = edm::createGlobalIdentifier(); edm::Timestamp now(1234567UL); - m_rp.reset(new edm::RunPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_rp.reset( + new edm::RunPrincipal(m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_rp->setAux(edm::RunAuxiliary(eventID.run(), now, now)); auto lumiAux = std::make_shared(m_rp->run(), 1, now, now); - m_lbp.reset(new edm::LuminosityBlockPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_lbp.reset(new edm::LuminosityBlockPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_lbp->setAux(*lumiAux); m_lbp->setRunPrincipal(m_rp); edm::EventAuxiliary eventAux(eventID, uuid, now, true); - m_ep.reset(new edm::EventPrincipal(m_prodReg, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); + m_ep.reset(new edm::EventPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); m_ep->fillEventPrincipal(eventAux, nullptr); m_ep->setLuminosityBlockPrincipal(m_lbp.get()); m_actReg.reset(new edm::ActivityRegistry); diff --git a/FWCore/Framework/test/global_outputmodule_t.cppunit.cc b/FWCore/Framework/test/global_outputmodule_t.cppunit.cc index 32a4d81e9d639..8156abfaaad9e 100644 --- a/FWCore/Framework/test/global_outputmodule_t.cppunit.cc +++ b/FWCore/Framework/test/global_outputmodule_t.cppunit.cc @@ -14,6 +14,7 @@ #include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/maker/WorkerT.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" @@ -169,15 +170,18 @@ testGlobalOutputModule::testGlobalOutputModule() std::string uuid = edm::createGlobalIdentifier(); edm::Timestamp now(1234567UL); - m_rp.reset(new edm::RunPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_rp.reset( + new edm::RunPrincipal(m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_rp->setAux(edm::RunAuxiliary(eventID.run(), now, now)); edm::LuminosityBlockAuxiliary lumiAux(m_rp->run(), 1, now, now); - m_lbp.reset(new edm::LuminosityBlockPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_lbp.reset(new edm::LuminosityBlockPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_lbp->setAux(lumiAux); m_lbp->setRunPrincipal(m_rp); edm::EventAuxiliary eventAux(eventID, uuid, now, true); - m_ep.reset(new edm::EventPrincipal(m_prodReg, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); + m_ep.reset(new edm::EventPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); m_ep->fillEventPrincipal(eventAux, nullptr); m_ep->setLuminosityBlockPrincipal(m_lbp.get()); m_actReg.reset(new edm::ActivityRegistry); diff --git a/FWCore/Framework/test/global_producer_t.cppunit.cc b/FWCore/Framework/test/global_producer_t.cppunit.cc index 3dbcfa6b3384f..a35e62105fe88 100644 --- a/FWCore/Framework/test/global_producer_t.cppunit.cc +++ b/FWCore/Framework/test/global_producer_t.cppunit.cc @@ -17,6 +17,7 @@ #include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" @@ -376,15 +377,18 @@ testGlobalProducer::testGlobalProducer() std::string uuid = edm::createGlobalIdentifier(); edm::Timestamp now(1234567UL); - m_rp.reset(new edm::RunPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_rp.reset( + new edm::RunPrincipal(m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_rp->setAux(edm::RunAuxiliary(eventID.run(), now, now)); auto lumiAux = std::make_shared(m_rp->run(), 1, now, now); - m_lbp.reset(new edm::LuminosityBlockPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_lbp.reset(new edm::LuminosityBlockPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_lbp->setAux(*lumiAux); m_lbp->setRunPrincipal(m_rp); edm::EventAuxiliary eventAux(eventID, uuid, now, true); - m_ep.reset(new edm::EventPrincipal(m_prodReg, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); + m_ep.reset(new edm::EventPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); m_ep->fillEventPrincipal(eventAux, nullptr); m_ep->setLuminosityBlockPrincipal(m_lbp.get()); m_actReg.reset(new edm::ActivityRegistry); diff --git a/FWCore/Framework/test/limited_filter_t.cppunit.cc b/FWCore/Framework/test/limited_filter_t.cppunit.cc index e811b54cab5d9..04af3f145cf5c 100644 --- a/FWCore/Framework/test/limited_filter_t.cppunit.cc +++ b/FWCore/Framework/test/limited_filter_t.cppunit.cc @@ -17,6 +17,7 @@ #include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" @@ -419,15 +420,18 @@ testLimitedFilter::testLimitedFilter() std::string uuid = edm::createGlobalIdentifier(); edm::Timestamp now(1234567UL); - m_rp.reset(new edm::RunPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_rp.reset( + new edm::RunPrincipal(m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_rp->setAux(edm::RunAuxiliary(eventID.run(), now, now)); edm::LuminosityBlockAuxiliary lumiAux(m_rp->run(), 1, now, now); - m_lbp.reset(new edm::LuminosityBlockPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_lbp.reset(new edm::LuminosityBlockPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_lbp->setAux(lumiAux); m_lbp->setRunPrincipal(m_rp); edm::EventAuxiliary eventAux(eventID, uuid, now, true); - m_ep.reset(new edm::EventPrincipal(m_prodReg, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); + m_ep.reset(new edm::EventPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); m_ep->fillEventPrincipal(eventAux, nullptr); m_ep->setLuminosityBlockPrincipal(m_lbp.get()); m_actReg.reset(new edm::ActivityRegistry); diff --git a/FWCore/Framework/test/limited_outputmodule_t.cppunit.cc b/FWCore/Framework/test/limited_outputmodule_t.cppunit.cc index 0d17fe2e0392a..825b103e16423 100644 --- a/FWCore/Framework/test/limited_outputmodule_t.cppunit.cc +++ b/FWCore/Framework/test/limited_outputmodule_t.cppunit.cc @@ -14,6 +14,7 @@ #include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/maker/WorkerT.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" @@ -169,14 +170,17 @@ testLimitedOutputModule::testLimitedOutputModule() std::string uuid = edm::createGlobalIdentifier(); edm::Timestamp now(1234567UL); - m_rp.reset(new edm::RunPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_rp.reset( + new edm::RunPrincipal(m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_rp->setAux(edm::RunAuxiliary(eventID.run(), now, now)); - m_lbp.reset(new edm::LuminosityBlockPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_lbp.reset(new edm::LuminosityBlockPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_lbp->setAux(edm::LuminosityBlockAuxiliary(m_rp->run(), 1, now, now)); m_lbp->setRunPrincipal(m_rp); edm::EventAuxiliary eventAux(eventID, uuid, now, true); - m_ep.reset(new edm::EventPrincipal(m_prodReg, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); + m_ep.reset(new edm::EventPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); m_ep->fillEventPrincipal(eventAux, nullptr); m_ep->setLuminosityBlockPrincipal(m_lbp.get()); m_actReg.reset(new edm::ActivityRegistry); diff --git a/FWCore/Framework/test/limited_producer_t.cppunit.cc b/FWCore/Framework/test/limited_producer_t.cppunit.cc index 86472f4effda9..b7e8028748ab0 100644 --- a/FWCore/Framework/test/limited_producer_t.cppunit.cc +++ b/FWCore/Framework/test/limited_producer_t.cppunit.cc @@ -17,6 +17,7 @@ #include "FWCore/Framework/interface/PreallocationConfiguration.h" #include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" @@ -384,15 +385,18 @@ testLimitedProducer::testLimitedProducer() std::string uuid = edm::createGlobalIdentifier(); edm::Timestamp now(1234567UL); - m_rp.reset(new edm::RunPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_rp.reset( + new edm::RunPrincipal(m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_rp->setAux(edm::RunAuxiliary(eventID.run(), now, now)); edm::LuminosityBlockAuxiliary lumiAux(m_rp->run(), 1, now, now); - m_lbp.reset(new edm::LuminosityBlockPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_lbp.reset(new edm::LuminosityBlockPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_lbp->setAux(lumiAux); m_lbp->setRunPrincipal(m_rp); edm::EventAuxiliary eventAux(eventID, uuid, now, true); - m_ep.reset(new edm::EventPrincipal(m_prodReg, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); + m_ep.reset(new edm::EventPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); m_ep->fillEventPrincipal(eventAux, nullptr); m_ep->setLuminosityBlockPrincipal(m_lbp.get()); m_actReg.reset(new edm::ActivityRegistry); diff --git a/FWCore/Framework/test/one_outputmodule_t.cppunit.cc b/FWCore/Framework/test/one_outputmodule_t.cppunit.cc index fc4fab558f97f..5bdf4d61fdbc2 100644 --- a/FWCore/Framework/test/one_outputmodule_t.cppunit.cc +++ b/FWCore/Framework/test/one_outputmodule_t.cppunit.cc @@ -16,6 +16,7 @@ #include "FWCore/Framework/interface/TransitionInfoTypes.h" #include "FWCore/Framework/interface/maker/WorkerT.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" @@ -264,15 +265,18 @@ testOneOutputModule::testOneOutputModule() std::string uuid = edm::createGlobalIdentifier(); edm::Timestamp now(1234567UL); - m_rp.reset(new edm::RunPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_rp.reset( + new edm::RunPrincipal(m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_rp->setAux(edm::RunAuxiliary(eventID.run(), now, now)); edm::LuminosityBlockAuxiliary lumiAux(m_rp->run(), 1, now, now); - m_lbp.reset(new edm::LuminosityBlockPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_lbp.reset(new edm::LuminosityBlockPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_lbp->setAux(lumiAux); m_lbp->setRunPrincipal(m_rp); edm::EventAuxiliary eventAux(eventID, uuid, now, true); - m_ep.reset(new edm::EventPrincipal(m_prodReg, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); + m_ep.reset(new edm::EventPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_idHelper, m_associationsHelper, m_procConfig, nullptr)); m_ep->fillEventPrincipal(eventAux, nullptr); m_ep->setLuminosityBlockPrincipal(m_lbp.get()); m_actReg.reset(new edm::ActivityRegistry); diff --git a/FWCore/Framework/test/stream_filter_t.cppunit.cc b/FWCore/Framework/test/stream_filter_t.cppunit.cc index 1005d88352f47..fc0400513f483 100644 --- a/FWCore/Framework/test/stream_filter_t.cppunit.cc +++ b/FWCore/Framework/test/stream_filter_t.cppunit.cc @@ -18,6 +18,7 @@ #include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/stream/EDProducerAdaptor.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" @@ -446,10 +447,12 @@ testStreamFilter::testStreamFilter() std::string uuid = edm::createGlobalIdentifier(); edm::Timestamp now(1234567UL); - m_rp.reset(new edm::RunPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_rp.reset( + new edm::RunPrincipal(m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_rp->setAux(edm::RunAuxiliary(eventID.run(), now, now)); auto lumiAux = std::make_shared(m_rp->run(), 1, now, now); - m_lbp.reset(new edm::LuminosityBlockPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_lbp.reset(new edm::LuminosityBlockPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_lbp->setAux(*lumiAux); m_lbp->setRunPrincipal(m_rp); edm::EventAuxiliary eventAux(eventID, uuid, now, true); @@ -460,7 +463,13 @@ testStreamFilter::testStreamFilter() edm::StreamID* pID = reinterpret_cast(&shadowID); assert(pID->value() == 0); - m_ep.reset(new edm::EventPrincipal(m_prodReg, m_idHelper, m_associationsHelper, m_procConfig, nullptr, *pID)); + m_ep.reset(new edm::EventPrincipal(m_prodReg, + edm::productResolversFactory::makePrimary, + m_idHelper, + m_associationsHelper, + m_procConfig, + nullptr, + *pID)); m_ep->fillEventPrincipal(eventAux, nullptr); m_ep->setLuminosityBlockPrincipal(m_lbp.get()); m_actReg.reset(new edm::ActivityRegistry); diff --git a/FWCore/Framework/test/stream_producer_t.cppunit.cc b/FWCore/Framework/test/stream_producer_t.cppunit.cc index a34ed3279f558..729d640a39c3a 100644 --- a/FWCore/Framework/test/stream_producer_t.cppunit.cc +++ b/FWCore/Framework/test/stream_producer_t.cppunit.cc @@ -18,6 +18,7 @@ #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/stream/EDProducerAdaptor.h" #include "FWCore/Framework/interface/OccurrenceTraits.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/ThinnedAssociationsHelper.h" @@ -445,10 +446,12 @@ testStreamProducer::testStreamProducer() std::string uuid = edm::createGlobalIdentifier(); edm::Timestamp now(1234567UL); - m_rp.reset(new edm::RunPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_rp.reset( + new edm::RunPrincipal(m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_rp->setAux(edm::RunAuxiliary(eventID.run(), now, now)); auto lumiAux = std::make_shared(m_rp->run(), 1, now, now); - m_lbp.reset(new edm::LuminosityBlockPrincipal(m_prodReg, m_procConfig, &historyAppender_, 0)); + m_lbp.reset(new edm::LuminosityBlockPrincipal( + m_prodReg, edm::productResolversFactory::makePrimary, m_procConfig, &historyAppender_, 0)); m_lbp->setAux(*lumiAux); m_lbp->setRunPrincipal(m_rp); edm::EventAuxiliary eventAux(eventID, uuid, now, true); @@ -459,7 +462,13 @@ testStreamProducer::testStreamProducer() edm::StreamID* pID = reinterpret_cast(&shadowID); assert(pID->value() == 0); - m_ep.reset(new edm::EventPrincipal(m_prodReg, m_idHelper, m_associationsHelper, m_procConfig, nullptr, *pID)); + m_ep.reset(new edm::EventPrincipal(m_prodReg, + edm::productResolversFactory::makePrimary, + m_idHelper, + m_associationsHelper, + m_procConfig, + nullptr, + *pID)); m_ep->fillEventPrincipal(eventAux, nullptr); m_ep->setLuminosityBlockPrincipal(m_lbp.get()); m_actReg.reset(new edm::ActivityRegistry); diff --git a/FWCore/TestProcessor/src/TestProcessor.cc b/FWCore/TestProcessor/src/TestProcessor.cc index b10c403ee5afe..fbdb3a0f68bd1 100644 --- a/FWCore/TestProcessor/src/TestProcessor.cc +++ b/FWCore/TestProcessor/src/TestProcessor.cc @@ -36,6 +36,7 @@ #include "FWCore/Framework/interface/makeModuleTypeResolverMaker.h" #include "FWCore/Framework/interface/FileBlock.h" #include "FWCore/Framework/interface/MergeableRunProductMetadata.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" #include "FWCore/ServiceRegistry/interface/SystemBounds.h" @@ -165,6 +166,7 @@ namespace edm { for (unsigned int index = 0; index < preallocations_.numberOfStreams(); ++index) { // Reusable event principal auto ep = std::make_shared(preg_, + edm::productResolversFactory::makePrimary, branchIDListHelper_, thinnedAssociationsHelper_, *processConfiguration_, @@ -173,17 +175,22 @@ namespace edm { principalCache_.insert(std::move(ep)); } for (unsigned int index = 0; index < preallocations_.numberOfRuns(); ++index) { - auto rp = std::make_unique( - preg_, *processConfiguration_, historyAppender_.get(), index, true, &mergeableRunProductProcesses_); + auto rp = std::make_unique(preg_, + edm::productResolversFactory::makePrimary, + *processConfiguration_, + historyAppender_.get(), + index, + &mergeableRunProductProcesses_); principalCache_.insert(std::move(rp)); } for (unsigned int index = 0; index < preallocations_.numberOfLuminosityBlocks(); ++index) { - auto lp = - std::make_unique(preg_, *processConfiguration_, historyAppender_.get(), index); + auto lp = std::make_unique( + preg_, edm::productResolversFactory::makePrimary, *processConfiguration_, historyAppender_.get(), index); principalCache_.insert(std::move(lp)); } { - auto pb = std::make_unique(preg_, *processConfiguration_); + auto pb = std::make_unique( + preg_, edm::productResolversFactory::makePrimary, *processConfiguration_); principalCache_.insert(std::move(pb)); } } diff --git a/FWCore/TestProcessor/src/TestSourceProcessor.cc b/FWCore/TestProcessor/src/TestSourceProcessor.cc index 2f26cb3a193b4..8ebd46800f8c5 100644 --- a/FWCore/TestProcessor/src/TestSourceProcessor.cc +++ b/FWCore/TestProcessor/src/TestSourceProcessor.cc @@ -8,6 +8,7 @@ #include "FWCore/Framework/interface/DelayedReader.h" #include "FWCore/Framework/interface/InputSourceDescription.h" #include "FWCore/Framework/interface/maker/InputSourceFactory.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "FWCore/Common/interface/ProcessBlockHelper.h" @@ -172,22 +173,32 @@ namespace edm::test { for (unsigned int index = 0; index < preallocations_.numberOfStreams(); ++index) { // Reusable event principal - auto ep = std::make_shared( - preg_, branchIDListHelper_, thinnedAssociationsHelper_, *processConfiguration_, historyAppender_.get(), index); + auto ep = std::make_shared(preg_, + edm::productResolversFactory::makePrimary, + branchIDListHelper_, + thinnedAssociationsHelper_, + *processConfiguration_, + historyAppender_.get(), + index); principalCache_.insert(std::move(ep)); } for (unsigned int index = 0; index < preallocations_.numberOfRuns(); ++index) { - auto rp = std::make_unique( - preg_, *processConfiguration_, historyAppender_.get(), index, true, &mergeableRunProductProcesses_); + auto rp = std::make_unique(preg_, + edm::productResolversFactory::makePrimary, + *processConfiguration_, + historyAppender_.get(), + index, + &mergeableRunProductProcesses_); principalCache_.insert(std::move(rp)); } for (unsigned int index = 0; index < preallocations_.numberOfLuminosityBlocks(); ++index) { - auto lp = - std::make_unique(preg_, *processConfiguration_, historyAppender_.get(), index); + auto lp = std::make_unique( + preg_, edm::productResolversFactory::makePrimary, *processConfiguration_, historyAppender_.get(), index); principalCache_.insert(std::move(lp)); } { - auto pb = std::make_unique(preg_, *processConfiguration_); + auto pb = std::make_unique( + preg_, edm::productResolversFactory::makePrimary, *processConfiguration_); principalCache_.insert(std::move(pb)); } diff --git a/IOPool/Input/src/OneLumiPoolSource.cc b/IOPool/Input/src/OneLumiPoolSource.cc index 8a33b257b9640..68a8335f81ce9 100644 --- a/IOPool/Input/src/OneLumiPoolSource.cc +++ b/IOPool/Input/src/OneLumiPoolSource.cc @@ -4,6 +4,7 @@ #include "FWCore/Framework/interface/InputSourceMacros.h" #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h" #include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "FWCore/Framework/interface/HistoryAppender.h" @@ -47,7 +48,8 @@ namespace edm { prodReg->setFrozen(); edm::ProcessConfiguration procConfig; - LuminosityBlockPrincipal temp(prodReg, procConfig, &historyAppender, 0); + LuminosityBlockPrincipal temp( + prodReg, edm::productResolversFactory::makePrimary, procConfig, &historyAppender, 0); readLuminosityBlock_(temp); type = PoolSource::getNextItemType(); } while (type == ItemType::IsLumi); diff --git a/IOPool/Input/src/PoolSource.cc b/IOPool/Input/src/PoolSource.cc index 6996f17d0c637..70be1faa8ccd3 100644 --- a/IOPool/Input/src/PoolSource.cc +++ b/IOPool/Input/src/PoolSource.cc @@ -18,6 +18,7 @@ #include "FWCore/Framework/interface/SharedResourcesRegistry.h" #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" #include "FWCore/Framework/interface/RunPrincipal.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/EDMException.h" @@ -100,6 +101,7 @@ namespace edm { secondaryEventPrincipals_.reserve(nStreams_); for (unsigned int index = 0; index < nStreams_; ++index) { secondaryEventPrincipals_.emplace_back(new EventPrincipal(secondaryFileSequence_->fileProductRegistry(), + edm::productResolversFactory::makePrimary, secondaryFileSequence_->fileBranchIDListHelper(), std::make_shared(), processConfiguration(), @@ -191,8 +193,11 @@ namespace edm { if (found) { std::shared_ptr secondaryAuxiliary = secondaryFileSequence_->readRunAuxiliary_(); checkConsistency(runPrincipal.aux(), *secondaryAuxiliary); - secondaryRunPrincipal_ = std::make_shared( - secondaryFileSequence_->fileProductRegistry(), processConfiguration(), nullptr, runPrincipal.index()); + secondaryRunPrincipal_ = std::make_shared(secondaryFileSequence_->fileProductRegistry(), + edm::productResolversFactory::makePrimary, + processConfiguration(), + nullptr, + runPrincipal.index()); secondaryRunPrincipal_->setAux(*secondaryAuxiliary); secondaryFileSequence_->readRun_(*secondaryRunPrincipal_); checkHistoryConsistency(runPrincipal, *secondaryRunPrincipal_); @@ -212,8 +217,12 @@ namespace edm { std::shared_ptr secondaryAuxiliary = secondaryFileSequence_->readLuminosityBlockAuxiliary_(); checkConsistency(lumiPrincipal.aux(), *secondaryAuxiliary); - secondaryLumiPrincipal_ = std::make_shared( - secondaryFileSequence_->fileProductRegistry(), processConfiguration(), nullptr, lumiPrincipal.index()); + secondaryLumiPrincipal_ = + std::make_shared(secondaryFileSequence_->fileProductRegistry(), + edm::productResolversFactory::makePrimary, + processConfiguration(), + nullptr, + lumiPrincipal.index()); secondaryLumiPrincipal_->setAux(*secondaryAuxiliary); secondaryFileSequence_->readLuminosityBlock_(*secondaryLumiPrincipal_); checkHistoryConsistency(lumiPrincipal, *secondaryLumiPrincipal_); diff --git a/IOPool/Input/src/RepeatingCachedRootSource.cc b/IOPool/Input/src/RepeatingCachedRootSource.cc index 7b92607e46125..25d38d415ac1d 100644 --- a/IOPool/Input/src/RepeatingCachedRootSource.cc +++ b/IOPool/Input/src/RepeatingCachedRootSource.cc @@ -30,6 +30,8 @@ #include "FWCore/Framework/interface/DelayedReader.h" #include "FWCore/Framework/interface/InputSourceDescription.h" #include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" + #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Catalog/interface/InputFileCatalog.h" #include "FWCore/Utilities/interface/propagate_const.h" @@ -233,6 +235,7 @@ void RepeatingCachedRootSource::beginJob() { //Thinned collection associations are not supported at this time EventPrincipal eventPrincipal(productRegistry(), + edm::productResolversFactory::makePrimary, branchIDListHelper(), std::make_shared(), processConfiguration, diff --git a/IOPool/SecondaryInput/test/SecondaryProducer.cc b/IOPool/SecondaryInput/test/SecondaryProducer.cc index c2ef4d80fa17c..bd443364968f3 100644 --- a/IOPool/SecondaryInput/test/SecondaryProducer.cc +++ b/IOPool/SecondaryInput/test/SecondaryProducer.cc @@ -18,6 +18,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/ModuleDescription.h" #include "FWCore/Framework/interface/SignallingProductRegistry.h" @@ -71,6 +72,7 @@ namespace edm { void SecondaryProducer::beginJob() { // propagate_const has no reset() function eventPrincipal_ = std::make_unique(secInput_->productRegistry(), + edm::productResolversFactory::makePrimary, std::make_shared(), std::make_shared(), *processConfiguration_, diff --git a/Mixing/Base/src/PileUp.cc b/Mixing/Base/src/PileUp.cc index 1075b8ee1d7f1..3c7db949cc707 100644 --- a/Mixing/Base/src/PileUp.cc +++ b/Mixing/Base/src/PileUp.cc @@ -7,6 +7,7 @@ #include "FWCore/Framework/interface/Run.h" #include "FWCore/Framework/interface/SignallingProductRegistry.h" #include "FWCore/Framework/interface/ESRecordsToProductResolverIndices.h" +#include "FWCore/Framework/interface/ProductResolversFactory.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" #include "FWCore/ServiceRegistry/interface/GlobalContext.h" #include "FWCore/ServiceRegistry/interface/ProcessContext.h" @@ -127,6 +128,7 @@ namespace edm { // A modified HistoryAppender must be used for unscheduled processing. eventPrincipal_ = std::make_unique(input_->productRegistry(), + edm::productResolversFactory::makePrimary, std::make_shared(), std::make_shared(), *processConfiguration_, @@ -245,7 +247,8 @@ namespace edm { void PileUp::beginRun(const edm::Run& run, const edm::EventSetup& setup) { if (provider_.get() != nullptr) { - runPrincipal_ = std::make_shared(productRegistry_, *processConfiguration_, nullptr, 0); + runPrincipal_ = std::make_shared( + productRegistry_, edm::productResolversFactory::makePrimary, *processConfiguration_, nullptr, 0); runPrincipal_->setAux(run.runAuxiliary()); edm::ServiceRegistry::Operate guard(*serviceToken_); streamContext_->setTransition(StreamContext::Transition::kBeginRun); @@ -254,7 +257,8 @@ namespace edm { } void PileUp::beginLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup& setup) { if (provider_.get() != nullptr) { - lumiPrincipal_ = std::make_shared(productRegistry_, *processConfiguration_, nullptr, 0); + lumiPrincipal_ = std::make_shared( + productRegistry_, edm::productResolversFactory::makePrimary, *processConfiguration_, nullptr, 0); lumiPrincipal_->setAux(lumi.luminosityBlockAuxiliary()); lumiPrincipal_->setRunPrincipal(runPrincipal_); setRandomEngine(lumi);