CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::eventsetup::EventSetupsController Class Reference

#include <EventSetupsController.h>

Public Member Functions

void clearComponents ()
 
bool doWeNeedToWaitForIOVsToFinish (IOVSyncValue const &) const
 
void endIOVsAsync (edm::WaitingTaskHolder iEndTask)
 
std::multimap< ParameterSetID, ESProducerInfo > const & esproducers () const
 
std::multimap< ParameterSetID, ESSourceInfo > const & essources () const
 
void eventSetupForInstanceAsync (IOVSyncValue const &, WaitingTaskHolder const &taskToStartAfterIOVInit, WaitingTaskList &endIOVWaitingTasks, std::vector< std::shared_ptr< const EventSetupImpl >> &)
 
 EventSetupsController ()
 
 EventSetupsController (ModuleTypeResolverBase const *resolver)
 
 EventSetupsController (EventSetupsController const &)=delete
 
void finishConfiguration ()
 
void forceCacheClear ()
 
std::shared_ptr< DataProxyProvidergetESProducerAndRegisterProcess (ParameterSet const &pset, unsigned subProcessIndex)
 
ParameterSetgetESProducerPSet (ParameterSetID const &psetID, unsigned subProcessIndex)
 
std::shared_ptr< EventSetupRecordIntervalFindergetESSourceAndRegisterProcess (ParameterSet const &pset, unsigned subProcessIndex)
 
bool hasNonconcurrentFinder () const
 
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
 
std::shared_ptr< EventSetupProvidermakeProvider (ParameterSet &, ActivityRegistry *, ParameterSet const *eventSetupPset=nullptr, unsigned int maxConcurrentIOVs=0, bool dumpOptions=false)
 
bool mustFinishConfiguration () const
 
EventSetupsController const & operator= (EventSetupsController const &)=delete
 
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > const & providers () const
 
void putESProducer (ParameterSet &pset, std::shared_ptr< DataProxyProvider > const &component, unsigned subProcessIndex)
 
void putESSource (ParameterSet const &pset, std::shared_ptr< EventSetupRecordIntervalFinder > const &component, unsigned subProcessIndex)
 
void runOrQueueEventSetupForInstanceAsync (IOVSyncValue const &, WaitingTaskHolder &taskToStartAfterIOVInit, WaitingTaskList &endIOVWaitingTasks, std::vector< std::shared_ptr< const EventSetupImpl >> &, edm::SerialTaskQueue &queueWhichWaitsForIOVsToFinish, ActivityRegistry *, ServiceToken const &, bool iForceCacheClear=false)
 

Private Member Functions

void checkESProducerSharing ()
 
void initializeEventSetupRecordIOVQueues ()
 

Private Attributes

std::multimap< ParameterSetID, ESProducerInfoesproducers_
 
std::multimap< ParameterSetID, ESSourceInfoessources_
 
std::vector< propagate_const< std::unique_ptr< EventSetupRecordIOVQueue > > > eventSetupRecordIOVQueues_
 
bool hasNonconcurrentFinder_ = false
 
bool mustFinishConfiguration_ = true
 
NumberOfConcurrentIOVs numberOfConcurrentIOVs_
 
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_
 
ModuleTypeResolverBase const * typeResolver_ = nullptr
 

Detailed Description

Description: Manages a group of EventSetups which can share components

Usage: <usage>

Definition at line 82 of file EventSetupsController.h.

Constructor & Destructor Documentation

◆ EventSetupsController() [1/3]

edm::eventsetup::EventSetupsController::EventSetupsController ( )

Definition at line 41 of file EventSetupsController.cc.

41 {}

◆ EventSetupsController() [2/3]

edm::eventsetup::EventSetupsController::EventSetupsController ( ModuleTypeResolverBase const *  resolver)
explicit

Definition at line 42 of file EventSetupsController.cc.

42 : typeResolver_(resolver) {}
ModuleTypeResolverBase const * typeResolver_

◆ EventSetupsController() [3/3]

edm::eventsetup::EventSetupsController::EventSetupsController ( EventSetupsController const &  )
delete

Member Function Documentation

◆ checkESProducerSharing()

