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 (ModuleTypeResolverMaker const *resolverMaker)
 
 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_
 
ModuleTypeResolverMaker const * typeResolverMaker_ = 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 ( ModuleTypeResolverMaker const *  resolverMaker)
explicit

Definition at line 42 of file EventSetupsController.cc.

43  : typeResolverMaker_(resolverMaker) {}
ModuleTypeResolverMaker const * typeResolverMaker_

◆ EventSetupsController() [3/3]

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

Member Function Documentation

◆ checkESProducerSharing()

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

Definition at line 411 of file EventSetupsController.cc.

References providers_, and typeResolverMaker_.

Referenced by finishConfiguration().

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

◆ clearComponents()

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

Definition at line 256 of file EventSetupsController.cc.

References esproducers_, and essources_.

Referenced by finishConfiguration().

256  {
257  esproducers_.clear();
258  essources_.clear();
259  }
std::multimap< ParameterSetID, ESProducerInfo > esproducers_
std::multimap< ParameterSetID, ESSourceInfo > essources_

◆ doWeNeedToWaitForIOVsToFinish()

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

Definition at line 187 of file EventSetupsController.cc.

References hasNonconcurrentFinder(), and providers_.

Referenced by runOrQueueEventSetupForInstanceAsync().

187  {
188  if (hasNonconcurrentFinder()) {
189  for (auto& eventSetupProvider : providers_) {
190  if (eventSetupProvider->doWeNeedToWaitForIOVsToFinish(syncValue)) {
191  return true;
192  }
193  }
194  }
195  return false;
196  }
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_

◆ endIOVsAsync()

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

Definition at line 45 of file EventSetupsController.cc.

References eventSetupRecordIOVQueues_.

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

45  {
46  for (auto& eventSetupRecordIOVQueue : eventSetupRecordIOVQueues_) {
47  eventSetupRecordIOVQueue->endIOVAsync(iEndTask);
48  }
49  }
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 148 of file EventSetupsController.cc.

References eventSetupRecordIOVQueues_, finishConfiguration(), and providers_.

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

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

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

Referenced by eventSetupForInstanceAsync().

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

◆ forceCacheClear()

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

Definition at line 198 of file EventSetupsController.cc.

References providers_.

Referenced by runOrQueueEventSetupForInstanceAsync().

198  {
199  for (auto& eventSetupProvider : providers_) {
200  eventSetupProvider->forceCacheClear();
201  }
202  }
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 204 of file EventSetupsController.cc.

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

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

205  {
206  // Try to find a DataProxyProvider with a matching ParameterSet
207  auto elements = esproducers_.equal_range(pset.id());
208  for (auto it = elements.first; it != elements.second; ++it) {
209  // Untracked parameters must also match, do complete comparison if IDs match
210  if (isTransientEqual(pset, *it->second.pset())) {
211  // Register processes with an exact match
212  it->second.subProcessIndexes().push_back(subProcessIndex);
213  // Return the DataProxyProvider
214  return it->second.provider();
215  }
216  }
217  // Could not find it
218  return std::shared_ptr<DataProxyProvider>();
219  }
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 395 of file EventSetupsController.cc.

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

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

395  {
396  auto elements = esproducers_.equal_range(psetID);
397  for (auto it = elements.first; it != elements.second; ++it) {
398  std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes();
399 
400  auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
401  if (iFound == subProcessIndexes.end()) {
402  continue;
403  }
404  return *it->second.pset();
405  }
406  throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::getESProducerPSet\n"
407  << "Subprocess index not found. This should never happen\n"
408  << "Please report this to a Framework Developer\n";
409  }
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 230 of file EventSetupsController.cc.

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

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

231  {
232  // Try to find a EventSetupRecordIntervalFinder with a matching ParameterSet
233  auto elements = essources_.equal_range(pset.id());
234  for (auto it = elements.first; it != elements.second; ++it) {
235  // Untracked parameters must also match, do complete comparison if IDs match
236  if (isTransientEqual(pset, *it->second.pset())) {
237  // Register processes with an exact match
238  it->second.subProcessIndexes().push_back(subProcessIndex);
239  // Return the EventSetupRecordIntervalFinder
240  return it->second.finder();
241  }
242  }
243  // Could not find it
244  return std::shared_ptr<EventSetupRecordIntervalFinder>();
245  }
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 451 of file EventSetupsController.cc.

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

