CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
edm::eventsetup::EventSetupProvider Class Reference

#include <EventSetupProvider.h>

Public Types

typedef std::pair< DataType, DataLabelDataKeyInfo
 
typedef std::string DataLabel
 
typedef std::string DataType
 
typedef std::map< ComponentDescription, RecordToDataMapPreferredProviderInfo
 
typedef std::string RecordName
 
typedef std::multimap< RecordName, DataKeyInfoRecordToDataMap
 

Public Member Functions

void add (std::shared_ptr< DataProxyProvider >)
 
void add (std::shared_ptr< EventSetupRecordIntervalFinder >)
 
void addRecordToEventSetup (EventSetupRecord &iRecord)
 
void checkESProducerSharing (EventSetupProvider &precedingESProvider, std::set< ParameterSetIDHolder > &sharingCheckDone, std::map< EventSetupRecordKey, std::vector< ComponentDescription const * > > &referencedESProducers, EventSetupsController &esController)
 
void clearInitializationData ()
 
bool doRecordsMatch (EventSetupProvider &precedingESProvider, EventSetupRecordKey const &eventSetupRecordKey, std::map< EventSetupRecordKey, bool > &allComponentsMatch, EventSetupsController const &esController)
 
EventSetup const & eventSetup () const
 
EventSetup const & eventSetupForInstance (IOVSyncValue const &)
 
 EventSetupProvider (unsigned subProcessIndex=0U, PreferredProviderInfo const *iInfo=0)
 
void fillReferencedDataKeys (EventSetupRecordKey const &eventSetupRecordKey)
 
void finishConfiguration ()
 
void forceCacheClear ()
 Used when testing that all code properly updates on IOV changes of all Records. More...
 
std::set< ComponentDescriptionproxyProviderDescriptions () const
 
void replaceExisting (std::shared_ptr< DataProxyProvider >)
 
void resetRecordPlusDependentRecords (EventSetupRecordKey const &)
 Used when we need to force a Record to reset all its proxies. More...
 
void resetRecordToProxyPointers ()
 
unsigned subProcessIndex () const
 
virtual ~EventSetupProvider ()
 

Static Public Member Functions

static void logInfoWhenSharing (ParameterSet const &iConfiguration)
 

Protected Member Functions

template<typename T >
void insert (std::unique_ptr< T > iRecordProvider)
 

Private Types

typedef std::map< EventSetupRecordKey, std::shared_ptr< EventSetupRecordProvider > > Providers
 

Private Member Functions

 EventSetupProvider (EventSetupProvider const &)=delete
 
void insert (EventSetupRecordKey const &, std::unique_ptr< EventSetupRecordProvider >)
 
EventSetupProvider const & operator= (EventSetupProvider const &)=delete
 

Private Attributes

std::unique_ptr< std::vector< std::shared_ptr< DataProxyProvider > > > dataProviders_
 
EventSetup eventSetup_
 
std::unique_ptr< std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > finders_
 
std::unique_ptr< EventSetupKnownRecordsSupplierknownRecordsSupplier_
 
bool mustFinishConfiguration_
 
std::unique_ptr< PreferredProviderInfopreferredProviderInfo_
 
Providers providers_
 
std::unique_ptr< std::map< ParameterSetIDHolder, std::set< EventSetupRecordKey > > > psetIDToRecordKey_
 
std::unique_ptr< std::set< EventSetupRecordKey > > recordsWithALooperProxy_
 
std::unique_ptr< std::map< EventSetupRecordKey, std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > > recordToFinders_
 
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription > > > recordToPreferred_
 
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription const * > > > referencedDataKeys_
 
unsigned subProcessIndex_
 

Detailed Description

Definition at line 50 of file EventSetupProvider.h.

Member Typedef Documentation

Definition at line 56 of file EventSetupProvider.h.

Definition at line 55 of file EventSetupProvider.h.

Definition at line 54 of file EventSetupProvider.h.

Definition at line 58 of file EventSetupProvider.h.

Definition at line 128 of file EventSetupProvider.h.

Definition at line 53 of file EventSetupProvider.h.

Definition at line 57 of file EventSetupProvider.h.

Constructor & Destructor Documentation

edm::eventsetup::EventSetupProvider::EventSetupProvider ( unsigned  subProcessIndex = 0U,
PreferredProviderInfo const *  iInfo = 0 
)

Referenced by insert().

EventSetupProvider::~EventSetupProvider ( )
virtual

Definition at line 87 of file EventSetupProvider.cc.

