CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::SecondaryEventProvider Class Reference

#include <SecondaryEventProvider.h>

Public Member Functions

void beginJob (ProductRegistry const &iRegistry, eventsetup::ESRecordsToProductResolverIndices const &, GlobalContext const &)
 
void beginLuminosityBlock (LuminosityBlockPrincipal &lumi, const edm::EventSetupImpl &setup, ModuleCallingContext const *, StreamContext &sContext)
 
void beginRun (RunPrincipal &run, const edm::EventSetupImpl &setup, ModuleCallingContext const *, StreamContext &sContext)
 
void beginStream (edm::StreamID, StreamContext const &)
 
void endJob (ExceptionCollector &exceptionCollector, GlobalContext const &globalContext)
 
void endLuminosityBlock (LuminosityBlockPrincipal &lumi, const edm::EventSetupImpl &setup, ModuleCallingContext const *, StreamContext &sContext)
 
void endRun (RunPrincipal &run, const edm::EventSetupImpl &setup, ModuleCallingContext const *, StreamContext &sContext)
 
void endStream (edm::StreamID, StreamContext const &, ExceptionCollector &)
 
 SecondaryEventProvider (std::vector< ParameterSet > &psets, ProductRegistry &pregistry, std::shared_ptr< ProcessConfiguration > processConfiguration)
 
void setupPileUpEvent (EventPrincipal &ep, const EventSetupImpl &setup, StreamContext &sContext)
 

Private Attributes

std::unique_ptr< ExceptionToActionTableexceptionToActionTable_
 
WorkerManager workerManager_
 

Detailed Description

Definition at line 15 of file SecondaryEventProvider.h.

Constructor & Destructor Documentation

◆ SecondaryEventProvider()

edm::SecondaryEventProvider::SecondaryEventProvider ( std::vector< ParameterSet > &  psets,
ProductRegistry pregistry,
std::shared_ptr< ProcessConfiguration processConfiguration 
)

Definition at line 54 of file SecondaryEventProvider.cc.

References edm::WorkerManager::addToUnscheduledWorkers(), label, muonDTDigis_cfi::pset, edm::ProductRegistry::setUnscheduledProducts(), AlCaHLTBitMon_QueryRunRegistry::string, and workerManager_.

57  : exceptionToActionTable_(new ExceptionToActionTable),
58  // no type resolver for modules in SecondaryEventProvider for now
59  workerManager_(std::make_shared<ActivityRegistry>(), *exceptionToActionTable_, nullptr) {
60  std::vector<std::string> shouldBeUsedLabels;
61  std::set<std::string> unscheduledLabels;
62  const PreallocationConfiguration preallocConfig;
63  for (auto& pset : psets) {
64  std::string label = pset.getParameter<std::string>("@module_label");
66  pset, preg, &preallocConfig, processConfiguration, label, unscheduledLabels, shouldBeUsedLabels);
67  }
68  if (!unscheduledLabels.empty()) {
69  preg.setUnscheduledProducts(unscheduledLabels);
70  }
71  } // SecondaryEventProvider::SecondaryEventProvider
std::unique_ptr< ExceptionToActionTable > exceptionToActionTable_
char const * label
void addToUnscheduledWorkers(ParameterSet &pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, std::string label, std::set< std::string > &unscheduledLabels, std::vector< std::string > &shouldBeUsedLabels)

Member Function Documentation

◆ beginJob()

void edm::SecondaryEventProvider::beginJob ( ProductRegistry const &  iRegistry,
eventsetup::ESRecordsToProductResolverIndices const &  iIndices,
GlobalContext const &  globalContext 
)

Definition at line 73 of file SecondaryEventProvider.cc.

References edm::WorkerManager::beginJob(), and workerManager_.

75  {
76  ProcessBlockHelper dummyProcessBlockHelper;
77  workerManager_.beginJob(iRegistry, iIndices, dummyProcessBlockHelper, globalContext);
78  }
void beginJob(ProductRegistry const &iRegistry, eventsetup::ESRecordsToProductResolverIndices const &, ProcessBlockHelperBase const &, GlobalContext const &)

◆ beginLuminosityBlock()

