45 #include "tbb/task_scheduler_init.h"
47 #define xstr(s) str(s)
62 bool oneTimeInitializationImpl() {
65 static std::unique_ptr<tbb::task_scheduler_init> tsiPtr = std::make_unique<tbb::task_scheduler_init>(1);
75 bool oneTimeInitialization() {
76 static const bool s_init{oneTimeInitializationImpl()};
85 : espController_(
std::make_unique<eventsetup::EventSetupsController>()),
89 (
void)oneTimeInitialization();
99 auto procDesc = desc.processDesc();
104 auto& serviceSets = procDesc->getServicesPSets();
112 std::shared_ptr<CommonParams>
common(
items.initMisc(*psetPtr));
119 auto nConcurrentLumis = 1
U;
120 auto nConcurrentRuns = 1
U;
126 esp_->add(std::dynamic_pointer_cast<eventsetup::DataProxyProvider>(
esHelper_));
127 esp_->add(std::dynamic_pointer_cast<EventSetupRecordIntervalFinder>(
esHelper_));
135 auto psetid = emptyPSet.
id();
151 produce.moduleLabel_,
154 twd.friendlyClassName(),
155 produce.instanceLabel_,
162 dataProducts_.emplace_back(product, std::unique_ptr<WrapperBase>());
163 preg_->addProduct(product);
180 auto ep = std::make_shared<EventPrincipal>(
preg_,
203 throw cms::Exception(
"LogicError") <<
"Products must be declared to the TestProcessor::Config object\n"
204 "with a call to the function \'produces\' BEFORE passing the\n"
205 "TestProcessor::Config object to the TestProcessor constructor";
336 actReg_->preallocateSignal_(bounds);
351 actReg_->postBeginJobSignal_();
370 auto const& es =
esp_->eventSetupImpl();
372 std::vector<edm::SubProcess> emptyList;
376 globalWaitTask->increment_ref_count();
385 globalWaitTask->wait_for_all();
386 if (globalWaitTask->exceptionPtr() !=
nullptr) {
387 std::rethrow_exception(*(globalWaitTask->exceptionPtr()));
393 streamLoopWaitTask->increment_ref_count();
397 beginStreamsTransitionAsync<Traits>(streamLoopWaitTask.get(),
407 streamLoopWaitTask->wait_for_all();
408 if (streamLoopWaitTask->exceptionPtr() !=
nullptr) {
409 std::rethrow_exception(*(streamLoopWaitTask->exceptionPtr()));
427 auto const& es =
esp_->eventSetupImpl();
429 std::vector<edm::SubProcess> emptyList;
433 globalWaitTask->increment_ref_count();
442 globalWaitTask->wait_for_all();
443 if (globalWaitTask->exceptionPtr() !=
nullptr) {
444 std::rethrow_exception(*(globalWaitTask->exceptionPtr()));
450 streamLoopWaitTask->increment_ref_count();
454 beginStreamsTransitionAsync<Traits>(streamLoopWaitTask.get(),
464 streamLoopWaitTask->wait_for_all();
465 if (streamLoopWaitTask->exceptionPtr() !=
nullptr) {
466 std::rethrow_exception(*(streamLoopWaitTask->exceptionPtr()));
476 pep->clearEventPrincipal();
477 pep->fillEventPrincipal(
490 auto r = pep->getProductResolver(
p.first.branchID());
491 r->putProduct(std::unique_ptr<WrapperBase>());
498 waitTask->increment_ref_count();
503 waitTask->wait_for_all();
504 if (waitTask->exceptionPtr() !=
nullptr) {
505 std::rethrow_exception(*(waitTask->exceptionPtr()));
519 auto const& es =
esp_->eventSetupImpl();
521 std::vector<edm::SubProcess> emptyList;
526 streamLoopWaitTask->increment_ref_count();
541 streamLoopWaitTask->wait_for_all();
542 if (streamLoopWaitTask->exceptionPtr() !=
nullptr) {
543 std::rethrow_exception(*(streamLoopWaitTask->exceptionPtr()));
548 globalWaitTask->increment_ref_count();
560 globalWaitTask->wait_for_all();
561 if (globalWaitTask->exceptionPtr() !=
nullptr) {
562 std::rethrow_exception(*(globalWaitTask->exceptionPtr()));
566 return lumiPrincipal;
570 std::shared_ptr<RunPrincipal> rp;
582 auto const& es =
esp_->eventSetupImpl();
584 std::vector<edm::SubProcess> emptyList;
589 streamLoopWaitTask->increment_ref_count();
604 streamLoopWaitTask->wait_for_all();
605 if (streamLoopWaitTask->exceptionPtr() !=
nullptr) {
606 std::rethrow_exception(*(streamLoopWaitTask->exceptionPtr()));
611 globalWaitTask->increment_ref_count();
623 globalWaitTask->wait_for_all();
624 if (globalWaitTask->exceptionPtr() !=
nullptr) {
625 std::rethrow_exception(*(globalWaitTask->exceptionPtr()));
637 "Multiple exceptions were thrown while executing endJob. An exception message follows for each.\n");
647 c.call([actReg]() { actReg->preEndJobSignal_(); });
649 c.call([actReg]() { actReg->postEndJobSignal_(); });