References edm::eventsetup::heterocontainer::insert(), and groupFilesInBlocks::temp.

88 {
89 }
edm::eventsetup::EventSetupProvider::EventSetupProvider ( EventSetupProvider const &  )
privatedelete

Member Function Documentation

void EventSetupProvider::add ( std::shared_ptr< DataProxyProvider iProvider)
void EventSetupProvider::add ( std::shared_ptr< EventSetupRecordIntervalFinder iFinder)

Definition at line 133 of file EventSetupProvider.cc.

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

134 {
135  assert(iFinder.get() != nullptr);
136  finders_->push_back(iFinder);
137 }
std::unique_ptr< std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > finders_
void EventSetupProvider::addRecordToEventSetup ( EventSetupRecord iRecord)

Definition at line 735 of file EventSetupProvider.cc.

References edm::eventsetup::EventSetupRecord::setEventSetup().

Referenced by edm::eventsetup::EventSetupRecordProvider::addRecordTo(), and eventSetup().

735  {
736  iRecord.setEventSetup(&eventSetup_);
737  eventSetup_.add(iRecord);
738 }
void add(const eventsetup::EventSetupRecord &iRecord)
Definition: EventSetup.cc:82
void setEventSetup(EventSetup const *iEventSetup)
void EventSetupProvider::checkESProducerSharing ( EventSetupProvider precedingESProvider,
std::set< ParameterSetIDHolder > &  sharingCheckDone,
std::map< EventSetupRecordKey, std::vector< ComponentDescription const * > > &  referencedESProducers,
EventSetupsController esController 
)

Definition at line 452 of file EventSetupProvider.cc.

References reco::get(), edm::eventsetup::EventSetupsController::getESProducerPSet(), edm::eventsetup::EventSetupsController::isFirstMatch(), edm::eventsetup::EventSetupsController::isLastMatch(), crabWrapper::key, edm::eventsetup::EventSetupsController::lookForMatches(), match(), providers_, muonDTDigis_cfi::pset, psetIDToRecordKey_, subProcessIndex(), and subProcessIndex_.

Referenced by eventSetup().