void edm::eventsetup::EventSetupsController::checkESProducerSharing ( )
private

Definition at line 403 of file EventSetupsController.cc.

References providers_, and typeResolver_.

Referenced by finishConfiguration().

403  {
404  // Loop over SubProcesses, skip the top level process.
405  auto esProvider = providers_.begin();
406  auto const esProviderEnd = providers_.end();
407  if (esProvider != esProviderEnd)
408  ++esProvider;
409  for (; esProvider != esProviderEnd; ++esProvider) {
410  // An element is added to this set for each ESProducer
411  // when we have determined which preceding process
412  // this process can share that ESProducer with or
413  // we have determined that it cannot be shared with
414  // any preceding process.
415  // Note the earliest possible preceding process
416  // will be the one selected if there is more than one.
417  std::set<ParameterSetIDHolder> sharingCheckDone;
418 
419  // This will hold an entry for DataProxy's that are
420  // referenced by an EventSetupRecord in this SubProcess.
421  // But only for DataProxy's that are associated with
422  // an ESProducer (not the ones associated with ESSource's
423  // or EDLooper's)
424  std::map<EventSetupRecordKey, std::vector<ComponentDescription const*>> referencedESProducers;
425 
426  // For each EventSetupProvider from a SubProcess, loop over the
427  // EventSetupProviders from the preceding processes (the first
428  // preceding process will be the top level process and the others
429  // SubProcess's)
430  for (auto precedingESProvider = providers_.begin(); precedingESProvider != esProvider; ++precedingESProvider) {
431  (*esProvider)
432  ->checkESProducerSharing(
433  typeResolver_, **precedingESProvider, sharingCheckDone, referencedESProducers, *this);
434  }
435 
436  (*esProvider)->resetRecordToProxyPointers();
437  }
438  for (auto& eventSetupProvider : providers_) {
439  eventSetupProvider->clearInitializationData();
440  }
441  }
ModuleTypeResolverBase const * typeResolver_
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_

◆ clearComponents()

void edm::eventsetup::EventSetupsController::clearComponents ( )

Definition at line 248 of file EventSetupsController.cc.

References esproducers_, and essources_.

Referenced by finishConfiguration().

248  {
249  esproducers_.clear();
250  essources_.clear();
251  }
std::multimap< ParameterSetID, ESProducerInfo > esproducers_
std::multimap< ParameterSetID, ESSourceInfo > essources_

◆ doWeNeedToWaitForIOVsToFinish()

bool edm::eventsetup::EventSetupsController::doWeNeedToWaitForIOVsToFinish ( IOVSyncValue const &  syncValue) const

Definition at line 179 of file EventSetupsController.cc.

References hasNonconcurrentFinder(), and providers_.

Referenced by runOrQueueEventSetupForInstanceAsync().

179  {
180  if (hasNonconcurrentFinder()) {
181  for (auto& eventSetupProvider : providers_) {
182  if (eventSetupProvider->doWeNeedToWaitForIOVsToFinish(syncValue)) {
183  return true;
184  }
185  }
186  }
187  return false;
188  }
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_

◆ endIOVsAsync()

void edm::eventsetup::EventSetupsController::endIOVsAsync ( edm::WaitingTaskHolder  iEndTask)

Definition at line 44 of file EventSetupsController.cc.

References eventSetupRecordIOVQueues_.

Referenced by edm::eventsetup::SynchronousEventSetupsController::~SynchronousEventSetupsController().

44  {
45  for (auto& eventSetupRecordIOVQueue : eventSetupRecordIOVQueues_) {
46  eventSetupRecordIOVQueue->endIOVAsync(iEndTask);
47  }
48  }
std::vector< propagate_const< std::unique_ptr< EventSetupRecordIOVQueue > > > eventSetupRecordIOVQueues_

◆ esproducers()

std::multimap<ParameterSetID, ESProducerInfo> const& edm::eventsetup::EventSetupsController::esproducers ( ) const
inline

Definition at line 172 of file EventSetupsController.h.

References esproducers_.

172 { return esproducers_; }
std::multimap< ParameterSetID, ESProducerInfo > esproducers_

◆ essources()