Referenced by finishConfiguration().

451  {
452  std::set<EventSetupRecordKey> keys;
453  for (auto const& provider : providers_) {
454  provider->fillKeys(keys);
455  }
456 
457  for (auto const& key : keys) {
458  eventSetupRecordIOVQueues_.push_back(
459  std::make_unique<EventSetupRecordIOVQueue>(numberOfConcurrentIOVs_.numberOfConcurrentIOVs(key)));
460  EventSetupRecordIOVQueue& iovQueue = *eventSetupRecordIOVQueues_.back();
461  for (auto& provider : providers_) {
462  EventSetupRecordProvider* recProvider = provider->tryToGetRecordProvider(key);
463  if (recProvider) {
464  iovQueue.addRecProvider(recProvider);
465  }
466  }
467  }
468  }
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 295 of file EventSetupsController.cc.

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

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

297  {
298  auto elements = esproducers_.equal_range(psetID);
299  for (auto it = elements.first; it != elements.second; ++it) {
300  std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes();
301 
302  auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
303  if (iFound == subProcessIndexes.end()) {
304  continue;
305  }
306 
307  auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
308  if (iFoundPreceding == iFound) {
309  break;
310  } else {
311  return iFoundPreceding == subProcessIndexes.begin();
312  }
313  }
314  throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::isFirstMatch\n"
315  << "Subprocess index not found. This should never happen\n"
316  << "Please report this to a Framework Developer\n";
317  return false;
318  }
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 320 of file EventSetupsController.cc.

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

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

322  {
323  auto elements = esproducers_.equal_range(psetID);
324  for (auto it = elements.first; it != elements.second; ++it) {
325  std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes();
326 
327  auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
328  if (iFound == subProcessIndexes.end()) {
329  continue;
330  }
331 
332  auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
333  if (iFoundPreceding == iFound) {
334  break;
335  } else {
336  return (++iFoundPreceding) == iFound;
337  }
338  }
339  throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::isLastMatch\n"
340  << "Subprocess index not found. This should never happen\n"
341  << "Please report this to a Framework Developer\n";
342  return false;
343  }
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 370 of file EventSetupsController.cc.

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

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

372  {
373  auto elements = esproducers_.equal_range(psetID);
374  for (auto it = elements.first; it != elements.second; ++it) {
375  std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes();
376 
377  auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
378  if (iFound == subProcessIndexes.end()) {
379  continue;
380  }
381 
382  auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
383  if (iFoundPreceding == iFound) {
384  return false;
385  } else {
386  return true;
387  }
388  }
389  throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::lookForMatchingESSource\n"
390  << "Subprocess index not found. This should never happen\n"
391  << "Please report this to a Framework Developer\n";
392  return false;
393  }
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 345 of file EventSetupsController.cc.

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

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

347  {
348  auto elements = essources_.equal_range(psetID);
349  for (auto it = elements.first; it != elements.second; ++it) {
350  std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes();
351 
352  auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
353  if (iFound == subProcessIndexes.end()) {
354  continue;
355  }
356 
357  auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
358  if (iFoundPreceding == iFound) {
359  return false;
360  } else {
361  return true;
362  }
363  }
364  throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::lookForMatchingESSource\n"
365  << "Subprocess index not found. This should never happen\n"
366  << "Please report this to a Framework Developer\n";
367  return false;
368  }
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 261 of file EventSetupsController.cc.

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

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