455  {
456 
457  edm::LogVerbatim("EventSetupSharing") << "EventSetupProvider::checkESProducerSharing: Checking processes with SubProcess Indexes "
458  << subProcessIndex() << " and " << precedingESProvider.subProcessIndex();
459 
460  if (referencedESProducers.empty()) {
461  for (auto const& recordProvider : providers_) {
462  recordProvider.second->getReferencedESProducers(referencedESProducers);
463  }
464  }
465 
466  // This records whether the configurations of all the DataProxyProviders
467  // and finders matches for a particular pair of processes and
468  // a particular record and also the records it depends on.
469  std::map<EventSetupRecordKey, bool> allComponentsMatch;
470 
471  std::map<ParameterSetID, bool> candidateNotRejectedYet;
472 
473  // Loop over all the ESProducers which have a DataProxy
474  // referenced by any EventSetupRecord in this EventSetupProvider
475  for (auto const& iRecord : referencedESProducers) {
476  for (auto const& iComponent : iRecord.second) {
477 
478  ParameterSetID const& psetID = iComponent->pid_;
479  ParameterSetIDHolder psetIDHolder(psetID);
480  if (sharingCheckDone.find(psetIDHolder) != sharingCheckDone.end()) continue;
481 
482  bool firstProcessWithThisPSet = false;
483  bool precedingHasMatchingPSet = false;
484 
485  esController.lookForMatches(psetID,
487  precedingESProvider.subProcessIndex_,
488  firstProcessWithThisPSet,
489  precedingHasMatchingPSet);
490 
491  if (firstProcessWithThisPSet) {
492  sharingCheckDone.insert(psetIDHolder);
493  allComponentsMatch[iRecord.first] = false;
494  continue;
495  }
496 
497  if (!precedingHasMatchingPSet) {
498  allComponentsMatch[iRecord.first] = false;
499  continue;
500  }
501 
502  // An ESProducer that survives to this point is a candidate.
503  // It was shared with some other process in the first pass where
504  // ESProducers were constructed and one of three possibilities exists:
505  // 1) It should not have been shared and a new ESProducer needs
506  // to be created and the proper pointers set.
507  // 2) It should have been shared with a different preceding process
508  // in which case some pointers need to be modified.
509  // 3) It was originally shared which the correct prior process
510  // in which case nothing needs to be done, but we do need to
511  // do some work to verify that.
512  // Make an entry in a map for each of these ESProducers. We
513  // will set the value to false if and when we determine
514  // the ESProducer cannot be shared between this pair of processes.
515  auto iCandidateNotRejectedYet = candidateNotRejectedYet.find(psetID);
516  if (iCandidateNotRejectedYet == candidateNotRejectedYet.end()) {
517  candidateNotRejectedYet[psetID] = true;
518  iCandidateNotRejectedYet = candidateNotRejectedYet.find(psetID);
519  }
520 
521  // At this point we know that the two processes both
522  // have an ESProducer matching the type and label in
523  // iComponent and also with exactly the same configuration.
524  // And there was not an earlier preceding process
525  // where the same instance of the ESProducer could
526  // have been shared. And this ESProducer was referenced
527  // by the later process's EventSetupRecord (prefered or
528  // or just the only thing that could have made the data).
529  // To determine if sharing is allowed, now we need to
530  // check if all the DataProxyProviders and all the
531  // finders are the same for this record and also for
532  // all records this record depends on. And even
533  // if this is true, we have to wait until the loop
534  // ends because some other DataProxy associated with
535  // the ESProducer could write to a different record where
536  // the same determination will need to be repeated. Only if
537  // all of the the DataProxy's can be shared, can the ESProducer
538  // instance be shared across processes.
539 
540  if (iCandidateNotRejectedYet->second == true) {
541 
542  auto iAllComponentsMatch = allComponentsMatch.find(iRecord.first);
543  if (iAllComponentsMatch == allComponentsMatch.end()) {
544 
545  // We do not know the value in AllComponents yet and
546  // we need it now so we have to do the difficult calculation
547  // now.
548  bool match = doRecordsMatch(precedingESProvider,
549  iRecord.first,
550  allComponentsMatch,
551  esController);
552  allComponentsMatch[iRecord.first] = match;
553  iAllComponentsMatch = allComponentsMatch.find(iRecord.first);
554  }
555  if (!iAllComponentsMatch->second) {
556  iCandidateNotRejectedYet->second = false;
557  }
558  }
559  } // end loop over components used by record
560  } // end loop over records
561 
562  // Loop over candidates
563  for (auto const& candidate : candidateNotRejectedYet) {
564  ParameterSetID const& psetID = candidate.first;
565  bool canBeShared = candidate.second;
566  if (canBeShared) {
567  ParameterSet const& pset = *esController.getESProducerPSet(psetID, subProcessIndex_);
568  logInfoWhenSharing(pset);
569  ParameterSetIDHolder psetIDHolder(psetID);
570  sharingCheckDone.insert(psetIDHolder);
571  if (esController.isFirstMatch(psetID,
573  precedingESProvider.subProcessIndex_)) {
574  continue; // Proper sharing was already done. Nothing more to do.
575  }
576 
577  // Need to reset the pointer from the EventSetupRecordProvider to the
578  // the DataProxyProvider so these two processes share an ESProducer.
579 
580  std::shared_ptr<DataProxyProvider> dataProxyProvider;
581  std::set<EventSetupRecordKey> const& keysForPSetID1 = (*precedingESProvider.psetIDToRecordKey_)[psetIDHolder];
582  for (auto const& key : keysForPSetID1) {
583  std::shared_ptr<EventSetupRecordProvider> const& recordProvider = precedingESProvider.providers_[key];
584  dataProxyProvider = recordProvider->proxyProvider(psetIDHolder);
585  assert(dataProxyProvider);
586  break;
587  }
588 
589  std::set<EventSetupRecordKey> const& keysForPSetID2 = (*psetIDToRecordKey_)[psetIDHolder];
590  for (auto const& key : keysForPSetID2) {
591  std::shared_ptr<EventSetupRecordProvider> const& recordProvider = providers_[key];
592  recordProvider->resetProxyProvider(psetIDHolder, dataProxyProvider);
593  }
594  } else {
595  if (esController.isLastMatch(psetID,
597  precedingESProvider.subProcessIndex_)) {
598 
599 
600  ParameterSet const& pset = *esController.getESProducerPSet(psetID, subProcessIndex_);
601  ModuleFactory::get()->addTo(esController,
602  *this,
603  pset,
604  true);
605 
606  }
607  }
608  }
609 }
void lookForMatches(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex, bool &firstProcessWithThisPSet, bool &precedingHasMatchingPSet) const
bool isFirstMatch(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
static void logInfoWhenSharing(ParameterSet const &iConfiguration)
std::unique_ptr< std::map< ParameterSetIDHolder, std::set< EventSetupRecordKey > > > psetIDToRecordKey_
bool isLastMatch(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
ParameterSet const * getESProducerPSet(ParameterSetID const &psetID, unsigned subProcessIndex) const
Hash< ParameterSetType > ParameterSetID
static ComponentFactory< T > const * get()
bool doRecordsMatch(EventSetupProvider &precedingESProvider, EventSetupRecordKey const &eventSetupRecordKey, std::map< EventSetupRecordKey, bool > &allComponentsMatch, EventSetupsController const &esController)
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)
void EventSetupProvider::clearInitializationData ( )

Definition at line 725 of file EventSetupProvider.cc.

Referenced by eventSetup().

725  {
726  preferredProviderInfo_.reset();
727  referencedDataKeys_.reset();
728  recordToFinders_.reset();
729  psetIDToRecordKey_.reset();
730  recordToPreferred_.reset();
731  recordsWithALooperProxy_.reset();
732 }
std::unique_ptr< std::map< ParameterSetIDHolder, std::set< EventSetupRecordKey > > > psetIDToRecordKey_
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription const * > > > referencedDataKeys_
std::unique_ptr< std::set< EventSetupRecordKey > > recordsWithALooperProxy_
std::unique_ptr< PreferredProviderInfo > preferredProviderInfo_
std::unique_ptr< std::map< EventSetupRecordKey, std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > > recordToFinders_
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription > > > recordToPreferred_
bool EventSetupProvider::doRecordsMatch ( EventSetupProvider precedingESProvider,
EventSetupRecordKey const &  eventSetupRecordKey,
std::map< EventSetupRecordKey, bool > &  allComponentsMatch,
EventSetupsController const &  esController 
)

Definition at line 612 of file EventSetupProvider.cc.

References fillReferencedDataKeys(), ghostTrackVertexReco_cff::finder, edm::eventsetup::EventSetupsController::isMatchingESProducer(), edm::eventsetup::EventSetupsController::isMatchingESSource(), match(), recordsWithALooperProxy_, recordToFinders_, referencedDataKeys_, findQualityFiles::size, and subProcessIndex_.

Referenced by eventSetup().

615  {
616  // first check if this record matches. If not just return false
617 
618  // then find the directly dependent records and iterate over them
619  // recursively call this function on them. If they return false
620  // set allComponentsMatch to false for them and return false.
621  // if they all return true then set allComponents to true
622  // and return true.
623 
624  if (precedingESProvider.recordsWithALooperProxy_->find(eventSetupRecordKey) != precedingESProvider.recordsWithALooperProxy_->end()) {
625  return false;
626  }
627 
628  if ((*recordToFinders_)[eventSetupRecordKey].size() != (*precedingESProvider.recordToFinders_)[eventSetupRecordKey].size()) {
629  return false;
630  }
631 
632  for (auto const& finder : (*recordToFinders_)[eventSetupRecordKey]) {
633  ParameterSetID const& psetID = finder->descriptionForFinder().pid_;
634  bool itMatches = esController.isMatchingESSource(psetID,
636  precedingESProvider.subProcessIndex_);
637  if (!itMatches) {
638  return false;
639  }
640  }
641 
642  fillReferencedDataKeys(eventSetupRecordKey);
643  precedingESProvider.fillReferencedDataKeys(eventSetupRecordKey);
644 
645  std::map<DataKey, ComponentDescription const*> const& dataItems = (*referencedDataKeys_)[eventSetupRecordKey];
646 
647  std::map<DataKey, ComponentDescription const*> const& precedingDataItems = (*precedingESProvider.referencedDataKeys_)[eventSetupRecordKey];
648 
649  if (dataItems.size() != precedingDataItems.size()) {
650  return false;
651  }
652 
653  for (auto const& dataItem : dataItems) {
654  auto precedingDataItem = precedingDataItems.find(dataItem.first);
655  if (precedingDataItem == precedingDataItems.end()) {
656  return false;
657  }
658  if (dataItem.second->pid_ != precedingDataItem->second->pid_) {
659  return false;
660  }
661  // Check that the configurations match exactly for the ESProducers
662  // (We already checked the ESSources above and there should not be
663  // any loopers)
664  if (!dataItem.second->isSource_ && !dataItem.second->isLooper_) {
665  bool itMatches = esController.isMatchingESProducer(dataItem.second->pid_,
667  precedingESProvider.subProcessIndex_);
668  if (!itMatches) {
669  return false;
670  }
671  }
672  }
673  Providers::iterator itFound = providers_.find(eventSetupRecordKey);
674  if (itFound != providers_.end()) {
675  std::set<EventSetupRecordKey> dependentRecords = itFound->second->dependentRecords();
676  for (auto const& dependentRecord : dependentRecords) {
677  auto iter = allComponentsMatch.find(dependentRecord);
678  if (iter != allComponentsMatch.end()) {
679  if (iter->second) {
680  continue;
681  } else {
682  return false;
683  }
684  }
685  bool match = doRecordsMatch(precedingESProvider,
686  dependentRecord,
687  allComponentsMatch,
688  esController);
689  allComponentsMatch[dependentRecord] = match;
690  if (!match) return false;
691  }
692  }
693  return true;
694 }
size
Write out results.
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription const * > > > referencedDataKeys_
void fillReferencedDataKeys(EventSetupRecordKey const &eventSetupRecordKey)
std::unique_ptr< std::set< EventSetupRecordKey > > recordsWithALooperProxy_
Hash< ParameterSetType > ParameterSetID
std::unique_ptr< std::map< EventSetupRecordKey, std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > > recordToFinders_
bool doRecordsMatch(EventSetupProvider &precedingESProvider, EventSetupRecordKey const &eventSetupRecordKey, std::map< EventSetupRecordKey, bool > &allComponentsMatch, EventSetupsController const &esController)
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)
EventSetup const& edm::eventsetup::EventSetupProvider::eventSetup ( ) const
inline
EventSetup const & EventSetupProvider::eventSetupForInstance ( IOVSyncValue const &  )