std::multimap<ParameterSetID, ESSourceInfo> const& edm::eventsetup::EventSetupsController::essources ( ) const
inline

Definition at line 174 of file EventSetupsController.h.

References essources_.

174 { return essources_; }
std::multimap< ParameterSetID, ESSourceInfo > essources_

◆ eventSetupForInstanceAsync()

void edm::eventsetup::EventSetupsController::eventSetupForInstanceAsync ( IOVSyncValue const &  syncValue,
WaitingTaskHolder const &  taskToStartAfterIOVInit,
WaitingTaskList endIOVWaitingTasks,
std::vector< std::shared_ptr< const EventSetupImpl >> &  eventSetupImpls 
)

Definition at line 140 of file EventSetupsController.cc.

References eventSetupRecordIOVQueues_, finishConfiguration(), and providers_.

Referenced by runOrQueueEventSetupForInstanceAsync(), and edm::eventsetup::synchronousEventSetupForInstance().

144  {
146 
147  bool newEventSetupImpl = false;
148  eventSetupImpls.clear();
149  eventSetupImpls.reserve(providers_.size());
150 
151  // Note that unless there are one or more SubProcesses providers_ will only
152  // contain one element.
153 
154  for (auto& eventSetupProvider : providers_) {
155  eventSetupProvider->setAllValidityIntervals(syncValue);
156  }
157 
158  for (auto& eventSetupRecordIOVQueue : eventSetupRecordIOVQueues_) {
159  // For a particular record, if the top level process or any SubProcess requires
160  // starting a new IOV, then we must start a new IOV for all of them. And we
161  // need to know whether this is needed at this point in time. This is
162  // recorded in the EventSetupRecordProviders.
163  eventSetupRecordIOVQueue->setNewIntervalForAnySubProcess();
164  }
165 
166  for (auto& eventSetupProvider : providers_) {
167  // Decides whether we can reuse the existing EventSetupImpl and if we can
168  // returns it. If a new one is needed it will create it, although the pointers
169  // to the EventSetupRecordImpl's will not be set yet in the returned EventSetupImpl
170  // object.
171  eventSetupImpls.push_back(eventSetupProvider->eventSetupForInstance(syncValue, newEventSetupImpl));
172  }
173 
174  for (auto& eventSetupRecordIOVQueue : eventSetupRecordIOVQueues_) {
175  eventSetupRecordIOVQueue->checkForNewIOVs(taskToStartAfterIOVInit, endIOVWaitingTasks, newEventSetupImpl);
176  }
177  }
std::vector< propagate_const< std::unique_ptr< EventSetupRecordIOVQueue > > > eventSetupRecordIOVQueues_
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_

◆ finishConfiguration()

void edm::eventsetup::EventSetupsController::finishConfiguration ( )

Definition at line 72 of file EventSetupsController.cc.

References checkESProducerSharing(), edm::eventsetup::NumberOfConcurrentIOVs::clear(), clearComponents(), edm::eventsetup::NumberOfConcurrentIOVs::fillRecordsNotAllowingConcurrentIOVs(), hasNonconcurrentFinder_, initializeEventSetupRecordIOVQueues(), mustFinishConfiguration_, numberOfConcurrentIOVs_, and providers_.

Referenced by eventSetupForInstanceAsync().

72  {
74  for (auto& eventSetupProvider : providers_) {
76  }
77 
78  for (auto& eventSetupProvider : providers_) {
79  eventSetupProvider->finishConfiguration(numberOfConcurrentIOVs_, hasNonconcurrentFinder_);
80  }
81 
82  // When the ESSources and ESProducers were constructed a first pass was
83  // done which attempts to get component sharing between SubProcesses
84  // correct, but in this pass only the configuration of the components
85  // being shared are compared. This is not good enough for ESProducers.
86  // In the following function, all the other components that contribute
87  // to the same record and also the records that record depends on are
88  // also checked. The component sharing is appropriately fixed as necessary.
91 
95  }
96  }
void fillRecordsNotAllowingConcurrentIOVs(EventSetupProvider const &)
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_

◆ forceCacheClear()

void edm::eventsetup::EventSetupsController::forceCacheClear ( )

