#include <EventSetupsController.h>
Public Member Functions | |
void | clearComponents () |
std::multimap< ParameterSetID, ESProducerInfo > const & | esproducers () const |
std::multimap< ParameterSetID, ESSourceInfo > const & | essources () const |
void | eventSetupForInstance (IOVSyncValue const &syncValue) |
EventSetupsController () | |
void | forceCacheClear () const |
boost::shared_ptr < DataProxyProvider > | getESProducerAndRegisterProcess (ParameterSet const &pset, unsigned subProcessIndex) |
ParameterSet const * | getESProducerPSet (ParameterSetID const &psetID, unsigned subProcessIndex) const |
boost::shared_ptr < EventSetupRecordIntervalFinder > | getESSourceAndRegisterProcess (ParameterSet const &pset, unsigned subProcessIndex) |
unsigned | indexOfNextProcess () const |
bool | isFirstMatch (ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const |
bool | isLastMatch (ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const |
bool | isMatchingESProducer (ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const |
bool | isMatchingESSource (ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const |
void | lookForMatches (ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex, bool &firstProcessWithThisPSet, bool &precedingHasMatchingPSet) const |
boost::shared_ptr < EventSetupProvider > | makeProvider (ParameterSet &) |
bool | mustFinishConfiguration () const |
std::vector< boost::shared_ptr < EventSetupProvider > > const & | providers () const |
void | putESProducer (ParameterSet const &pset, boost::shared_ptr< DataProxyProvider > const &component, unsigned subProcessIndex) |
void | putESSource (ParameterSet const &pset, boost::shared_ptr< EventSetupRecordIntervalFinder > const &component, unsigned subProcessIndex) |
Private Member Functions | |
void | checkESProducerSharing () |
EventSetupsController (EventSetupsController const &) | |
EventSetupsController const & | operator= (EventSetupsController const &) |
Private Attributes | |
std::multimap< ParameterSetID, ESProducerInfo > | esproducers_ |
std::multimap< ParameterSetID, ESSourceInfo > | essources_ |
bool | mustFinishConfiguration_ |
std::vector< boost::shared_ptr < EventSetupProvider > > | providers_ |
Description: Manages a group of EventSetups which can share components
Usage: <usage>
Definition at line 73 of file EventSetupsController.h.
edm::eventsetup::EventSetupsController::EventSetupsController | ( | ) |
Definition at line 29 of file EventSetupsController.cc.
: mustFinishConfiguration_(true) { }
edm::eventsetup::EventSetupsController::EventSetupsController | ( | EventSetupsController const & | ) | [private] |
void edm::eventsetup::EventSetupsController::checkESProducerSharing | ( | ) | [private] |
Definition at line 311 of file EventSetupsController.cc.
References providers_.
Referenced by eventSetupForInstance().
{ // Loop over SubProcesses, skip the top level process. auto esProvider = providers_.begin(); auto esProviderEnd = providers_.end(); if (esProvider != esProviderEnd) ++esProvider; for ( ; esProvider != esProviderEnd; ++esProvider) { // An element is added to this set for each ESProducer // when we have determined which preceding process // this process can share that ESProducer with or // we have determined that it cannot be shared with // any preceding process. // Note the earliest possible preceding process // will be the one selected if there is more than one. std::set<ParameterSetIDHolder> sharingCheckDone; // This will hold an entry for DataProxy's that are // referenced by an EventSetupRecord in this SubProcess. // But only for DataProxy's that are associated with // an ESProducer (not the ones associated with ESSource's // or EDLooper's) std::map<EventSetupRecordKey, std::vector<ComponentDescription const*> > referencedESProducers; // For each EventSetupProvider from a SubProcess, loop over the // EventSetupProviders from the preceding processes (the first // preceding process will be the top level process and the others // SubProcess's) for (auto precedingESProvider = providers_.begin(); precedingESProvider != esProvider; ++precedingESProvider) { (*esProvider)->checkESProducerSharing(**precedingESProvider, sharingCheckDone, referencedESProducers, *this); } (*esProvider)->resetRecordToProxyPointers(); } esProvider = providers_.begin(); for ( ; esProvider != esProviderEnd; ++esProvider) { (*esProvider)->clearInitializationData(); } }
void edm::eventsetup::EventSetupsController::clearComponents | ( | ) |
Definition at line 131 of file EventSetupsController.cc.
References esproducers_, and essources_.
Referenced by eventSetupForInstance().
{ esproducers_.clear(); essources_.clear(); }
std::multimap<ParameterSetID, ESProducerInfo> const& edm::eventsetup::EventSetupsController::esproducers | ( | ) | const [inline] |
Definition at line 121 of file EventSetupsController.h.
References esproducers_.
{ return esproducers_; }
std::multimap<ParameterSetID, ESSourceInfo> const& edm::eventsetup::EventSetupsController::essources | ( | ) | const [inline] |
Definition at line 123 of file EventSetupsController.h.
References essources_.
{ return essources_; }
void edm::eventsetup::EventSetupsController::eventSetupForInstance | ( | IOVSyncValue const & | syncValue | ) |
Definition at line 50 of file EventSetupsController.cc.
References checkESProducerSharing(), clearComponents(), evf::utils::esp, mustFinishConfiguration_, and providers_.
{ if (mustFinishConfiguration_) { std::for_each(providers_.begin(), providers_.end(), [](boost::shared_ptr<EventSetupProvider> const& esp) { esp->finishConfiguration(); }); // When the ESSources and ESProducers were constructed a first pass was // done which attempts to get component sharing between SubProcesses // correct, but in this pass only the configuration of the components // being shared are compared. This is not good enough for ESProducers. // In the following function, all the other components that contribute // to the same record and also the records that record depends on are // also checked. The component sharing is appropriately fixed as necessary. checkESProducerSharing(); clearComponents(); mustFinishConfiguration_ = false; } std::for_each(providers_.begin(), providers_.end(), [&syncValue](boost::shared_ptr<EventSetupProvider> const& esp) { esp->eventSetupForInstance(syncValue); }); }
void edm::eventsetup::EventSetupsController::forceCacheClear | ( | ) | const |
Definition at line 74 of file EventSetupsController.cc.
References evf::utils::esp, and providers_.
{ std::for_each(providers_.begin(), providers_.end(), [](boost::shared_ptr<EventSetupProvider> const& esp) { esp->forceCacheClear(); }); }
boost::shared_ptr< DataProxyProvider > edm::eventsetup::EventSetupsController::getESProducerAndRegisterProcess | ( | ParameterSet const & | pset, |
unsigned | subProcessIndex | ||
) |
Definition at line 81 of file EventSetupsController.cc.
References asciidump::elements, esproducers_, edm::ParameterSet::id(), and edm::isTransientEqual().
Referenced by edm::eventsetup::ModuleMakerTraits::getComponentAndRegisterProcess().
{ // Try to find a DataProxyProvider with a matching ParameterSet auto elements = esproducers_.equal_range(pset.id()); for (auto it = elements.first; it != elements.second; ++it) { // Untracked parameters must also match, do complete comparison if IDs match if (isTransientEqual(pset, *it->second.pset())) { // Register processes with an exact match it->second.subProcessIndexes().push_back(subProcessIndex); // Return the DataProxyProvider return it->second.provider(); } } // Could not find it return boost::shared_ptr<DataProxyProvider>(); }
ParameterSet const * edm::eventsetup::EventSetupsController::getESProducerPSet | ( | ParameterSetID const & | psetID, |
unsigned | subProcessIndex | ||
) | const |
Definition at line 289 of file EventSetupsController.cc.
References asciidump::elements, esproducers_, Exception, spr::find(), and edm::errors::LogicError.
Referenced by edm::eventsetup::EventSetupProvider::checkESProducerSharing().
{ auto elements = esproducers_.equal_range(psetID); for (auto it = elements.first; it != elements.second; ++it) { std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes(); auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex); if (iFound == subProcessIndexes.end()) { continue; } return it->second.pset(); } throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::getESProducerPSet\n" << "Subprocess index not found. This should never happen\n" << "Please report this to a Framework Developer\n"; return 0; }
boost::shared_ptr< EventSetupRecordIntervalFinder > edm::eventsetup::EventSetupsController::getESSourceAndRegisterProcess | ( | ParameterSet const & | pset, |
unsigned | subProcessIndex | ||
) |
Definition at line 106 of file EventSetupsController.cc.
References asciidump::elements, essources_, edm::ParameterSet::id(), and edm::isTransientEqual().
Referenced by edm::eventsetup::SourceMakerTraits::getComponentAndRegisterProcess().
{ // Try to find a EventSetupRecordIntervalFinder with a matching ParameterSet auto elements = essources_.equal_range(pset.id()); for (auto it = elements.first; it != elements.second; ++it) { // Untracked parameters must also match, do complete comparison if IDs match if (isTransientEqual(pset, *it->second.pset())) { // Register processes with an exact match it->second.subProcessIndexes().push_back(subProcessIndex); // Return the EventSetupRecordIntervalFinder return it->second.finder(); } } // Could not find it return boost::shared_ptr<EventSetupRecordIntervalFinder>(); }
unsigned edm::eventsetup::EventSetupsController::indexOfNextProcess | ( | ) | const [inline] |
Definition at line 92 of file EventSetupsController.h.
References providers_.
Referenced by edm::eventsetup::SourceMakerTraits::getComponentAndRegisterProcess(), edm::eventsetup::ModuleMakerTraits::getComponentAndRegisterProcess(), edm::eventsetup::SourceMakerTraits::putComponent(), and edm::eventsetup::ModuleMakerTraits::putComponent().
{ return providers_.size(); }
bool edm::eventsetup::EventSetupsController::isFirstMatch | ( | ParameterSetID const & | psetID, |
unsigned | subProcessIndex, | ||
unsigned | precedingProcessIndex | ||
) | const |
Definition at line 175 of file EventSetupsController.cc.
References asciidump::elements, esproducers_, Exception, spr::find(), and edm::errors::LogicError.
Referenced by edm::eventsetup::EventSetupProvider::checkESProducerSharing().
{ auto elements = esproducers_.equal_range(psetID); for (auto it = elements.first; it != elements.second; ++it) { std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes(); auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex); if (iFound == subProcessIndexes.end()) { continue; } auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex); if (iFoundPreceding == iFound) { break; } else { return iFoundPreceding == subProcessIndexes.begin(); } } throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::isFirstMatch\n" << "Subprocess index not found. This should never happen\n" << "Please report this to a Framework Developer\n"; return false; }
bool edm::eventsetup::EventSetupsController::isLastMatch | ( | ParameterSetID const & | psetID, |
unsigned | subProcessIndex, | ||
unsigned | precedingProcessIndex | ||
) | const |
Definition at line 204 of file EventSetupsController.cc.
References asciidump::elements, esproducers_, Exception, spr::find(), and edm::errors::LogicError.
Referenced by edm::eventsetup::EventSetupProvider::checkESProducerSharing().
{ auto elements = esproducers_.equal_range(psetID); for (auto it = elements.first; it != elements.second; ++it) { std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes(); auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex); if (iFound == subProcessIndexes.end()) { continue; } auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex); if (iFoundPreceding == iFound) { break; } else { return (++iFoundPreceding) == iFound; } } throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::isLastMatch\n" << "Subprocess index not found. This should never happen\n" << "Please report this to a Framework Developer\n"; return false; }
bool edm::eventsetup::EventSetupsController::isMatchingESProducer | ( | ParameterSetID const & | psetID, |
unsigned | subProcessIndex, | ||
unsigned | precedingProcessIndex | ||
) | const |
Definition at line 261 of file EventSetupsController.cc.
References asciidump::elements, esproducers_, Exception, spr::find(), and edm::errors::LogicError.
Referenced by edm::eventsetup::EventSetupProvider::doRecordsMatch().
{ auto elements = esproducers_.equal_range(psetID); for (auto it = elements.first; it != elements.second; ++it) { std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes(); auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex); if (iFound == subProcessIndexes.end()) { continue; } auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex); if (iFoundPreceding == iFound) { return false; } else { return true; } } throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::lookForMatchingESSource\n" << "Subprocess index not found. This should never happen\n" << "Please report this to a Framework Developer\n"; return false; }
bool edm::eventsetup::EventSetupsController::isMatchingESSource | ( | ParameterSetID const & | psetID, |
unsigned | subProcessIndex, | ||
unsigned | precedingProcessIndex | ||
) | const |
Definition at line 233 of file EventSetupsController.cc.
References asciidump::elements, essources_, Exception, spr::find(), and edm::errors::LogicError.
Referenced by edm::eventsetup::EventSetupProvider::doRecordsMatch().
{ auto elements = essources_.equal_range(psetID); for (auto it = elements.first; it != elements.second; ++it) { std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes(); auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex); if (iFound == subProcessIndexes.end()) { continue; } auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex); if (iFoundPreceding == iFound) { return false; } else { return true; } } throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::lookForMatchingESSource\n" << "Subprocess index not found. This should never happen\n" << "Please report this to a Framework Developer\n"; return false; }
void edm::eventsetup::EventSetupsController::lookForMatches | ( | ParameterSetID const & | psetID, |
unsigned | subProcessIndex, | ||
unsigned | precedingProcessIndex, | ||
bool & | firstProcessWithThisPSet, | ||
bool & | precedingHasMatchingPSet | ||
) | const |
Definition at line 137 of file EventSetupsController.cc.
References asciidump::elements, esproducers_, Exception, spr::find(), and edm::errors::LogicError.
Referenced by edm::eventsetup::EventSetupProvider::checkESProducerSharing().
{ auto elements = esproducers_.equal_range(psetID); for (auto it = elements.first; it != elements.second; ++it) { std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes(); auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex); if (iFound == subProcessIndexes.end()) { continue; } if (iFound == subProcessIndexes.begin()) { firstProcessWithThisPSet = true; precedingHasMatchingPSet = false; } else { auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex); if (iFoundPreceding == iFound) { firstProcessWithThisPSet = false; precedingHasMatchingPSet = false; } else { firstProcessWithThisPSet = false; precedingHasMatchingPSet = true; } } return; } throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::lookForMatches\n" << "Subprocess index not found. This should never happen\n" << "Please report this to a Framework Developer\n"; }
boost::shared_ptr< EventSetupProvider > edm::eventsetup::EventSetupsController::makeProvider | ( | ParameterSet & | iPSet | ) |
Definition at line 33 of file EventSetupsController.cc.
References edm::eventsetup::fillEventSetupProvider(), edm::eventsetup::makeEventSetupProvider(), and providers_.
Referenced by edm::SubProcess::SubProcess().
{ // Makes an EventSetupProvider // Also parses the prefer information from ParameterSets and puts // it in a map that is stored in the EventSetupProvider boost::shared_ptr<EventSetupProvider> returnValue(makeEventSetupProvider(iPSet, providers_.size()) ); // Construct the ESProducers and ESSources // shared_ptrs to them are temporarily stored in this // EventSetupsController and in the EventSetupProvider fillEventSetupProvider(*this, *returnValue, iPSet); providers_.push_back(returnValue); return returnValue; }
bool edm::eventsetup::EventSetupsController::mustFinishConfiguration | ( | ) | const [inline] |
Definition at line 125 of file EventSetupsController.h.
References mustFinishConfiguration_.
{ return mustFinishConfiguration_; }
EventSetupsController const& edm::eventsetup::EventSetupsController::operator= | ( | EventSetupsController const & | ) | [private] |
std::vector<boost::shared_ptr<EventSetupProvider> > const& edm::eventsetup::EventSetupsController::providers | ( | ) | const [inline] |
Definition at line 119 of file EventSetupsController.h.
References providers_.
{ return providers_; }
void edm::eventsetup::EventSetupsController::putESProducer | ( | ParameterSet const & | pset, |
boost::shared_ptr< DataProxyProvider > const & | component, | ||
unsigned | subProcessIndex | ||
) |
Definition at line 98 of file EventSetupsController.cc.
References esproducers_, and edm::ParameterSet::id().
Referenced by edm::eventsetup::ModuleMakerTraits::putComponent().
{ auto newElement = esproducers_.insert(std::pair<ParameterSetID, ESProducerInfo>(pset.id(), ESProducerInfo(&pset, component))); // Register processes with an exact match newElement->second.subProcessIndexes().push_back(subProcessIndex); }
void edm::eventsetup::EventSetupsController::putESSource | ( | ParameterSet const & | pset, |
boost::shared_ptr< EventSetupRecordIntervalFinder > const & | component, | ||
unsigned | subProcessIndex | ||
) |
Definition at line 123 of file EventSetupsController.cc.
References essources_, and edm::ParameterSet::id().
Referenced by edm::eventsetup::SourceMakerTraits::putComponent().
{ auto newElement = essources_.insert(std::pair<ParameterSetID, ESSourceInfo>(pset.id(), ESSourceInfo(&pset, component))); // Register processes with an exact match newElement->second.subProcessIndexes().push_back(subProcessIndex); }
std::multimap<ParameterSetID, ESProducerInfo> edm::eventsetup::EventSetupsController::esproducers_ [private] |
Definition at line 147 of file EventSetupsController.h.
Referenced by clearComponents(), esproducers(), getESProducerAndRegisterProcess(), getESProducerPSet(), isFirstMatch(), isLastMatch(), isMatchingESProducer(), lookForMatches(), and putESProducer().
std::multimap<ParameterSetID, ESSourceInfo> edm::eventsetup::EventSetupsController::essources_ [private] |
Definition at line 148 of file EventSetupsController.h.
Referenced by clearComponents(), essources(), getESSourceAndRegisterProcess(), isMatchingESSource(), and putESSource().
Definition at line 150 of file EventSetupsController.h.
Referenced by eventSetupForInstance(), and mustFinishConfiguration().
std::vector<boost::shared_ptr<EventSetupProvider> > edm::eventsetup::EventSetupsController::providers_ [private] |
Definition at line 135 of file EventSetupsController.h.
Referenced by checkESProducerSharing(), eventSetupForInstance(), forceCacheClear(), indexOfNextProcess(), makeProvider(), and providers().