CMS 3D CMS Logo

WorkerT.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_WorkerT_h
2 #define FWCore_Framework_WorkerT_h
3 
4 /*----------------------------------------------------------------------
5 
6 WorkerT: Code common to all workers.
7 
8 ----------------------------------------------------------------------*/
9 
16 
17 #include <map>
18 #include <memory>
19 #include <string>
20 #include <vector>
21 
22 namespace edm {
23 
24  class ModuleCallingContext;
25  class ProductResolverIndexAndSkipBit;
26  class ThinnedAssociationsHelper;
27  class WaitingTaskWithArenaHolder;
28 
29  template <typename T>
30  class WorkerT : public Worker {
31  public:
32  typedef T ModuleType;
34  WorkerT(std::shared_ptr<T>, ModuleDescription const&, ExceptionToActionTable const* actions);
35 
36  ~WorkerT() override;
37 
38  void setModule(std::shared_ptr<T> iModule) {
39  module_ = iModule;
40  resetModuleDescription(&(module_->moduleDescription()));
41  }
42 
43  Types moduleType() const override;
44 
45  bool wantsProcessBlocks() const final;
46  bool wantsInputProcessBlocks() const final;
47  bool wantsGlobalRuns() const final;
49  bool wantsStreamRuns() const final;
51 
54 
55  void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const&) final;
56  void updateLookup(eventsetup::ESRecordsToProxyIndices const&) final;
57  void resolvePutIndicies(
58  BranchType iBranchType,
59  std::unordered_multimap<std::string, std::tuple<TypeID const*, const char*, edm::ProductResolverIndex>> const&
60  iIndicies) final;
61 
62  template <typename D>
64  template <typename D>
66  template <typename D>
68  template <typename D>
70  template <typename D>
72  template <typename D>
74 
75  protected:
76  T& module() { return *module_; }
77  T const& module() const { return *module_; }
78 
79  private:
80  bool implDo(EventTransitionInfo const&, ModuleCallingContext const*) override;
81 
82  void itemsToGetForSelection(std::vector<ProductResolverIndexAndSkipBit>&) const final;
83  bool implNeedToRunSelection() const final;
84 
86 
99  void implBeginJob() override;
100  void implEndJob() override;
101  void implBeginStream(StreamID) override;
102  void implEndStream(StreamID) override;
106  std::string workerType() const override;
107  TaskQueueAdaptor serializeRunModule() override;
108 
111  ProductRegistry const& preg,
112  std::map<std::string, ModuleDescription const*> const& labelsToDesc) const override {
113  module_->modulesWhoseProductsAreConsumed(modules, preg, labelsToDesc, module_->moduleDescription().processName());
114  }
115 
117  module_->convertCurrentProcessAlias(processName);
118  }
119 
120  std::vector<ConsumesInfo> consumesInfo() const override { return module_->consumesInfo(); }
121 
122  void itemsToGet(BranchType branchType, std::vector<ProductResolverIndexAndSkipBit>& indexes) const override {
123  module_->itemsToGet(branchType, indexes);
124  }
125 
126  void itemsMayGet(BranchType branchType, std::vector<ProductResolverIndexAndSkipBit>& indexes) const override {
127  module_->itemsMayGet(branchType, indexes);
128  }
129 
130  std::vector<ProductResolverIndexAndSkipBit> const& itemsToGetFrom(BranchType iType) const final {
131  return module_->itemsToGetFrom(iType);
132  }
133 
134  std::vector<ESProxyIndex> const& esItemsToGetFrom(Transition iTransition) const override {
135  return module_->esGetTokenIndicesVector(iTransition);
136  }
137  std::vector<ESRecordIndex> const& esRecordsToGetFrom(Transition iTransition) const override {
138  return module_->esGetTokenRecordIndicesVector(iTransition);
139  }
140 
141  std::vector<ProductResolverIndex> const& itemsShouldPutInEvent() const override;
142 
144  ModuleCallingContext const& iModuleCallingContext,
145  Principal const& iPrincipal) const override {
146  module_->preActionBeforeRunEventAsync(iTask, iModuleCallingContext, iPrincipal);
147  }
148 
149  bool hasAcquire() const override { return module_->hasAcquire(); }
150 
151  bool hasAccumulator() const override { return module_->hasAccumulator(); }
152 
154  };
155 
156 } // namespace edm
157 
158 #endif
edm::EventTransitionInfo
Definition: TransitionInfoTypes.h:26
edm::StreamID
Definition: StreamID.h:30
edm::ProductResolverIndex
unsigned int ProductResolverIndex
Definition: ProductResolverIndex.h:8
edm::WorkerT::globalLuminosityBlocksQueue
SerialTaskQueue * globalLuminosityBlocksQueue() final
Definition: WorkerT.cc:153
edm::WorkerT::updateLookup
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &) final
Definition: WorkerT.cc:626
edm::WorkerT::implDo
bool implDo(EventTransitionInfo const &, ModuleCallingContext const *) override
Definition: WorkerT.cc:215
edm::LumiTransitionInfo
Definition: TransitionInfoTypes.h:42
propagate_const.h
edm::WorkerT::implDoBegin
bool implDoBegin(RunTransitionInfo const &, ModuleCallingContext const *) override
Definition: WorkerT.cc:336
modules
Definition: ZHLTMatchFilter.cc:17
edm::WorkerT::globalRunsQueue
SerialTaskQueue * globalRunsQueue() final
Definition: WorkerT.cc:149
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::WorkerT::esItemsToGetFrom
std::vector< ESProxyIndex > const & esItemsToGetFrom(Transition iTransition) const override
Definition: WorkerT.h:134
edm::WorkerT::itemsToGetFrom
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom(BranchType iType) const final
Definition: WorkerT.h:130
edm::Worker::resetModuleDescription
void resetModuleDescription(ModuleDescription const *)
Definition: Worker.cc:341
edm::WorkerT::convertCurrentProcessAlias
void convertCurrentProcessAlias(std::string const &processName) override
Definition: WorkerT.h:116
edm::Principal
Definition: Principal.h:57
edm::SerialTaskQueue
Definition: SerialTaskQueue.h:67
edm::WorkerT::callWorkerStreamEnd
void callWorkerStreamEnd(D, StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: WorkerT.cc:352
edm::WorkerT
Definition: Frameworkfwd.h:62
edm::ProductResolverIndexHelper
Definition: ProductResolverIndexHelper.h:89
edm::RunTransitionInfo
Definition: TransitionInfoTypes.h:64
watchdog.const
const
Definition: watchdog.py:83
edm::WorkerT::workerType
std::string workerType() const override
Definition: WorkerT.cc:437
edm::ProcessBlockPrincipal
Definition: ProcessBlockPrincipal.h:22
edm::WorkerT::itemsToGet
void itemsToGet(BranchType branchType, std::vector< ProductResolverIndexAndSkipBit > &indexes) const override
Definition: WorkerT.h:122
edm::BranchType
BranchType
Definition: BranchType.h:11
edm::WorkerT::wantsInputProcessBlocks
bool wantsInputProcessBlocks() const final
Definition: WorkerT.cc:124
edm::ModuleDescription
Definition: ModuleDescription.h:21
edm::WorkerT::implDoAccessInputProcessBlock
bool implDoAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *) override
Definition: WorkerT.cc:324
edm::WorkerT::esRecordsToGetFrom
std::vector< ESRecordIndex > const & esRecordsToGetFrom(Transition iTransition) const override
Definition: WorkerT.h:137
edm::WorkerT::hasAcquire
bool hasAcquire() const override
Definition: WorkerT.h:149
edm::ProductRegistry
Definition: ProductRegistry.h:37
edm::FileBlock
Definition: FileBlock.h:20
edm::WorkerT::setModule
void setModule(std::shared_ptr< T > iModule)
Definition: WorkerT.h:38
edm::WorkerT::implNeedToRunSelection
bool implNeedToRunSelection() const final
Definition: WorkerT.cc:255
edm::WaitingTaskWithArenaHolder
Definition: WaitingTaskWithArenaHolder.h:31
edm::propagate_const
Definition: propagate_const.h:32
edm::WorkerT::wantsStreamLuminosityBlocks
bool wantsStreamLuminosityBlocks() const final
Definition: WorkerT.cc:144
edm::WorkerT::consumesInfo
std::vector< ConsumesInfo > consumesInfo() const override
Definition: WorkerT.h:120
edm::WorkerT::module_
edm::propagate_const< std::shared_ptr< T > > module_
Definition: WorkerT.h:153
edm::EventPrincipal
Definition: EventPrincipal.h:46
edm::WorkerT::resolvePutIndicies
void resolvePutIndicies(BranchType iBranchType, std::unordered_multimap< std::string, std::tuple< TypeID const *, const char *, edm::ProductResolverIndex >> const &iIndicies) final
Definition: WorkerT.cc:684
edm::WorkerT::implDoPrePrefetchSelection
bool implDoPrePrefetchSelection(StreamID, EventPrincipal const &, ModuleCallingContext const *) override
Definition: WorkerT.cc:260
edm::WorkerT::ModuleType
T ModuleType
Definition: WorkerT.h:32
edm::WorkerT::wantsGlobalRuns
bool wantsGlobalRuns() const final
Definition: WorkerT.cc:129
edm::WorkerT::moduleType
Types moduleType() const override
edm::WorkerT::implDoEnd
bool implDoEnd(RunTransitionInfo const &, ModuleCallingContext const *) override
Definition: WorkerT.cc:379
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::WorkerT::WorkerType
WorkerT< T > WorkerType
Definition: WorkerT.h:33
edm::WorkerT::implRegisterThinnedAssociations
void implRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &) override
Definition: WorkerT.cc:488
edm::WorkerT::implEndStream
void implEndStream(StreamID) override
Definition: WorkerT.cc:471
edm::ThinnedAssociationsHelper
Definition: ThinnedAssociationsHelper.h:37
edm::Transition
Transition
Definition: Transition.h:12
edm::WorkerT::implDoStreamBegin
bool implDoStreamBegin(StreamID, RunTransitionInfo const &, ModuleCallingContext const *) override
Definition: WorkerT.cc:357
edm::WorkerT::itemsShouldPutInEvent
std::vector< ProductResolverIndex > const & itemsShouldPutInEvent() const override
Definition: WorkerT.cc:692
edm::WorkerT::wantsProcessBlocks
bool wantsProcessBlocks() const final
Definition: WorkerT.cc:119
edm::WorkerT::callWorkerStreamBegin
void callWorkerStreamBegin(D, StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: WorkerT.cc:343
ESRecordsToProxyIndices
edm::WorkerT::callWorkerBeginStream
void callWorkerBeginStream(D, StreamID)
Definition: WorkerT.cc:453
edm::WorkerT::implDoStreamEnd
bool implDoStreamEnd(StreamID, RunTransitionInfo const &, ModuleCallingContext const *) override
Definition: WorkerT.cc:369
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::WorkerT::module
T const & module() const
Definition: WorkerT.h:77
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
edm::ExceptionToActionTable
Definition: ExceptionActions.h:16
edm::WorkerT::implDoBeginProcessBlock
bool implDoBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *) override
Definition: WorkerT.cc:318
edm::WorkerT::wantsStreamRuns
bool wantsStreamRuns() const final
Definition: WorkerT.cc:139
edm::WorkerT::itemsToGetForSelection
void itemsToGetForSelection(std::vector< ProductResolverIndexAndSkipBit > &) const final
Definition: WorkerT.cc:266
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
Types
Definition: Types.py:1
edm::WorkerT::implBeginJob
void implBeginJob() override
Definition: WorkerT.cc:442
edm::WorkerT::implRespondToOpenInputFile
void implRespondToOpenInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:478
edm::WorkerT::wantsGlobalLuminosityBlocks
bool wantsGlobalLuminosityBlocks() const final
Definition: WorkerT.cc:134
funct::D
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
edm::WaitingTask
Definition: WaitingTask.h:36
WorkerParams.h
edm::TypeID
Definition: TypeID.h:22
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
T
long double T
Definition: Basic3DVectorLD.h:48
edm::WorkerT::serializeRunModule
TaskQueueAdaptor serializeRunModule() override
Definition: WorkerT.cc:494
Worker.h
edm::WorkerT::callWorkerEndStream
void callWorkerEndStream(D, StreamID)
Definition: WorkerT.cc:466
edm::WorkerT::preActionBeforeRunEventAsync
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const override
Definition: WorkerT.h:143
edm::WorkerT::implBeginStream
void implBeginStream(StreamID) override
Definition: WorkerT.cc:458
edm::WorkerT::hasAccumulator
bool hasAccumulator() const override
Definition: WorkerT.h:151
actions
roAction_t actions[nactions]
Definition: GenABIO.cc:181
TransitionInfoTypes.h
edm::WorkerT::implDoAcquire
void implDoAcquire(EventTransitionInfo const &, ModuleCallingContext const *, WaitingTaskWithArenaHolder &) final
Definition: WorkerT.cc:222
genParticles_cff.map
map
Definition: genParticles_cff.py:11
edm::WorkerT::module
T & module()
Definition: WorkerT.h:76
ConsumesInfo.h
edm::WorkerT::itemsMayGet
void itemsMayGet(BranchType branchType, std::vector< ProductResolverIndexAndSkipBit > &indexes) const override
Definition: WorkerT.h:126
edm::WorkerT::implRespondToCloseInputFile
void implRespondToCloseInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:483
edm::WorkerT::WorkerT
WorkerT(std::shared_ptr< T >, ModuleDescription const &, ExceptionToActionTable const *actions)
Definition: WorkerT.cc:110
edm::WorkerT::modulesWhoseProductsAreConsumed
void modulesWhoseProductsAreConsumed(std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc) const override
Definition: WorkerT.h:109
benchmark_cfg.fb
fb
Definition: benchmark_cfg.py:14
edm::WorkerT::~WorkerT
~WorkerT() override
Definition: WorkerT.cc:116
edm::WorkerT::implEndJob
void implEndJob() override
Definition: WorkerT.cc:447
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29
edm::WorkerT::implDoEndProcessBlock
bool implDoEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *) override
Definition: WorkerT.cc:330