Definition at line 190 of file EventSetupsController.cc.

References providers_.

Referenced by runOrQueueEventSetupForInstanceAsync().

190  {
191  for (auto& eventSetupProvider : providers_) {
192  eventSetupProvider->forceCacheClear();
193  }
194  }
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_

◆ getESProducerAndRegisterProcess()

std::shared_ptr< DataProxyProvider > edm::eventsetup::EventSetupsController::getESProducerAndRegisterProcess ( ParameterSet const &  pset,
unsigned  subProcessIndex 
)

Definition at line 196 of file EventSetupsController.cc.

References bookConverter::elements, esproducers_, edm::isTransientEqual(), and muonDTDigis_cfi::pset.

Referenced by edm::eventsetup::ModuleMakerTraits::getComponentAndRegisterProcess().

197  {
198  // Try to find a DataProxyProvider with a matching ParameterSet
199  auto elements = esproducers_.equal_range(pset.id());
200  for (auto it = elements.first; it != elements.second; ++it) {
201  // Untracked parameters must also match, do complete comparison if IDs match
202  if (isTransientEqual(pset, *it->second.pset())) {
203  // Register processes with an exact match
204  it->second.subProcessIndexes().push_back(subProcessIndex);
205  // Return the DataProxyProvider
206  return it->second.provider();
207  }
208  }
209  // Could not find it
210  return std::shared_ptr<DataProxyProvider>();
211  }
std::multimap< ParameterSetID, ESProducerInfo > esproducers_
bool isTransientEqual(ParameterSet const &a, ParameterSet const &b)

◆ getESProducerPSet()

ParameterSet & edm::eventsetup::EventSetupsController::getESProducerPSet ( ParameterSetID const &  psetID,
unsigned  subProcessIndex 
)

Definition at line 387 of file EventSetupsController.cc.

References bookConverter::elements, esproducers_, Exception, spr::find(), and edm::errors::LogicError.

Referenced by edm::eventsetup::EventSetupProvider::checkESProducerSharing().

387  {
388  auto elements = esproducers_.equal_range(psetID);
389  for (auto it = elements.first; it != elements.second; ++it) {
390  std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes();
391 
392  auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
393  if (iFound == subProcessIndexes.end()) {
394  continue;
395  }
396  return *it->second.pset();
397  }
398  throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::getESProducerPSet\n"
399  << "Subprocess index not found. This should never happen\n"
400  << "Please report this to a Framework Developer\n";
401  }
std::multimap< ParameterSetID, ESProducerInfo > esproducers_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ getESSourceAndRegisterProcess()

std::shared_ptr< EventSetupRecordIntervalFinder > edm::eventsetup::EventSetupsController::getESSourceAndRegisterProcess ( ParameterSet const &  pset,
unsigned  subProcessIndex 
)

Definition at line 222 of file EventSetupsController.cc.

References bookConverter::elements, essources_, edm::isTransientEqual(), and muonDTDigis_cfi::pset.

Referenced by edm::eventsetup::SourceMakerTraits::getComponentAndRegisterProcess().

223  {
224  // Try to find a EventSetupRecordIntervalFinder with a matching ParameterSet
225  auto elements = essources_.equal_range(pset.id());
226  for (auto it = elements.first; it != elements.second; ++it) {
227  // Untracked parameters must also match, do complete comparison if IDs match
228  if (isTransientEqual(pset, *it->second.pset())) {
229  // Register processes with an exact match
230  it->second.subProcessIndexes().push_back(subProcessIndex);
231  // Return the EventSetupRecordIntervalFinder
232  return it->second.finder();
233  }
234  }
235  // Could not find it
236  return std::shared_ptr<EventSetupRecordIntervalFinder>();
237  }
std::multimap< ParameterSetID, ESSourceInfo > essources_
bool isTransientEqual(ParameterSet const &a, ParameterSet const &b)

◆ hasNonconcurrentFinder()

bool edm::eventsetup::EventSetupsController::hasNonconcurrentFinder ( ) const
inline

◆ indexOfNextProcess()

unsigned edm::eventsetup::EventSetupsController::indexOfNextProcess ( ) const
inline