void edm::SecondaryEventProvider::beginLuminosityBlock ( LuminosityBlockPrincipal lumi,
const edm::EventSetupImpl setup,
ModuleCallingContext const *  mcc,
StreamContext sContext 
)

Definition at line 93 of file SecondaryEventProvider.cc.

References info(), edm::StreamID::invalidStreamID(), singleTopDQM_cfi::setup, edm::StreamContext::streamID(), and workerManager_.

96  {
97  LumiTransitionInfo info(lumi, setup);
98  processOneOccurrence<OccurrenceTraits<LuminosityBlockPrincipal, BranchActionGlobalBegin>>(
100  processOneOccurrence<OccurrenceTraits<LuminosityBlockPrincipal, BranchActionStreamBegin>>(
101  workerManager_, info, sContext.streamID(), &sContext, mcc);
102  }
static const TGPicture * info(bool iBackgroundIsBlack)
static StreamID invalidStreamID()
Definition: StreamID.h:45

◆ beginRun()

void edm::SecondaryEventProvider::beginRun ( RunPrincipal run,
const edm::EventSetupImpl setup,
ModuleCallingContext const *  mcc,
StreamContext sContext 
)

Definition at line 82 of file SecondaryEventProvider.cc.

References info(), edm::StreamID::invalidStreamID(), writedatasetfile::run, singleTopDQM_cfi::setup, edm::StreamContext::streamID(), and workerManager_.

85  {
86  RunTransitionInfo info(run, setup);
87  processOneOccurrence<OccurrenceTraits<RunPrincipal, BranchActionGlobalBegin>>(
89  processOneOccurrence<OccurrenceTraits<RunPrincipal, BranchActionStreamBegin>>(
90  workerManager_, info, sContext.streamID(), &sContext, mcc);
91  }
static const TGPicture * info(bool iBackgroundIsBlack)
static StreamID invalidStreamID()
Definition: StreamID.h:45

◆ beginStream()

void edm::SecondaryEventProvider::beginStream ( edm::StreamID  iID,
StreamContext const &  sContext 
)

Definition at line 162 of file SecondaryEventProvider.cc.

References edm::WorkerManager::beginStream(), and workerManager_.

162  {
163  workerManager_.beginStream(iID, sContext);
164  }
void beginStream(StreamID, StreamContext const &)

◆ endJob()

void edm::SecondaryEventProvider::endJob ( ExceptionCollector exceptionCollector,
GlobalContext const &  globalContext 
)
inline

Definition at line 44 of file SecondaryEventProvider.h.

References edm::WorkerManager::endJob(), and workerManager_.

44  {
45  workerManager_.endJob(exceptionCollector, globalContext);
46  }
void endJob(ExceptionCollector &, GlobalContext const &)

◆ endLuminosityBlock()

void edm::SecondaryEventProvider::endLuminosityBlock ( LuminosityBlockPrincipal lumi,
const edm::EventSetupImpl setup,
ModuleCallingContext const *  mcc,
StreamContext sContext 
)

Definition at line 115 of file SecondaryEventProvider.cc.

References info(), edm::StreamID::invalidStreamID(), singleTopDQM_cfi::setup, edm::StreamContext::streamID(), and workerManager_.

118  {
119  LumiTransitionInfo info(lumi, setup);
120  processOneOccurrence<OccurrenceTraits<LuminosityBlockPrincipal, BranchActionStreamEnd>>(
121  workerManager_, info, sContext.streamID(), &sContext, mcc);
122  processOneOccurrence<OccurrenceTraits<LuminosityBlockPrincipal, BranchActionGlobalEnd>>(
123  workerManager_, info, StreamID::invalidStreamID(), nullptr, mcc);
124  }
static const TGPicture * info(bool iBackgroundIsBlack)
static StreamID invalidStreamID()
Definition: StreamID.h:45

◆ endRun()

void edm::SecondaryEventProvider::endRun ( RunPrincipal run,
const edm::EventSetupImpl setup,
ModuleCallingContext const *  mcc,
StreamContext sContext 
)

Definition at line 104 of file SecondaryEventProvider.cc.

References info(), edm::StreamID::invalidStreamID(), writedatasetfile::run, singleTopDQM_cfi::setup, edm::StreamContext::streamID(), and workerManager_.

107  {
108  RunTransitionInfo info(run, setup);
109  processOneOccurrence<OccurrenceTraits<RunPrincipal, BranchActionStreamEnd>>(
110  workerManager_, info, sContext.streamID(), &sContext, mcc);
111  processOneOccurrence<OccurrenceTraits<RunPrincipal, BranchActionGlobalEnd>>(
112  workerManager_, info, StreamID::invalidStreamID(), nullptr, mcc);
113  }
static const TGPicture * info(bool iBackgroundIsBlack)
static StreamID invalidStreamID()
Definition: StreamID.h:45

◆ endStream()

void edm::SecondaryEventProvider::endStream ( edm::StreamID  iID,
StreamContext const &  sContext,
ExceptionCollector exceptionCollector 
)

Definition at line 166 of file SecondaryEventProvider.cc.

References edm::WorkerManager::endStream(), mutex, and workerManager_.

168  {
169  // In this context the mutex is not needed because these things are not
170  // executing concurrently but in general the WorkerManager needs one.
171  std::mutex exceptionCollectorMutex;
172  workerManager_.endStream(iID, sContext, exceptionCollector, exceptionCollectorMutex);
173  }
static std::mutex mutex
Definition: Proxy.cc:8
void endStream(StreamID, StreamContext const &, ExceptionCollector &, std::mutex &collectorMutex) noexcept

◆ setupPileUpEvent()

void edm::SecondaryEventProvider::setupPileUpEvent ( EventPrincipal ep,
const EventSetupImpl setup,
StreamContext sContext 
)

Definition at line 126 of file SecondaryEventProvider.cc.

References edm::addContextAndPrintException(), cms::Exception::context(), ecalHexDisplay_cfg::ep, info(), edm::ServiceRegistry::instance(), edm::ServiceRegistry::presentToken(), singleTopDQM_cfi::setup, edm::WorkerManager::setupOnDemandSystem(), edm::WorkerManager::setupResolvers(), edm::StreamContext::streamID(), edm::syncWait(), unpackBuffers-CaloStage2::token, edm::WorkerManager::unscheduledWorkers(), workerManager_, and edm::convertException::wrap().

128  {
130  EventTransitionInfo info(ep, setup);
132 
133  if (workerManager_.unscheduledWorkers().empty()) {
134  return;
135  }
137  //we need the arena to guarantee that the syncWait will return to this thread
138  // and not cause this callstack to possibly be moved to a new thread
139  ParentContext pc(&sContext);
140  std::exception_ptr exceptPtr = tbb::this_task_arena::isolate([&]() {
141  return edm::syncWait([&](edm::WaitingTaskHolder&& iHolder) {
142  for (auto& worker : workerManager_.unscheduledWorkers()) {
143  worker->doWorkAsync<OccurrenceTraits<EventPrincipal, BranchActionStreamBegin>>(
144  iHolder, info, token, sContext.streamID(), pc, &sContext);
145  }
146  });
147  });
148  if (exceptPtr) {
149  try {
150  edm::convertException::wrap([&]() { std::rethrow_exception(exceptPtr); });
151  } catch (cms::Exception& ex) {
152  if (ex.context().empty()) {
153  edm::addContextAndPrintException("Calling SecondaryEventProvider", ex, false);
154  } else {
155  edm::addContextAndPrintException("", ex, false);
156  }
157  throw;
158  }
159  }
160  }
static const TGPicture * info(bool iBackgroundIsBlack)
std::exception_ptr syncWait(F &&iFunc)
void setupOnDemandSystem(EventTransitionInfo const &)
void addContextAndPrintException(char const *context, cms::Exception &ex, bool disablePrint)
AllWorkers const & unscheduledWorkers() const
Definition: WorkerManager.h:83
static ServiceRegistry & instance()
void setupResolvers(Principal &principal)
auto wrap(F iFunc) -> decltype(iFunc())
std::list< std::string > const & context() const
Definition: Exception.cc:151
ServiceToken presentToken() const

Member Data Documentation

◆ exceptionToActionTable_

std::unique_ptr<ExceptionToActionTable> edm::SecondaryEventProvider::exceptionToActionTable_
private

Definition at line 52 of file SecondaryEventProvider.h.

◆ workerManager_

WorkerManager edm::SecondaryEventProvider::workerManager_
private