Definition at line 744 of file EventSetupProvider.cc.

References edm::EventSetup::setIOVSyncValue().

745 {
747 
748  eventSetup_.clear();
749 
750  // In a cmsRun job this does nothing because the EventSetupsController
751  // will have already called finishConfiguration, but some tests will
752  // call finishConfiguration here.
755  }
756 
757  for(Providers::iterator itProvider = providers_.begin(), itProviderEnd = providers_.end();
758  itProvider != itProviderEnd;
759  ++itProvider) {
760  itProvider->second->addRecordToIfValid(*this, iValue);
761  }
762  return eventSetup_;
763 }
void setIOVSyncValue(const IOVSyncValue &)
Definition: EventSetup.cc:63
void EventSetupProvider::fillReferencedDataKeys ( EventSetupRecordKey const &  eventSetupRecordKey)

Definition at line 697 of file EventSetupProvider.cc.

Referenced by doRecordsMatch(), and eventSetup().

697  {
698 
699  if (referencedDataKeys_->find(eventSetupRecordKey) != referencedDataKeys_->end()) return;
700 
701  auto recordProvider = providers_.find(eventSetupRecordKey);
702  if (recordProvider == providers_.end()) {
703  (*referencedDataKeys_)[eventSetupRecordKey];
704  return;
705  }
706  if (recordProvider->second) {
707  recordProvider->second->fillReferencedDataKeys((*referencedDataKeys_)[eventSetupRecordKey]);
708  }
709 }
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription const * > > > referencedDataKeys_
void EventSetupProvider::finishConfiguration ( )