265  {
266  auto elements = esproducers_.equal_range(psetID);
267  for (auto it = elements.first; it != elements.second; ++it) {
268  std::vector<unsigned> const& subProcessIndexes = it->second.subProcessIndexes();
269 
270  auto iFound = std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
271  if (iFound == subProcessIndexes.end()) {
272  continue;
273  }
274 
275  if (iFound == subProcessIndexes.begin()) {
276  firstProcessWithThisPSet = true;
277  precedingHasMatchingPSet = false;
278  } else {
279  auto iFoundPreceding = std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
280  if (iFoundPreceding == iFound) {
281  firstProcessWithThisPSet = false;
282  precedingHasMatchingPSet = false;
283  } else {
284  firstProcessWithThisPSet = false;
285  precedingHasMatchingPSet = true;
286  }
287  }
288  return;
289  }
290  throw edm::Exception(edm::errors::LogicError) << "EventSetupsController::lookForMatches\n"
291  << "Subprocess index not found. This should never happen\n"
292  << "Please report this to a Framework Developer\n";
293  }
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 51 of file EventSetupsController.cc.

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

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

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

◆ 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 221 of file EventSetupsController.cc.

References esproducers_, and muonDTDigis_cfi::pset.

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

223  {
224  auto newElement =
225  esproducers_.insert(std::pair<ParameterSetID, ESProducerInfo>(pset.id(), ESProducerInfo(&pset, component)));
226  // Register processes with an exact match
227  newElement->second.subProcessIndexes().push_back(subProcessIndex);
228  }
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 247 of file EventSetupsController.cc.

References essources_, and muonDTDigis_cfi::pset.

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

249  {
250  auto newElement =
251  essources_.insert(std::pair<ParameterSetID, ESSourceInfo>(pset.id(), ESSourceInfo(&pset, component)));
252  // Register processes with an exact match
253  newElement->second.subProcessIndexes().push_back(subProcessIndex);
254  }
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 99 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.

107  {
108  auto asyncEventSetup =
109  [this, &endIOVWaitingTasks, &eventSetupImpls, &queueWhichWaitsForIOVsToFinish, actReg, iForceCacheClear](
110  IOVSyncValue const& iSync, WaitingTaskHolder& task) {
111  queueWhichWaitsForIOVsToFinish.pause();
112  CMS_SA_ALLOW try {
113  if (iForceCacheClear) {
114  forceCacheClear();
115  }
116  SendSourceTerminationSignalIfException sentry(actReg);
117  {
118  //all EventSetupRecordIntervalFinders are sequentially set to the
119  // new SyncValue in the call. The async part is just waiting for
120  // the Records to be available which is done after the SyncValue setup.
121  actReg->preESSyncIOVSignal_.emit(iSync);
122  auto postSignal = [&iSync](ActivityRegistry* actReg) { actReg->postESSyncIOVSignal_.emit(iSync); };
123  std::unique_ptr<ActivityRegistry, decltype(postSignal)> guard(actReg, postSignal);
124  eventSetupForInstanceAsync(iSync, task, endIOVWaitingTasks, eventSetupImpls);
125  }
126  sentry.completedSuccessfully();
127  } catch (...) {
128  task.doneWaiting(std::current_exception());
129  }
130  };
131  if (doWeNeedToWaitForIOVsToFinish(iSync) || iForceCacheClear) {
132  // We get inside this block if there is an EventSetup
133  // module not able to handle concurrent IOVs (usually an ESSource)
134  // and the new sync value is outside the current IOV of that module.
135  // Also at beginRun when forcing caches to clear.
136  auto group = taskToStartAfterIOVInit.group();
137  ServiceWeakToken weakToken = iToken;
138  queueWhichWaitsForIOVsToFinish.push(*group,
139  [iSync, taskToStartAfterIOVInit, asyncEventSetup, weakToken]() mutable {
140  ServiceRegistry::Operate operate(weakToken.lock());
141  asyncEventSetup(iSync, taskToStartAfterIOVInit);
142  });
143  } else {
144  asyncEventSetup(iSync, taskToStartAfterIOVInit);
145  }
146  }
#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

◆ typeResolverMaker_

ModuleTypeResolverMaker const* edm::eventsetup::EventSetupsController::typeResolverMaker_ = nullptr
private

Definition at line 204 of file EventSetupsController.h.

Referenced by checkESProducerSharing(), and makeProvider().