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

References providers_, and typeResolverMaker_.

Referenced by finishConfiguration().

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

◆ clearComponents()

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

Definition at line 249 of file EventSetupsController.cc.

References esproducers_, and essources_.

Referenced by finishConfiguration().

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

◆ doWeNeedToWaitForIOVsToFinish()

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

Definition at line 180 of file EventSetupsController.cc.

References hasNonconcurrentFinder(), and providers_.

Referenced by runOrQueueEventSetupForInstanceAsync().

180  {
181  if (hasNonconcurrentFinder()) {
182  for (auto& eventSetupProvider : providers_) {
183  if (eventSetupProvider->doWeNeedToWaitForIOVsToFinish(syncValue)) {
184  return true;
185  }
186  }
187  }
188  return false;
189  }
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 141 of file EventSetupsController.cc.

References eventSetupRecordIOVQueues_, finishConfiguration(), and providers_.

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

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

References providers_.

Referenced by runOrQueueEventSetupForInstanceAsync().

191  {
192  for (auto& eventSetupProvider : providers_) {
193  eventSetupProvider->forceCacheClear();
194  }
195  }
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 197 of file EventSetupsController.cc.

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

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

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

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

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

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

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

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

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

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

Referenced by finishConfiguration().

444  {
445  std::set<EventSetupRecordKey> keys;
446  for (auto const& provider : providers_) {
447  provider->fillKeys(keys);
448  }
449 
450  for (auto const& key : keys) {
451  eventSetupRecordIOVQueues_.push_back(
452  std::make_unique<EventSetupRecordIOVQueue>(numberOfConcurrentIOVs_.numberOfConcurrentIOVs(key)));
453  EventSetupRecordIOVQueue& iovQueue = *eventSetupRecordIOVQueues_.back();
454  for (auto& provider : providers_) {
455  EventSetupRecordProvider* recProvider = provider->tryToGetRecordProvider(key);
456  if (recProvider) {
457  iovQueue.addRecProvider(recProvider);
458  }
459  }
460  }
461  }
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 288 of file EventSetupsController.cc.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

References esproducers_, and muonDTDigis_cfi::pset.

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

216  {
217  auto newElement =
218  esproducers_.insert(std::pair<ParameterSetID, ESProducerInfo>(pset.id(), ESProducerInfo(&pset, component)));
219  // Register processes with an exact match
220  newElement->second.subProcessIndexes().push_back(subProcessIndex);
221  }
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 240 of file EventSetupsController.cc.

References essources_, and muonDTDigis_cfi::pset.

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

242  {
243  auto newElement =
244  essources_.insert(std::pair<ParameterSetID, ESSourceInfo>(pset.id(), ESSourceInfo(&pset, component)));
245  // Register processes with an exact match
246  newElement->second.subProcessIndexes().push_back(subProcessIndex);
247  }
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  actReg->preESSyncIOVSignal_.emit(iSync);
118  eventSetupForInstanceAsync(iSync, task, endIOVWaitingTasks, eventSetupImpls);
119  sentry.completedSuccessfully();
120  } catch (...) {
121  task.doneWaiting(std::current_exception());
122  }
123  };
124  if (doWeNeedToWaitForIOVsToFinish(iSync) || iForceCacheClear) {
125  // We get inside this block if there is an EventSetup
126  // module not able to handle concurrent IOVs (usually an ESSource)
127  // and the new sync value is outside the current IOV of that module.
128  // Also at beginRun when forcing caches to clear.
129  auto group = taskToStartAfterIOVInit.group();
130  ServiceWeakToken weakToken = iToken;
131  queueWhichWaitsForIOVsToFinish.push(*group,
132  [iSync, taskToStartAfterIOVInit, asyncEventSetup, weakToken]() mutable {
133  ServiceRegistry::Operate operate(weakToken.lock());
134  asyncEventSetup(iSync, taskToStartAfterIOVInit);
135  });
136  } else {
137  asyncEventSetup(iSync, taskToStartAfterIOVInit);
138  }
139  }
#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().