Definition at line 281 of file EventSetupProvider.cc.

References edm::eventsetup::determinePreferred(), edm::eventsetup::heterocontainer::insert(), instance, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by eventSetup().

282 {
283  //we delayed adding finders to the system till here so that everything would be loaded first
284  recordToFinders_->clear();
285  for(std::vector<std::shared_ptr<EventSetupRecordIntervalFinder> >::iterator itFinder=finders_->begin(),
286  itEnd = finders_->end();
287  itFinder != itEnd;
288  ++itFinder) {
289  typedef std::set<EventSetupRecordKey> Keys;
290  const Keys recordsUsing = (*itFinder)->findingForRecords();
291 
292  for(Keys::const_iterator itKey = recordsUsing.begin(), itKeyEnd = recordsUsing.end();
293  itKey != itKeyEnd;
294  ++itKey) {
295  (*recordToFinders_)[*itKey].push_back(*itFinder);
296  Providers::iterator itFound = providers_.find(*itKey);
297  if(providers_.end() == itFound) {
298  //create a provider for this record
299  insert(*itKey, EventSetupRecordProviderFactoryManager::instance().makeRecordProvider(*itKey));
300  itFound = providers_.find(*itKey);
301  }
302  itFound->second->addFinder(*itFinder);
303  }
304  }
305  //we've transfered our ownership so this is no longer needed
306  finders_.reset();
307 
308  //Now handle providers since sources can also be finders and the sources can delay registering
309  // their Records and therefore could delay setting up their Proxies
310  psetIDToRecordKey_->clear();
311  typedef std::set<EventSetupRecordKey> Keys;
312  for(std::vector<std::shared_ptr<DataProxyProvider> >::iterator itProvider=dataProviders_->begin(),
313  itEnd = dataProviders_->end();
314  itProvider != itEnd;
315  ++itProvider) {
316 
317  ParameterSetIDHolder psetID((*itProvider)->description().pid_);
318 
319  const Keys recordsUsing = (*itProvider)->usingRecords();
320 
321  for(Keys::const_iterator itKey = recordsUsing.begin(), itKeyEnd = recordsUsing.end();
322  itKey != itKeyEnd;
323  ++itKey) {
324 
325  if ((*itProvider)->description().isLooper_) {
326  recordsWithALooperProxy_->insert(*itKey);
327  }
328 
329  (*psetIDToRecordKey_)[psetID].insert(*itKey);
330 
331  Providers::iterator itFound = providers_.find(*itKey);
332  if(providers_.end() == itFound) {
333  //create a provider for this record
334  insert(*itKey, EventSetupRecordProviderFactoryManager::instance().makeRecordProvider(*itKey));
335  itFound = providers_.find(*itKey);
336  }
337  itFound->second->add(*itProvider);
338  }
339  }
340  dataProviders_.reset();
341 
342  //used for the case where no preferred Providers have been specified for the Record
344 
346  //For each Provider, find all the Providers it depends on. If a dependent Provider
347  // can not be found pass in an empty list
348  //CHANGE: now allow for missing Providers
349  for(Providers::iterator itProvider = providers_.begin(), itProviderEnd = providers_.end();
350  itProvider != itProviderEnd;
351  ++itProvider) {
352  const EventSetupRecordProvider::DataToPreferredProviderMap* preferredInfo = &kEmptyMap;
353  RecordToPreferred::const_iterator itRecordFound = recordToPreferred_->find(itProvider->first);
354  if(itRecordFound != recordToPreferred_->end()) {
355  preferredInfo = &(itRecordFound->second);
356  }
357  //Give it our list of preferred
358  itProvider->second->usePreferred(*preferredInfo);
359 
360  std::set<EventSetupRecordKey> records = itProvider->second->dependentRecords();
361  if(!records.empty()) {
362  std::string missingRecords;
363  std::vector<std::shared_ptr<EventSetupRecordProvider> > depProviders;
364  depProviders.reserve(records.size());
365  bool foundAllProviders = true;
366  for(std::set<EventSetupRecordKey>::iterator itRecord = records.begin(),
367  itRecordEnd = records.end();
368  itRecord != itRecordEnd;
369  ++itRecord) {
370  Providers::iterator itFound = providers_.find(*itRecord);
371  if(itFound == providers_.end()) {
372  foundAllProviders = false;
373  if(missingRecords.empty()) {
374  missingRecords = itRecord->name();
375  } else {
376  missingRecords += ", ";
377  missingRecords += itRecord->name();
378  }
379  //break;
380  } else {
381  depProviders.push_back(itFound->second);
382  }
383  }
384 
385  if(!foundAllProviders) {
386  edm::LogInfo("EventSetupDependency")<<"The EventSetup record "<<itProvider->second->key().name()
387  <<" depends on at least one Record \n ("<<missingRecords<<") which is not present in the job."
388  "\n This may lead to an exception begin thrown during event processing.\n If no exception occurs during the job than it is usually safe to ignore this message.";
389 
390  //depProviders.clear();
391  //NOTE: should provide a warning
392  }
393 
394  itProvider->second->setDependentProviders(depProviders);
395  }
396  }
397  mustFinishConfiguration_ = false;
398 }
std::map< DataKey, ComponentDescription > DataToPreferredProviderMap
std::unique_ptr< std::map< ParameterSetIDHolder, std::set< EventSetupRecordKey > > > psetIDToRecordKey_
void insert(std::unique_ptr< T > iRecordProvider)
std::unique_ptr< std::set< EventSetupRecordKey > > recordsWithALooperProxy_
std::unique_ptr< std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > finders_
std::unique_ptr< PreferredProviderInfo > preferredProviderInfo_
std::unique_ptr< std::vector< std::shared_ptr< DataProxyProvider > > > dataProviders_
static RecordToPreferred determinePreferred(const EventSetupProvider::PreferredProviderInfo *iInfo, const Providers &iProviders)
std::unique_ptr< std::map< EventSetupRecordKey, std::vector< std::shared_ptr< EventSetupRecordIntervalFinder > > > > recordToFinders_
std::vector< size_type > Keys
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription > > > recordToPreferred_
void EventSetupProvider::forceCacheClear ( )

