39 namespace eventsetup {
43 : typeResolverMaker_(resolverMaker) {}
47 eventSetupRecordIOVQueue->endIOVAsync(iEndTask);
54 unsigned int maxConcurrentIOVs,
59 std::shared_ptr<EventSetupProvider> returnValue(
103 std::vector<std::shared_ptr<const EventSetupImpl>>& eventSetupImpls,
107 bool iForceCacheClear) {
108 auto asyncEventSetup =
109 [
this, &endIOVWaitingTasks, &eventSetupImpls, &queueWhichWaitsForIOVsToFinish, actReg, iForceCacheClear](
111 queueWhichWaitsForIOVsToFinish.pause();
113 if (iForceCacheClear) {
117 actReg->preESSyncIOVSignal_.emit(iSync);
121 task.doneWaiting(std::current_exception());
131 queueWhichWaitsForIOVsToFinish.push(*
group,
132 [iSync, taskToStartAfterIOVInit, asyncEventSetup, weakToken]()
mutable {
134 asyncEventSetup(iSync, taskToStartAfterIOVInit);
137 asyncEventSetup(iSync, taskToStartAfterIOVInit);
145 std::vector<std::shared_ptr<const EventSetupImpl>>& eventSetupImpls) {
148 bool newEventSetupImpl =
false;
149 eventSetupImpls.clear();
156 eventSetupProvider->setAllValidityIntervals(syncValue);
164 eventSetupRecordIOVQueue->setNewIntervalForAnySubProcess();
172 eventSetupImpls.push_back(eventSetupProvider->eventSetupForInstance(syncValue, newEventSetupImpl));
176 eventSetupRecordIOVQueue->checkForNewIOVs(taskToStartAfterIOVInit, endIOVWaitingTasks, newEventSetupImpl);
183 if (eventSetupProvider->doWeNeedToWaitForIOVsToFinish(syncValue)) {
193 eventSetupProvider->forceCacheClear();
205 it->second.subProcessIndexes().push_back(subProcessIndex);
207 return it->second.provider();
211 return std::shared_ptr<DataProxyProvider>();
215 std::shared_ptr<DataProxyProvider>
const& component,
216 unsigned subProcessIndex) {
220 newElement->second.subProcessIndexes().push_back(subProcessIndex);
231 it->second.subProcessIndexes().push_back(subProcessIndex);
233 return it->second.finder();
237 return std::shared_ptr<EventSetupRecordIntervalFinder>();
241 std::shared_ptr<EventSetupRecordIntervalFinder>
const& component,
242 unsigned subProcessIndex) {
246 newElement->second.subProcessIndexes().push_back(subProcessIndex);
255 unsigned subProcessIndex,
256 unsigned precedingProcessIndex,
257 bool& firstProcessWithThisPSet,
258 bool& precedingHasMatchingPSet)
const {
261 std::vector<unsigned>
const& subProcessIndexes = it->second.subProcessIndexes();
263 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
264 if (iFound == subProcessIndexes.end()) {
268 if (iFound == subProcessIndexes.begin()) {
269 firstProcessWithThisPSet =
true;
270 precedingHasMatchingPSet =
false;
272 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
273 if (iFoundPreceding == iFound) {
274 firstProcessWithThisPSet =
false;
275 precedingHasMatchingPSet =
false;
277 firstProcessWithThisPSet =
false;
278 precedingHasMatchingPSet =
true;
284 <<
"Subprocess index not found. This should never happen\n" 285 <<
"Please report this to a Framework Developer\n";
289 unsigned subProcessIndex,
290 unsigned precedingProcessIndex)
const {
293 std::vector<unsigned>
const& subProcessIndexes = it->second.subProcessIndexes();
295 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
296 if (iFound == subProcessIndexes.end()) {
300 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
301 if (iFoundPreceding == iFound) {
304 return iFoundPreceding == subProcessIndexes.begin();
308 <<
"Subprocess index not found. This should never happen\n" 309 <<
"Please report this to a Framework Developer\n";
314 unsigned subProcessIndex,
315 unsigned precedingProcessIndex)
const {
318 std::vector<unsigned>
const& subProcessIndexes = it->second.subProcessIndexes();
320 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
321 if (iFound == subProcessIndexes.end()) {
325 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
326 if (iFoundPreceding == iFound) {
329 return (++iFoundPreceding) == iFound;
333 <<
"Subprocess index not found. This should never happen\n" 334 <<
"Please report this to a Framework Developer\n";
339 unsigned subProcessIndex,
340 unsigned precedingProcessIndex)
const {
343 std::vector<unsigned>
const& subProcessIndexes = it->second.subProcessIndexes();
345 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
346 if (iFound == subProcessIndexes.end()) {
350 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
351 if (iFoundPreceding == iFound) {
358 <<
"Subprocess index not found. This should never happen\n" 359 <<
"Please report this to a Framework Developer\n";
364 unsigned subProcessIndex,
365 unsigned precedingProcessIndex)
const {
368 std::vector<unsigned>
const& subProcessIndexes = it->second.subProcessIndexes();
370 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
371 if (iFound == subProcessIndexes.end()) {
375 auto iFoundPreceding =
std::find(subProcessIndexes.begin(), iFound, precedingProcessIndex);
376 if (iFoundPreceding == iFound) {
383 <<
"Subprocess index not found. This should never happen\n" 384 <<
"Please report this to a Framework Developer\n";
391 std::vector<unsigned>
const& subProcessIndexes = it->second.subProcessIndexes();
393 auto iFound =
std::find(subProcessIndexes.begin(), subProcessIndexes.end(), subProcessIndex);
394 if (iFound == subProcessIndexes.end()) {
397 return *it->second.pset();
400 <<
"Subprocess index not found. This should never happen\n" 401 <<
"Please report this to a Framework Developer\n";
408 if (esProvider != esProviderEnd)
410 for (; esProvider != esProviderEnd; ++esProvider) {
418 std::set<ParameterSetIDHolder> sharingCheckDone;
425 std::map<EventSetupRecordKey, std::vector<ComponentDescription const*>> referencedESProducers;
431 for (
auto precedingESProvider =
providers_.begin(); precedingESProvider != esProvider; ++precedingESProvider) {
433 ->checkESProducerSharing(
434 typeResolverMaker_, **precedingESProvider, sharingCheckDone, referencedESProducers, *
this);
437 (*esProvider)->resetRecordToProxyPointers();
440 eventSetupProvider->clearInitializationData();
445 std::set<EventSetupRecordKey>
keys;
447 provider->fillKeys(
keys);
464 oneapi::tbb::task_group& iGroup,
470 std::vector<std::shared_ptr<const EventSetupImpl>> dummyEventSetupImpls;
473 WaitingTaskHolder waitingTaskHolder(iGroup, &waitUntilIOVInitializationCompletes);
478 syncValue, waitingTaskHolder, dummyWaitingTaskList, dummyEventSetupImpls);
479 dummyWaitingTaskList.
doneWaiting(std::exception_ptr{});
481 dummyWaitingTaskList.
doneWaiting(std::exception_ptr{});
482 waitingTaskHolder.
doneWaiting(std::current_exception());
485 waitUntilIOVInitializationCompletes.wait();
std::shared_ptr< EventSetupRecordIntervalFinder > getESSourceAndRegisterProcess(ParameterSet const &pset, unsigned subProcessIndex)
void addRecProvider(EventSetupRecordProvider *recProvider)
void checkESProducerSharing()
std::vector< propagate_const< std::unique_ptr< EventSetupRecordIOVQueue > > > eventSetupRecordIOVQueues_
void putESSource(ParameterSet const &pset, std::shared_ptr< EventSetupRecordIntervalFinder > const &component, unsigned subProcessIndex)
bool isMatchingESSource(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
std::multimap< ParameterSetID, ESProducerInfo > esproducers_
std::unique_ptr< EventSetupProvider > makeEventSetupProvider(ParameterSet const ¶ms, unsigned subProcessIndex, ActivityRegistry *activityRegistry)
bool mustFinishConfiguration_
void lookForMatches(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex, bool &firstProcessWithThisPSet, bool &precedingHasMatchingPSet) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool hasNonconcurrentFinder() const
void fillEventSetupProvider(ModuleTypeResolverMaker const *resolverMaker, EventSetupsController &esController, EventSetupProvider &cp, ParameterSet ¶ms)
void synchronousEventSetupForInstance(IOVSyncValue const &syncValue, oneapi::tbb::task_group &iGroup, eventsetup::EventSetupsController &espController)
oneapi::tbb::task_group * group() const noexcept
ParameterSet & getESProducerPSet(ParameterSetID const &psetID, unsigned subProcessIndex)
bool isLastMatch(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
void putESProducer(ParameterSet &pset, std::shared_ptr< DataProxyProvider > const &component, unsigned subProcessIndex)
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
std::shared_ptr< DataProxyProvider > getESProducerAndRegisterProcess(ParameterSet const &pset, unsigned subProcessIndex)
void doneWaiting(std::exception_ptr iExcept)
void fillRecordsNotAllowingConcurrentIOVs(EventSetupProvider const &)
std::multimap< ParameterSetID, ESSourceInfo > essources_
bool isMatchingESProducer(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
std::shared_ptr< EventSetupProvider > makeProvider(ParameterSet &, ActivityRegistry *, ParameterSet const *eventSetupPset=nullptr, unsigned int maxConcurrentIOVs=0, bool dumpOptions=false)
void initializeEventSetupRecordIOVQueues()
void eventSetupForInstanceAsync(IOVSyncValue const &, WaitingTaskHolder const &taskToStartAfterIOVInit, WaitingTaskList &endIOVWaitingTasks, std::vector< std::shared_ptr< const EventSetupImpl >> &)
ServiceToken lock() const
void readConfigurationParameters(ParameterSet const *eventSetupPset, unsigned int maxConcurrentIOVs, bool dumpOptions)
void finishConfiguration()
bool hasNonconcurrentFinder_
bool isFirstMatch(ParameterSetID const &psetID, unsigned subProcessIndex, unsigned precedingProcessIndex) const
void completedSuccessfully()
void endIOVsAsync(edm::WaitingTaskHolder iEndTask)
void runOrQueueEventSetupForInstanceAsync(IOVSyncValue const &, WaitingTaskHolder &taskToStartAfterIOVInit, WaitingTaskList &endIOVWaitingTasks, std::vector< std::shared_ptr< const EventSetupImpl >> &, edm::SerialTaskQueue &queueWhichWaitsForIOVsToFinish, ActivityRegistry *, ServiceToken const &, bool iForceCacheClear=false)
bool doWeNeedToWaitForIOVsToFinish(IOVSyncValue const &) const
std::vector< propagate_const< std::shared_ptr< EventSetupProvider > > > providers_
bool isTransientEqual(ParameterSet const &a, ParameterSet const &b)
unsigned int numberOfConcurrentIOVs(EventSetupRecordKey const &, bool printInfoMsg=false) const
NumberOfConcurrentIOVs numberOfConcurrentIOVs_
ModuleTypeResolverMaker const * typeResolverMaker_