◆ initializeEventSetupRecordIOVQueues()

void edm::eventsetup::EventSetupsController::initializeEventSetupRecordIOVQueues ( )
private

Definition at line 443 of file EventSetupsController.cc.

References edm::eventsetup::EventSetupRecordIOVQueue::addRecProvider(), eventSetupRecordIOVQueues_, crabWrapper::key, relativeConstraints::keys, edm::eventsetup::NumberOfConcurrentIOVs::numberOfConcurrentIOVs(), numberOfConcurrentIOVs_, and providers_.

Referenced by finishConfiguration().

443  {
444  std::set<EventSetupRecordKey> keys;
445  for (auto const& provider : providers_) {
446  provider->fillKeys(keys);
447  }
448 
449  for (auto const& key : keys) {
450  eventSetupRecordIOVQueues_.push_back(
451  std::make_unique<EventSetupRecordIOVQueue>(numberOfConcurrentIOVs_.numberOfConcurrentIOVs(key)));
452  EventSetupRecordIOVQueue& iovQueue = *eventSetupRecordIOVQueues_.back();
453  for (auto& provider : providers_) {
454  EventSetupRecordProvider* recProvider = provider->tryToGetRecordProvider(key);
455  if (recProvider) {
456  iovQueue.addRecProvider(recProvider);
457  }
458  }
459  }
460  }
std::vector< propagate_const< std::unique_ptr< EventSetupRecordIOVQueue > > > eventSetupRecordIOVQueues_
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_
unsigned int numberOfConcurrentIOVs(EventSetupRecordKey const &, bool printInfoMsg=false) const

◆ isFirstMatch()

bool edm::eventsetup::EventSetupsController::isFirstMatch ( ParameterSetID const &  psetID,
unsigned  subProcessIndex,
unsigned  precedingProcessIndex 
) const

Definition at line 287 of file EventSetupsController.cc.

References bookConverter::elements, esproducers_, Exception, spr::find(), and edm::errors::LogicError.

Referenced by edm::eventsetup::EventSetupProvider::checkESProducerSharing().

289  {
290  auto elements = esproducers_.equal_range(psetID);
291  for (auto it = elements.first; it != elements.second; ++it) {
292  std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes();
293 
294  auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
295  if (iFound == subProcessIndexes.end()) {
296  continue;
297  }
298 
299  auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
300  if (iFoundPreceding == iFound) {
301  break;
302  } else {
303  return iFoundPreceding == subProcessIndexes.begin();
304  }
305  }
306  throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::isFirstMatch\n"
307  << "Subprocess index not found. This should never happen\n"
308  << "Please report this to a Framework Developer\n";
309  return false;
310  }
std::multimap< ParameterSetID, ESProducerInfo > esproducers_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ isLastMatch()

bool edm::eventsetup::EventSetupsController::isLastMatch ( ParameterSetID const &  psetID,
unsigned  subProcessIndex,
unsigned  precedingProcessIndex 
) const

Definition at line 312 of file EventSetupsController.cc.

References bookConverter::elements, esproducers_, Exception, spr::find(), and edm::errors::LogicError.

Referenced by edm::eventsetup::EventSetupProvider::checkESProducerSharing().

314  {
315  auto elements = esproducers_.equal_range(psetID);
316  for (auto it = elements.first; it != elements.second; ++it) {
317  std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes();
318 
319  auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
320  if (iFound == subProcessIndexes.end()) {
321  continue;
322  }
323 
324  auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
325  if (iFoundPreceding == iFound) {
326  break;
327  } else {
328  return (++iFoundPreceding) == iFound;
329  }
330  }
331  throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::isLastMatch\n"
332  << "Subprocess index not found. This should never happen\n"
333  << "Please report this to a Framework Developer\n";
334  return false;
335  }
std::multimap< ParameterSetID, ESProducerInfo > esproducers_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ isMatchingESProducer()

bool edm::eventsetup::EventSetupsController::isMatchingESProducer ( ParameterSetID const &  psetID,
unsigned  subProcessIndex,
unsigned  precedingProcessIndex 
) const

Definition at line 362 of file EventSetupsController.cc.