Used when testing that all code properly updates on IOV changes of all Records.

Definition at line 442 of file EventSetupProvider.cc.

Referenced by eventSetup().

443 {
444  for(Providers::iterator it=providers_.begin(), itEnd = providers_.end();
445  it != itEnd;
446  ++it) {
447  it->second->resetProxies();
448  }
449 }
template<typename T >
void edm::eventsetup::EventSetupProvider::insert ( std::unique_ptr< T iRecordProvider)
inlineprotected

Definition at line 111 of file EventSetupProvider.h.

References EventSetupProvider(), edm::eventsetup::heterocontainer::makeKey(), eostools::move(), operator=(), and groupFilesInBlocks::temp.

111  {
112  std::unique_ptr<EventSetupRecordProvider> temp(iRecordProvider.release());
114  typename T::RecordType,
115  eventsetup::EventSetupRecordKey>(),
116  std::move(temp));
117  }
Key makeKey(const IdTag &iIdTag)
Definition: HCMethods.h:28
void insert(std::unique_ptr< T > iRecordProvider)
def move(src, dest)
Definition: eostools.py:510
void edm::eventsetup::EventSetupProvider::insert ( EventSetupRecordKey const &  ,
std::unique_ptr< EventSetupRecordProvider  
)
private
void EventSetupProvider::logInfoWhenSharing ( ParameterSet const &  iConfiguration)
static

