CMS 3D CMS Logo

ProducingModuleAdaptorBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_stream_ProducingModuleAdaptorBase_h
2 #define FWCore_Framework_stream_ProducingModuleAdaptorBase_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : ProducingModuleAdaptorBase
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Fri, 02 Aug 2013 18:09:15 GMT
19 //
20 
21 // system include files
22 #include <map>
23 #include <string>
24 #include <vector>
25 #include <unordered_map>
26 
27 // user include files
40 
41 // forward declarations
42 
43 namespace edm {
44  class Event;
45  class ModuleCallingContext;
46  class ProductResolverIndexHelper;
47  class EDConsumerBase;
48  class PreallocationConfiguration;
49  class ProductResolverIndexAndSkipBit;
50  class ProductRegistry;
51  class ThinnedAssociationsHelper;
52 
53  namespace maker {
54  template <typename T>
55  class ModuleHolderT;
56  }
57 
58  namespace eventsetup {
60  }
61 
62  namespace stream {
63  template <typename T>
64  class ProducingModuleAdaptorBase {
65  public:
66  template <typename U>
67  friend class edm::WorkerT;
68  template <typename U>
70 
73 
74  // ---------- const member functions ---------------------
75 
76  // ---------- static member functions --------------------
77 
78  // ---------- member functions ---------------------------
80 
81  virtual bool wantsGlobalRuns() const = 0;
82  virtual bool wantsGlobalLuminosityBlocks() const = 0;
83  virtual bool hasAcquire() const = 0;
84  virtual bool hasAccumulator() const = 0;
85  bool wantsStreamRuns() const { return true; }
86  bool wantsStreamLuminosityBlocks() const { return true; }
87 
89 
90  void itemsToGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
91  void itemsMayGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
92  std::vector<ProductResolverIndexAndSkipBit> const& itemsToGetFrom(BranchType) const;
93 
94  void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const&, bool iPrefetchMayGet);
96 
97  void modulesWhoseProductsAreConsumed(std::vector<ModuleDescription const*>& modules,
98  ProductRegistry const& preg,
99  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
100  std::string const& processName) const;
101 
103 
104  std::vector<ConsumesInfo> consumesInfo() const;
105 
107  std::unordered_multimap<std::string, std::tuple<edm::TypeID const*, const char*, edm::ProductResolverIndex>>;
108 
109  void resolvePutIndicies(BranchType iBranchType,
110  ModuleToResolverIndicies const& iIndicies,
111  std::string const& moduleLabel);
112 
113  std::vector<edm::ProductResolverIndex> const& indiciesForPutProducts(BranchType iBranchType) const;
114 
115  protected:
116  template <typename F>
117  void createStreamModules(F iFunc) {
118  for (auto& m : m_streamModules) {
119  m = iFunc();
120  m->setModuleDescriptionPtr(&moduleDescription_);
121  }
122  }
123 
126  template <typename I>
127  void commit(Event& iEvent, I* iID) {
129  }
130 
131  const EDConsumerBase* consumer() { return m_streamModules[0]; }
132 
133  const ProducerBase* producer() { return m_streamModules[0]; }
134 
135  private:
136  ProducingModuleAdaptorBase(const ProducingModuleAdaptorBase&) = delete; // stop default
137 
138  const ProducingModuleAdaptorBase& operator=(const ProducingModuleAdaptorBase&) = delete; // stop default
139 
141  virtual void preallocLumis(unsigned int) {}
142  virtual void setupStreamModules() = 0;
143  virtual void doBeginJob() = 0;
144  virtual void doEndJob() = 0;
145 
146  void doBeginStream(StreamID id);
147  void doEndStream(StreamID id);
149  virtual void setupRun(T*, RunIndex) = 0;
151  virtual void streamEndRunSummary(T*, edm::Run const&, edm::EventSetup const&) = 0;
152 
155  EventSetupImpl const& c,
156  ModuleCallingContext const*);
157  virtual void setupLuminosityBlock(T*, LuminosityBlockIndex) = 0;
160  EventSetupImpl const& c,
161  ModuleCallingContext const*);
162  virtual void streamEndLuminosityBlockSummary(T*, edm::LuminosityBlock const&, edm::EventSetup const&) = 0;
163 
164  virtual void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*) = 0;
165  virtual void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*) = 0;
166  virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp,
167  EventSetupImpl const& c,
168  ModuleCallingContext const*) = 0;
169  virtual void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp,
170  EventSetupImpl const& c,
171  ModuleCallingContext const*) = 0;
172 
173  //For now, the following are just dummy implemenations with no ability for users to override
177 
178  // ---------- member data --------------------------------
181 
182  protected:
183  std::vector<T*> m_streamModules;
184  };
185  } // namespace stream
186 } // namespace edm
187 
188 #endif
edm::stream::ProducingModuleAdaptorBase::commit
void commit(Run &iRun)
Definition: ProducingModuleAdaptorBase.h:124
edm::stream::ProducingModuleAdaptorBase::streamEndRunSummary
virtual void streamEndRunSummary(T *, edm::Run const &, edm::EventSetup const &)=0
edm::stream::ProducingModuleAdaptorBase::setupRun
virtual void setupRun(T *, RunIndex)=0
edm::StreamID
Definition: StreamID.h:30
edm::stream::ProducingModuleAdaptorBase::resolvePutIndicies
void resolvePutIndicies(BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
Definition: ProducingModuleAdaptorBase.cc:143
edm::stream::ProducingModuleAdaptorBase::streamEndLuminosityBlockSummary
virtual void streamEndLuminosityBlockSummary(T *, edm::LuminosityBlock const &, edm::EventSetup const &)=0
edm::stream::ProducingModuleAdaptorBase::doStreamBeginRun
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: ProducingModuleAdaptorBase.cc:167
edm::stream::ProducingModuleAdaptorBase::itemsMayGet
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Definition: ProducingModuleAdaptorBase.cc:91
edm::stream::ProducingModuleAdaptorBase::registerProductsAndCallbacks
void registerProductsAndCallbacks(ProducingModuleAdaptorBase const *, ProductRegistry *reg)
Definition: ProducingModuleAdaptorBase.cc:60
edm::eventsetup::ESRecordsToProxyIndices
Definition: ESRecordsToProxyIndices.h:35
edm::stream::ProducingModuleAdaptorBase::itemsToGet
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Definition: ProducingModuleAdaptorBase.cc:84
edm::stream::ProducingModuleAdaptorBase::~ProducingModuleAdaptorBase
virtual ~ProducingModuleAdaptorBase()
Definition: ProducingModuleAdaptorBase.cc:42
edm::Run::commit_
void commit_(std::vector< edm::ProductResolverIndex > const &iShouldPut)
Definition: Run.cc:76
edm::stream::ProducingModuleAdaptorBase::modulesWhoseProductsAreConsumed
void modulesWhoseProductsAreConsumed(std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
Definition: ProducingModuleAdaptorBase.cc:105
edm::EventSetupImpl
Definition: EventSetupImpl.h:44
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
edm::stream::ProducingModuleAdaptorBase::ProducingModuleAdaptorBase
ProducingModuleAdaptorBase()
Definition: ProducingModuleAdaptorBase.cc:39
modules
Definition: ZHLTMatchFilter.cc:17
LuminosityBlock.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::stream::ProducingModuleAdaptorBase::moduleDescription_
ModuleDescription moduleDescription_
Definition: ProducingModuleAdaptorBase.h:180
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
edm::stream::ProducingModuleAdaptorBase::updateLookup
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
Definition: ProducingModuleAdaptorBase.cc:128
ProductResolverIndex.h
edm::LuminosityBlockPrincipal
Definition: LuminosityBlockPrincipal.h:31
edm::stream::ProducingModuleAdaptorBase::m_streamModules
std::vector< T * > m_streamModules
Definition: ProducingModuleAdaptorBase.h:183
edm::stream::ProducingModuleAdaptorBase::doEndJob
virtual void doEndJob()=0
edm::stream::ProducingModuleAdaptorBase::doBeginLuminosityBlock
virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)=0
edm::stream::ProducingModuleAdaptorBase::indiciesForPutProducts
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts(BranchType iBranchType) const
Definition: ProducingModuleAdaptorBase.cc:152
edm::stream::ProducingModuleAdaptorBase::doBeginRun
virtual void doBeginRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)=0
edm::WorkerT
Definition: Frameworkfwd.h:54
edm::ProductResolverIndexHelper
Definition: ProductResolverIndexHelper.h:89
edm::InRun
Definition: BranchType.h:11
edm::BranchType
BranchType
Definition: BranchType.h:11
edm::ModuleDescription
Definition: ModuleDescription.h:21
edm::stream::ProducingModuleAdaptorBase::doRespondToCloseInputFile
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: ProducingModuleAdaptorBase.cc:230
edm::stream::ProducingModuleAdaptorBase::createStreamModules
void createStreamModules(F iFunc)
Definition: ProducingModuleAdaptorBase.h:117
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
edm::ProductRegistry
Definition: ProductRegistry.h:34
ModuleDescription.h
edm::FileBlock
Definition: FileBlock.h:20
edm::stream::ProducingModuleAdaptorBase::wantsGlobalLuminosityBlocks
virtual bool wantsGlobalLuminosityBlocks() const =0
edm::EDConsumerBase
Definition: EDConsumerBase.h:62
edm::stream::ProducingModuleAdaptorBase::doBeginStream
void doBeginStream(StreamID id)
Definition: ProducingModuleAdaptorBase.cc:158
edm::LuminosityBlockIndex
Definition: LuminosityBlockIndex.h:33
Exhume::I
const std::complex< double > I
Definition: I.h:8
edm::stream::ProducingModuleAdaptorBase::hasAccumulator
virtual bool hasAccumulator() const =0
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::stream::ProducingModuleAdaptorBase::consumer
const EDConsumerBase * consumer()
Definition: ProducingModuleAdaptorBase.h:131
edm::stream::ProducingModuleAdaptorBase::doEndLuminosityBlock
virtual void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)=0
Run.h
Event
edm::stream::ProducingModuleAdaptorBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: ProducingModuleAdaptorBase.cc:53
edm::stream::ProducingModuleAdaptorBase::preallocLumis
virtual void preallocLumis(unsigned int)
Definition: ProducingModuleAdaptorBase.h:141
edm::InEvent
Definition: BranchType.h:11
edm::maker::ModuleHolderT
Definition: EDAnalyzer.h:26
edm::stream::ProducingModuleAdaptorBase::wantsGlobalRuns
virtual bool wantsGlobalRuns() const =0
edm::stream::ProducingModuleAdaptorBase::hasAcquire
virtual bool hasAcquire() const =0
RunIndex.h
edm::stream::ProducingModuleAdaptorBase::setupStreamModules
virtual void setupStreamModules()=0
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::stream::ProducingModuleAdaptorBase::producer
const ProducerBase * producer()
Definition: ProducingModuleAdaptorBase.h:133
edm::stream::ProducingModuleAdaptorBase::doEndStream
void doEndStream(StreamID id)
Definition: ProducingModuleAdaptorBase.cc:162
es_hardcode_cfi.iLumi
iLumi
Definition: es_hardcode_cfi.py:206
edm::ThinnedAssociationsHelper
Definition: ThinnedAssociationsHelper.h:35
edm::stream::ProducingModuleAdaptorBase::commit
void commit(LuminosityBlock &iLumi)
Definition: ProducingModuleAdaptorBase.h:125
Event.h
edm::InLumi
Definition: BranchType.h:11
edm::stream::ProducingModuleAdaptorBase::setupLuminosityBlock
virtual void setupLuminosityBlock(T *, LuminosityBlockIndex)=0
ESRecordsToProxyIndices
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::stream::ProducingModuleAdaptorBase::ModuleToResolverIndicies
std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > > ModuleToResolverIndicies
Definition: ProducingModuleAdaptorBase.h:107
BranchType.h
edm::stream::ProducingModuleAdaptorBase::wantsStreamRuns
bool wantsStreamRuns() const
Definition: ProducingModuleAdaptorBase.h:85
edm::EventSetup
Definition: EventSetup.h:57
edm::stream::ProducingModuleAdaptorBase
Definition: Event.h:70
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::stream::ProducingModuleAdaptorBase::doRegisterThinnedAssociations
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: ProducingModuleAdaptorBase.cc:233
edm::stream::ProducingModuleAdaptorBase::itemsToGetFrom
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom(BranchType) const
Definition: ProducingModuleAdaptorBase.cc:98
edm::stream::ProducingModuleAdaptorBase::setModuleDescription
void setModuleDescription(ModuleDescription const &md)
Definition: ProducingModuleAdaptorBase.h:179
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
edm::stream::ProducingModuleAdaptorBase::doEndRun
virtual void doEndRun(RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)=0
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
edm::stream::ProducingModuleAdaptorBase::wantsStreamLuminosityBlocks
bool wantsStreamLuminosityBlocks() const
Definition: ProducingModuleAdaptorBase.h:86
Frameworkfwd.h
T
long double T
Definition: Basic3DVectorLD.h:48
ParameterSetfwd.h
edm::stream::ProducingModuleAdaptorBase::commit
void commit(Event &iEvent, I *iID)
Definition: ProducingModuleAdaptorBase.h:127
edm::RunIndex
Definition: RunIndex.h:32
LuminosityBlockIndex.h
edm::stream::ProducingModuleAdaptorBase::consumesInfo
std::vector< ConsumesInfo > consumesInfo() const
Definition: ProducingModuleAdaptorBase.cc:122
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
edm::RunPrincipal
Definition: RunPrincipal.h:34
edm::ProducerBase
Definition: ProducerBase.h:65
edm::stream::ProducingModuleAdaptorBase::moduleDescription
const ModuleDescription & moduleDescription() const
Definition: ProducingModuleAdaptorBase.h:79
edm::Event
Definition: Event.h:73
ConsumesInfo.h
StreamID.h
edm::stream::ProducingModuleAdaptorBase::doRespondToOpenInputFile
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: ProducingModuleAdaptorBase.cc:228
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
benchmark_cfg.fb
fb
Definition: benchmark_cfg.py:14
edm::stream::ProducingModuleAdaptorBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: ProducingModuleAdaptorBase.cc:195
edm::stream::ProducingModuleAdaptorBase::doStreamEndRun
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: ProducingModuleAdaptorBase.cc:181
edm::stream::ProducingModuleAdaptorBase::doStreamEndLuminosityBlock
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetupImpl const &c, ModuleCallingContext const *)
Definition: ProducingModuleAdaptorBase.cc:212
edm::stream::ProducingModuleAdaptorBase::operator=
const ProducingModuleAdaptorBase & operator=(const ProducingModuleAdaptorBase &)=delete
edm::stream::ProducingModuleAdaptorBase::convertCurrentProcessAlias
void convertCurrentProcessAlias(std::string const &processName)
Definition: ProducingModuleAdaptorBase.cc:115
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29
edm::stream::ProducingModuleAdaptorBase::doBeginJob
virtual void doBeginJob()=0