References bookConverter::elements, esproducers_, Exception, spr::find(), and edm::errors::LogicError.

Referenced by edm::eventsetup::EventSetupProvider::doRecordsMatch().

364  {
365  auto elements = esproducers_.equal_range(psetID);
366  for (auto it = elements.first; it != elements.second; ++it) {
367  std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes();
368 
369  auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
370  if (iFound == subProcessIndexes.end()) {
371  continue;
372  }
373 
374  auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
375  if (iFoundPreceding == iFound) {
376  return false;
377  } else {
378  return true;
379  }
380  }
381  throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::lookForMatchingESSource\n"
382  << "Subprocess index not found. This should never happen\n"
383  << "Please report this to a Framework Developer\n";
384  return false;
385  }
std::multimap< ParameterSetID, ESProducerInfo > esproducers_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ isMatchingESSource()

bool edm::eventsetup::EventSetupsController::isMatchingESSource ( ParameterSetID const &  psetID,
unsigned  subProcessIndex,
unsigned  precedingProcessIndex 
) const

Definition at line 337 of file EventSetupsController.cc.

References bookConverter::elements, essources_, Exception, spr::find(), and edm::errors::LogicError.

Referenced by edm::eventsetup::EventSetupProvider::doRecordsMatch().

339  {
340  auto elements = essources_.equal_range(psetID);
341  for (auto it = elements.first; it != elements.second; ++it) {
342  std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes();
343 
344  auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
345  if (iFound == subProcessIndexes.end()) {
346  continue;
347  }
348 
349  auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
350  if (iFoundPreceding == iFound) {
351  return false;
352  } else {
353  return true;
354  }
355  }
356  throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::lookForMatchingESSource\n"
357  << "Subprocess index not found. This should never happen\n"
358  << "Please report this to a Framework Developer\n";
359  return false;
360  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::multimap< ParameterSetID, ESSourceInfo > essources_

◆ lookForMatches()

void edm::eventsetup::EventSetupsController::lookForMatches ( ParameterSetID const &  psetID,
unsigned  subProcessIndex,
unsigned  precedingProcessIndex,
bool &  firstProcessWithThisPSet,
bool &  precedingHasMatchingPSet 
) const

Definition at line 253 of file EventSetupsController.cc.

References bookConverter::elements, esproducers_, Exception, spr::find(), and edm::errors::LogicError.

Referenced by edm::eventsetup::EventSetupProvider::checkESProducerSharing().

257  {
258  auto elements = esproducers_.equal_range(psetID);
259  for (auto it = elements.first; it != elements.second; ++it) {
260  std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes();
261 
262  auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
263  if (iFound == subProcessIndexes.end()) {
264  continue;
265  }
266 
267  if (iFound == subProcessIndexes.begin()) {
268  firstProcessWithThisPSet = true;
269  precedingHasMatchingPSet = false;
270  } else {
271  auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
272  if (iFoundPreceding == iFound) {
273  firstProcessWithThisPSet = false;
274  precedingHasMatchingPSet = false;
275  } else {
276  firstProcessWithThisPSet = false;
277  precedingHasMatchingPSet = true;
278  }
279  }
280  return;
281  }
282  throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::lookForMatches\n"
283  << "Subprocess index not found. This should never happen\n"
284  << "Please report this to a Framework Developer\n";
285  }
std::multimap< ParameterSetID, ESProducerInfo > esproducers_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ makeProvider()

std::shared_ptr< EventSetupProvider > edm::eventsetup::EventSetupsController::makeProvider ( ParameterSet iPSet,
ActivityRegistry activityRegistry,
ParameterSet const *  eventSetupPset = nullptr,
unsigned int  maxConcurrentIOVs = 0,
bool  dumpOptions = false 
)

Definition at line 50 of file EventSetupsController.cc.

References testHGCalDigi_cfg::dumpOptions, edm::eventsetup::fillEventSetupProvider(), edm::eventsetup::makeEventSetupProvider(), numberOfConcurrentIOVs_, providers_, edm::eventsetup::NumberOfConcurrentIOVs::readConfigurationParameters(), and typeResolver_.

Referenced by edm::eventsetup::SynchronousEventSetupsController::makeProvider(), and edm::SubProcess::SubProcess().

54  {
55  // Makes an EventSetupProvider
56  // Also parses the prefer information from ParameterSets and puts
57  // it in a map that is stored in the EventSetupProvider
58  std::shared_ptr<EventSetupProvider> returnValue(
59  makeEventSetupProvider(iPSet, providers_.size(), activityRegistry));
60 
61  // Construct the ESProducers and ESSources
62  // shared_ptrs to them are temporarily stored in this
63  // EventSetupsController and in the EventSetupProvider
64  fillEventSetupProvider(typeResolver_, *this, *returnValue, iPSet);
65 
66  numberOfConcurrentIOVs_.readConfigurationParameters(eventSetupPset, maxConcurrentIOVs, dumpOptions);
67 
68  providers_.push_back(returnValue);
69  return returnValue;
70  }
std::unique_ptr< EventSetupProvider > makeEventSetupProvider(ParameterSet const &params, unsigned subProcessIndex, ActivityRegistry *activityRegistry)
ModuleTypeResolverBase const * typeResolver_
void readConfigurationParameters(ParameterSet const *eventSetupPset, unsigned int maxConcurrentIOVs, bool dumpOptions)
void fillEventSetupProvider(ModuleTypeResolverBase const *resolver, EventSetupsController &esController, EventSetupProvider &cp, ParameterSet &params)
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_

◆ mustFinishConfiguration()

bool edm::eventsetup::EventSetupsController::mustFinishConfiguration ( ) const
inline

◆ operator=()

EventSetupsController const& edm::eventsetup::EventSetupsController::operator= ( EventSetupsController const &  )
delete

◆ providers()

std::vector<propagate_const<std::shared_ptr<EventSetupProvider> > > const& edm::eventsetup::EventSetupsController::providers ( ) const
inline

Definition at line 170 of file EventSetupsController.h.

References providers_.

170 { return providers_; }
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_

◆ putESProducer()

void edm::eventsetup::EventSetupsController::putESProducer ( ParameterSet pset,
std::shared_ptr< DataProxyProvider > const &  component,
unsigned  subProcessIndex 
)

Definition at line 213 of file EventSetupsController.cc.

References esproducers_, and muonDTDigis_cfi::pset.

Referenced by edm::eventsetup::ModuleMakerTraits::putComponent().

215  {
216  auto newElement =
217  esproducers_.insert(std::pair<ParameterSetID, ESProducerInfo>(pset.id(), ESProducerInfo(&pset, component)));
218  // Register processes with an exact match
219  newElement->second.subProcessIndexes().push_back(subProcessIndex);
220  }
std::multimap< ParameterSetID, ESProducerInfo > esproducers_

◆ putESSource()

void edm::eventsetup::EventSetupsController::putESSource ( ParameterSet const &  pset,
std::shared_ptr< EventSetupRecordIntervalFinder > const &  component,
unsigned  subProcessIndex 
)

Definition at line 239 of file EventSetupsController.cc.

References essources_, and muonDTDigis_cfi::pset.

Referenced by edm::eventsetup::SourceMakerTraits::putComponent().

241  {
242  auto newElement =
243  essources_.insert(std::pair<ParameterSetID, ESSourceInfo>(pset.id(), ESSourceInfo(&pset, component)));
244  // Register processes with an exact match
245  newElement->second.subProcessIndexes().push_back(subProcessIndex);
246  }
std::multimap< ParameterSetID, ESSourceInfo > essources_

◆ runOrQueueEventSetupForInstanceAsync()

void edm::eventsetup::EventSetupsController::runOrQueueEventSetupForInstanceAsync ( IOVSyncValue const &  iSync,
WaitingTaskHolder taskToStartAfterIOVInit,
WaitingTaskList endIOVWaitingTasks,
std::vector< std::shared_ptr< const EventSetupImpl >> &  eventSetupImpls,
edm::SerialTaskQueue queueWhichWaitsForIOVsToFinish,
ActivityRegistry actReg,
ServiceToken const &  iToken,
bool  iForceCacheClear = false 
)

Definition at line 98 of file EventSetupsController.cc.

References CMS_SA_ALLOW, edm::SendSourceTerminationSignalIfException::completedSuccessfully(), doWeNeedToWaitForIOVsToFinish(), eventSetupForInstanceAsync(), forceCacheClear(), edm::WaitingTaskHolder::group(), watchdog::group, edm::ServiceWeakToken::lock(), and TrackValidation_cff::task.

106  {
107  auto asyncEventSetup =
108  [this, &endIOVWaitingTasks, &eventSetupImpls, &queueWhichWaitsForIOVsToFinish, actReg, iForceCacheClear](
109  IOVSyncValue const& iSync, WaitingTaskHolder& task) {
110  queueWhichWaitsForIOVsToFinish.pause();
111  CMS_SA_ALLOW try {
112  if (iForceCacheClear) {
113  forceCacheClear();
114  }
115  SendSourceTerminationSignalIfException sentry(actReg);
116  actReg->preESSyncIOVSignal_.emit(iSync);
117  eventSetupForInstanceAsync(iSync, task, endIOVWaitingTasks, eventSetupImpls);
118  sentry.completedSuccessfully();
119  } catch (...) {
120  task.doneWaiting(std::current_exception());
121  }
122  };
123  if (doWeNeedToWaitForIOVsToFinish(iSync) || iForceCacheClear) {
124  // We get inside this block if there is an EventSetup
125  // module not able to handle concurrent IOVs (usually an ESSource)
126  // and the new sync value is outside the current IOV of that module.
127  // Also at beginRun when forcing caches to clear.
128  auto group = taskToStartAfterIOVInit.group();
129  ServiceWeakToken weakToken = iToken;
130  queueWhichWaitsForIOVsToFinish.push(*group,
131  [iSync, taskToStartAfterIOVInit, asyncEventSetup, weakToken]() mutable {
132  ServiceRegistry::Operate operate(weakToken.lock());
133  asyncEventSetup(iSync, taskToStartAfterIOVInit);
134  });
135  } else {
136  asyncEventSetup(iSync, taskToStartAfterIOVInit);
137  }
138  }
#define CMS_SA_ALLOW
void eventSetupForInstanceAsync(IOVSyncValue const &, WaitingTaskHolder const &taskToStartAfterIOVInit, WaitingTaskList &endIOVWaitingTasks, std::vector< std::shared_ptr< const EventSetupImpl >> &)
bool doWeNeedToWaitForIOVsToFinish(IOVSyncValue const &) const

Member Data Documentation

◆ esproducers_

std::multimap<ParameterSetID, ESProducerInfo> edm::eventsetup::EventSetupsController::esproducers_
private

◆ essources_

std::multimap<ParameterSetID, ESSourceInfo> edm::eventsetup::EventSetupsController::essources_
private

◆ eventSetupRecordIOVQueues_

std::vector<propagate_const<std::unique_ptr<EventSetupRecordIOVQueue> > > edm::eventsetup::EventSetupsController::eventSetupRecordIOVQueues_
private

◆ hasNonconcurrentFinder_

bool edm::eventsetup::EventSetupsController::hasNonconcurrentFinder_ = false
private

Definition at line 206 of file EventSetupsController.h.

Referenced by finishConfiguration(), and hasNonconcurrentFinder().

◆ mustFinishConfiguration_

bool edm::eventsetup::EventSetupsController::mustFinishConfiguration_ = true
private

Definition at line 207 of file EventSetupsController.h.

Referenced by finishConfiguration(), and mustFinishConfiguration().

◆ numberOfConcurrentIOVs_

NumberOfConcurrentIOVs edm::eventsetup::EventSetupsController::numberOfConcurrentIOVs_
private

◆ providers_

std::vector<propagate_const<std::shared_ptr<EventSetupProvider> > > edm::eventsetup::EventSetupsController::providers_
private

◆ typeResolver_

ModuleTypeResolverBase const* edm::eventsetup::EventSetupsController::typeResolver_ = nullptr
private

Definition at line 204 of file EventSetupsController.h.

Referenced by checkESProducerSharing(), and makeProvider().