Definition at line 787 of file EventSetupProvider.cc.

References edm::ParameterSet::getParameter(), diffTwoXMLs::label, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by subProcessIndex().

787  {
788 
789  std::string edmtype = iConfiguration.getParameter<std::string>("@module_edm_type");
790  std::string modtype = iConfiguration.getParameter<std::string>("@module_type");
791  std::string label = iConfiguration.getParameter<std::string>("@module_label");
792  edm::LogVerbatim("EventSetupSharing") << "Sharing " << edmtype << ": class=" << modtype << " label='" << label << "'";
793 }
EventSetupProvider const& edm::eventsetup::EventSetupProvider::operator= ( EventSetupProvider const &  )
privatedelete

Referenced by insert().

std::set< ComponentDescription > EventSetupProvider::proxyProviderDescriptions ( ) const

Definition at line 766 of file EventSetupProvider.cc.

References edmIntegrityCheck::d, and AlCaHLTBitMon_ParallelJobs::p.

767 {
768  typedef std::set<ComponentDescription> Set;
769  Set descriptions;
770 
771  for(auto const& p: providers_) {
772  auto const& d = p.second->proxyProviderDescriptions();
773  descriptions.insert(d.begin(),d.end());
774  }
775  if(dataProviders_.get()) {
776  for(auto const& p: *dataProviders_) {
777  descriptions.insert(p->description());
778  }
779  }
780 
781  return descriptions;
782 }
std::unique_ptr< std::vector< std::shared_ptr< DataProxyProvider > > > dataProviders_
void EventSetupProvider::replaceExisting ( std::shared_ptr< DataProxyProvider dataProxyProvider)

Definition at line 122 of file EventSetupProvider.cc.

References crabWrapper::key.

Referenced by eventSetup(), and edm::eventsetup::ModuleMakerTraits::replaceExisting().

123 {
124  ParameterSetIDHolder psetID(dataProxyProvider->description().pid_);
125  std::set<EventSetupRecordKey> const& keysForPSetID = (*psetIDToRecordKey_)[psetID];
126  for (auto const& key : keysForPSetID) {
127  std::shared_ptr<EventSetupRecordProvider> const& recordProvider = providers_[key];
128  recordProvider->resetProxyProvider(psetID, dataProxyProvider);
129  }
130 }
void EventSetupProvider::resetRecordPlusDependentRecords ( EventSetupRecordKey const &  )

Used when we need to force a Record to reset all its proxies.

Definition at line 422 of file EventSetupProvider.cc.

References edmIntegrityCheck::d, edm::eventsetup::findDependents(), and tier0::unique().

Referenced by eventSetup(), and edm::EDLooperBase::prepareForNextLoop().

423 {
424  Providers::iterator itFind = providers_.find(iKey);
425  if(itFind == providers_.end()) {
426  return;
427  }
428 
429 
430  std::vector<std::shared_ptr<EventSetupRecordProvider> > dependents;
431  findDependents(iKey, providers_.begin(), providers_.end(), dependents);
432 
433  dependents.erase(std::unique(dependents.begin(),dependents.end()), dependents.end());
434 
435  itFind->second->resetProxies();
436  for(auto& d: dependents) {
437  d->resetProxies();
438  }
439 }
static void findDependents(const EventSetupRecordKey &iKey, Itr itBegin, Itr itEnd, std::vector< std::shared_ptr< EventSetupRecordProvider > > &oDependents)
def unique(seq, keepstr=True)
Definition: tier0.py:24
void EventSetupProvider::resetRecordToProxyPointers ( )

Definition at line 712 of file EventSetupProvider.cc.

Referenced by eventSetup().

712  {
713  for (auto const& recordProvider : providers_) {
715  const EventSetupRecordProvider::DataToPreferredProviderMap* preferredInfo = &kEmptyMap;
716  RecordToPreferred::const_iterator itRecordFound = recordToPreferred_->find(recordProvider.first);
717  if(itRecordFound != recordToPreferred_->end()) {
718  preferredInfo = &(itRecordFound->second);
719  }
720  recordProvider.second->resetRecordToProxyPointers(*preferredInfo);
721  }
722 }
std::map< DataKey, ComponentDescription > DataToPreferredProviderMap
std::unique_ptr< std::map< EventSetupRecordKey, std::map< DataKey, ComponentDescription > > > recordToPreferred_
unsigned edm::eventsetup::EventSetupProvider::subProcessIndex ( ) const
inline

Definition at line 104 of file EventSetupProvider.h.

References logInfoWhenSharing(), and subProcessIndex_.

Referenced by checkESProducerSharing().

Member Data Documentation

std::unique_ptr<std::vector<std::shared_ptr<DataProxyProvider> > > edm::eventsetup::EventSetupProvider::dataProviders_
private

Definition at line 138 of file EventSetupProvider.h.

EventSetup edm::eventsetup::EventSetupProvider::eventSetup_
private

Definition at line 127 of file EventSetupProvider.h.

Referenced by eventSetup().

std::unique_ptr<std::vector<std::shared_ptr<EventSetupRecordIntervalFinder> > > edm::eventsetup::EventSetupProvider::finders_
private

Definition at line 137 of file EventSetupProvider.h.

std::unique_ptr<EventSetupKnownRecordsSupplier> edm::eventsetup::EventSetupProvider::knownRecordsSupplier_
private

Definition at line 130 of file EventSetupProvider.h.

bool edm::eventsetup::EventSetupProvider::mustFinishConfiguration_
private

Definition at line 131 of file EventSetupProvider.h.

std::unique_ptr<PreferredProviderInfo> edm::eventsetup::EventSetupProvider::preferredProviderInfo_
private

Definition at line 136 of file EventSetupProvider.h.

Providers edm::eventsetup::EventSetupProvider::providers_
private

Definition at line 129 of file EventSetupProvider.h.

Referenced by checkESProducerSharing().

std::unique_ptr<std::map<ParameterSetIDHolder, std::set<EventSetupRecordKey> > > edm::eventsetup::EventSetupProvider::psetIDToRecordKey_
private

Definition at line 141 of file EventSetupProvider.h.

Referenced by checkESProducerSharing().

std::unique_ptr<std::set<EventSetupRecordKey> > edm::eventsetup::EventSetupProvider::recordsWithALooperProxy_
private

Definition at line 143 of file EventSetupProvider.h.

Referenced by doRecordsMatch().

std::unique_ptr<std::map<EventSetupRecordKey, std::vector<std::shared_ptr<EventSetupRecordIntervalFinder> > > > edm::eventsetup::EventSetupProvider::recordToFinders_
private

Definition at line 140 of file EventSetupProvider.h.

Referenced by doRecordsMatch().

std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription> > > edm::eventsetup::EventSetupProvider::recordToPreferred_
private

Definition at line 142 of file EventSetupProvider.h.

std::unique_ptr<std::map<EventSetupRecordKey, std::map<DataKey, ComponentDescription const*> > > edm::eventsetup::EventSetupProvider::referencedDataKeys_
private

Definition at line 139 of file EventSetupProvider.h.

Referenced by doRecordsMatch().

unsigned edm::eventsetup::EventSetupProvider::subProcessIndex_
private

Definition at line 132 of file EventSetupProvider.h.

Referenced by checkESProducerSharing(), doRecordsMatch(), and subProcessIndex().