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
43 
44 // forward declarations
45 
46 namespace edm {
47  class Event;
48  class ModuleCallingContext;
49  class ModuleProcessName;
50  class ProductResolverIndexHelper;
51  class EDConsumerBase;
52  class PreallocationConfiguration;
53  class ProductResolverIndexAndSkipBit;
54  class ThinnedAssociationsHelper;
55 
56  namespace maker {
57  template <typename T>
58  class ModuleHolderT;
59  }
60 
61  namespace eventsetup {
63  }
64 
65  namespace stream {
66  template <typename T>
67  class ProducingModuleAdaptorBase {
68  public:
69  template <typename U>
70  friend class edm::WorkerT;
71  template <typename U>
73 
75  ProducingModuleAdaptorBase(const ProducingModuleAdaptorBase&) = delete; // stop default
76  const ProducingModuleAdaptorBase& operator=(const ProducingModuleAdaptorBase&) = delete; // stop default
78 
79  // ---------- const member functions ---------------------
80 
81  // ---------- static member functions --------------------
82 
83  // ---------- member functions ---------------------------
85 
86  virtual bool wantsProcessBlocks() const = 0;
87  virtual bool wantsInputProcessBlocks() const = 0;
88  virtual bool wantsGlobalRuns() const = 0;
89  virtual bool wantsGlobalLuminosityBlocks() const = 0;
90  virtual bool hasAcquire() const = 0;
91  virtual bool hasAccumulator() const = 0;
92  bool wantsStreamRuns() const { return true; }
93  bool wantsStreamLuminosityBlocks() const { return true; }
94 
96 
97  void itemsToGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
98  void itemsMayGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
99  std::vector<ProductResolverIndexAndSkipBit> const& itemsToGetFrom(BranchType) const;
100 
101  std::vector<ESProxyIndex> const& esGetTokenIndicesVector(edm::Transition iTrans) const;
102  std::vector<ESRecordIndex> const& esGetTokenRecordIndicesVector(edm::Transition iTrans) const;
103 
104  void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const&, bool iPrefetchMayGet);
106  virtual void selectInputProcessBlocks(ProductRegistry const&, ProcessBlockHelperBase const&) = 0;
107 
108  void modulesWhoseProductsAreConsumed(std::array<std::vector<ModuleDescription const*>*, NumBranchTypes>& modules,
109  std::vector<ModuleProcessName>& modulesInPreviousProcesses,
110  ProductRegistry const& preg,
111  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
112  std::string const& processName) const;
113 
115 
116  std::vector<ConsumesInfo> consumesInfo() const;
117 
119  std::unordered_multimap<std::string, std::tuple<edm::TypeID const*, const char*, edm::ProductResolverIndex>>;
120 
121  void resolvePutIndicies(BranchType iBranchType,
122  ModuleToResolverIndicies const& iIndicies,
123  std::string const& moduleLabel);
124 
125  std::vector<edm::ProductResolverIndex> const& indiciesForPutProducts(BranchType iBranchType) const;
126 
127  protected:
128  template <typename F>
129  void createStreamModules(F iFunc) {
130  unsigned int iStreamModule = 0;
131  for (auto& m : m_streamModules) {
132  m = iFunc(iStreamModule);
133  m->setModuleDescriptionPtr(&moduleDescription_);
134  ++iStreamModule;
135  }
136  }
137 
138  void commit(ProcessBlock& iProcessBlock) {
140  }
143  template <typename I>
144  void commit(Event& iEvent, I* iID) {
146  }
147 
148  const EDConsumerBase* consumer() { return m_streamModules[0]; }
149 
150  const ProducerBase* producer() { return m_streamModules[0]; }
151 
152  private:
154  virtual void preallocLumis(unsigned int) {}
155  virtual void setupStreamModules() = 0;
156  virtual void doBeginJob() = 0;
157  virtual void doEndJob() = 0;
158 
159  void doBeginStream(StreamID);
160  void doEndStream(StreamID);
162  virtual void setupRun(T*, RunIndex) = 0;
164  virtual void streamEndRunSummary(T*, edm::Run const&, edm::EventSetup const&) = 0;
165 
167  virtual void setupLuminosityBlock(T*, LuminosityBlockIndex) = 0;
169  virtual void streamEndLuminosityBlockSummary(T*, edm::LuminosityBlock const&, edm::EventSetup const&) = 0;
170 
171  virtual void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0;
173  virtual void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0;
174  virtual void doBeginRun(RunTransitionInfo const&, ModuleCallingContext const*) = 0;
175  virtual void doEndRun(RunTransitionInfo const&, ModuleCallingContext const*) = 0;
176  virtual void doBeginLuminosityBlock(LumiTransitionInfo const&, ModuleCallingContext const*) = 0;
177  virtual void doEndLuminosityBlock(LumiTransitionInfo const&, ModuleCallingContext const*) = 0;
178 
181  virtual void doRespondToCloseOutputFile() = 0;
183 
184  // ---------- member data --------------------------------
187 
188  protected:
189  std::vector<T*> m_streamModules;
190  };
191  } // namespace stream
192 } // namespace edm
193 
194 #endif
edm::stream::ProducingModuleAdaptorBase::commit
void commit(Run &iRun)
Definition: ProducingModuleAdaptorBase.h:141
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:161
edm::stream::ProducingModuleAdaptorBase::streamEndLuminosityBlockSummary
virtual void streamEndLuminosityBlockSummary(T *, edm::LuminosityBlock const &, edm::EventSetup const &)=0
edm::stream::ProducingModuleAdaptorBase::itemsMayGet
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Definition: ProducingModuleAdaptorBase.cc:93
edm::stream::ProducingModuleAdaptorBase::modulesWhoseProductsAreConsumed
void modulesWhoseProductsAreConsumed(std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modules, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
Definition: ProducingModuleAdaptorBase.cc:121
edm::stream::ProducingModuleAdaptorBase::registerProductsAndCallbacks
void registerProductsAndCallbacks(ProducingModuleAdaptorBase const *, ProductRegistry *reg)
Definition: ProducingModuleAdaptorBase.cc:62
edm::stream::ProducingModuleAdaptorBase::doStreamBeginRun
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: ProducingModuleAdaptorBase.cc:185
edm::eventsetup::ESRecordsToProxyIndices
Definition: ESRecordsToProxyIndices.h:35
edm::stream::ProducingModuleAdaptorBase::doRespondToCloseOutputFile
virtual void doRespondToCloseOutputFile()=0
edm::stream::ProducingModuleAdaptorBase::itemsToGet
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Definition: ProducingModuleAdaptorBase.cc:86
edm::stream::ProducingModuleAdaptorBase::~ProducingModuleAdaptorBase
virtual ~ProducingModuleAdaptorBase()
Definition: ProducingModuleAdaptorBase.cc:44
edm::Run::commit_
void commit_(std::vector< edm::ProductResolverIndex > const &iShouldPut)
Definition: Run.cc:83
edm::LumiTransitionInfo
Definition: TransitionInfoTypes.h:42
edm::stream::ProducingModuleAdaptorBase::wantsInputProcessBlocks
virtual bool wantsInputProcessBlocks() const =0
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
edm::stream::ProducingModuleAdaptorBase::ProducingModuleAdaptorBase
ProducingModuleAdaptorBase()
Definition: ProducingModuleAdaptorBase.cc:41
modules
Definition: MuonCleanerBySegments.cc:35
LuminosityBlock.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::stream::ProducingModuleAdaptorBase::moduleDescription_
ModuleDescription moduleDescription_
Definition: ProducingModuleAdaptorBase.h:186
edm::stream::ProducingModuleAdaptorBase::updateLookup
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
Definition: ProducingModuleAdaptorBase.cc:146
ProcessBlock.h
ProductResolverIndex.h
edm::stream::ProducingModuleAdaptorBase::selectInputProcessBlocks
virtual void selectInputProcessBlocks(ProductRegistry const &, ProcessBlockHelperBase const &)=0
cms::cuda::stream
uint32_t const T *__restrict__ const uint32_t *__restrict__ int32_t int Histo::index_type cudaStream_t stream
Definition: HistoContainer.h:51
edm::stream::ProducingModuleAdaptorBase::m_streamModules
std::vector< T * > m_streamModules
Definition: ProducingModuleAdaptorBase.h:189
edm::stream::ProducingModuleAdaptorBase::doEndJob
virtual void doEndJob()=0
edm::stream::ProducingModuleAdaptorBase::indiciesForPutProducts
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts(BranchType iBranchType) const
Definition: ProducingModuleAdaptorBase.cc:170
mps_check.array
array
Definition: mps_check.py:216
edm::WorkerT
Definition: Frameworkfwd.h:63
edm::ProductResolverIndexHelper
Definition: ProductResolverIndexHelper.h:89
edm::RunTransitionInfo
Definition: TransitionInfoTypes.h:64
ESIndices.h
edm::InRun
Definition: BranchType.h:11
edm::ProcessBlockPrincipal
Definition: ProcessBlockPrincipal.h:22
edm::BranchType
BranchType
Definition: BranchType.h:11
edm::ModuleDescription
Definition: ModuleDescription.h:21
edm::NumBranchTypes
Definition: BranchType.h:11
edm::stream::ProducingModuleAdaptorBase::createStreamModules
void createStreamModules(F iFunc)
Definition: ProducingModuleAdaptorBase.h:129
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
edm::ProductRegistry
Definition: ProductRegistry.h:37
ModuleDescription.h
edm::stream::ProducingModuleAdaptorBase::doEndProcessBlock
virtual void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)=0
edm::FileBlock
Definition: FileBlock.h:22
edm::stream::ProducingModuleAdaptorBase::wantsGlobalLuminosityBlocks
virtual bool wantsGlobalLuminosityBlocks() const =0
edm::InProcess
Definition: BranchType.h:11
edm::EDConsumerBase
Definition: EDConsumerBase.h:71
edm::LuminosityBlockIndex
Definition: LuminosityBlockIndex.h:33
edm::stream::ProducingModuleAdaptorBase::doRespondToOpenInputFile
void doRespondToOpenInputFile(FileBlock const &)
Definition: ProducingModuleAdaptorBase.h:179
Exhume::I
const std::complex< double > I
Definition: I.h:8
edm::ProcessBlock::commit_
void commit_(std::vector< edm::ProductResolverIndex > const &iShouldPut)
Definition: ProcessBlock.cc:29
edm::stream::ProducingModuleAdaptorBase::doAccessInputProcessBlock
virtual void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)=0
edm::stream::ProducingModuleAdaptorBase::hasAccumulator
virtual bool hasAccumulator() const =0
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:79
edm::stream::ProducingModuleAdaptorBase::consumer
const EDConsumerBase * consumer()
Definition: ProducingModuleAdaptorBase.h:148
Run.h
edm::stream::ProducingModuleAdaptorBase::wantsProcessBlocks
virtual bool wantsProcessBlocks() const =0
Event
edm::stream::ProducingModuleAdaptorBase::doPreallocate
void doPreallocate(PreallocationConfiguration const &)
Definition: ProducingModuleAdaptorBase.cc:55
edm::stream::ProducingModuleAdaptorBase::preallocLumis
virtual void preallocLumis(unsigned int)
Definition: ProducingModuleAdaptorBase.h:154
edm::stream::ProducingModuleAdaptorBase::doEndLuminosityBlock
virtual void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)=0
edm::InEvent
Definition: BranchType.h:11
edm::maker::ModuleHolderT
Definition: EDAnalyzer.h:25
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
edm::stream::ProducingModuleAdaptorBase::producer
const ProducerBase * producer()
Definition: ProducingModuleAdaptorBase.h:150
edm::stream::ProducingModuleAdaptorBase::doEndRun
virtual void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)=0
edm::stream::ProducingModuleAdaptorBase::esGetTokenRecordIndicesVector
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector(edm::Transition iTrans) const
Definition: ProducingModuleAdaptorBase.cc:114
edm::stream::ProducingModuleAdaptorBase::doStreamEndRun
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: ProducingModuleAdaptorBase.cc:204
edm::ThinnedAssociationsHelper
Definition: ThinnedAssociationsHelper.h:37
edm::stream::ProducingModuleAdaptorBase::commit
void commit(LuminosityBlock &iLumi)
Definition: ProducingModuleAdaptorBase.h:142
edm::ProcessBlockHelperBase
Definition: ProcessBlockHelperBase.h:18
edm::Transition
Transition
Definition: Transition.h:12
Event.h
edm::InLumi
Definition: BranchType.h:11
edm::LuminosityBlock::commit_
void commit_(std::vector< edm::ProductResolverIndex > const &iShouldPut)
Definition: LuminosityBlock.cc:77
edm::stream::ProducingModuleAdaptorBase::setupLuminosityBlock
virtual void setupLuminosityBlock(T *, LuminosityBlockIndex)=0
ESRecordsToProxyIndices
edm::stream::ProducingModuleAdaptorBase::doRespondToCloseInputFile
void doRespondToCloseInputFile(FileBlock const &)
Definition: ProducingModuleAdaptorBase.h:180
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:119
BranchType.h
edm::stream::ProducingModuleAdaptorBase::esGetTokenIndicesVector
std::vector< ESProxyIndex > const & esGetTokenIndicesVector(edm::Transition iTrans) const
Definition: ProducingModuleAdaptorBase.cc:107
edm::stream::ProducingModuleAdaptorBase::wantsStreamRuns
bool wantsStreamRuns() const
Definition: ProducingModuleAdaptorBase.h:92
edm::EventSetup
Definition: EventSetup.h:58
edm::stream::ProducingModuleAdaptorBase
Definition: Event.h:70
edm::stream::ProducingModuleAdaptorBase::doRegisterThinnedAssociations
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: ProducingModuleAdaptorBase.cc:257
edm::stream::ProducingModuleAdaptorBase::itemsToGetFrom
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom(BranchType) const
Definition: ProducingModuleAdaptorBase.cc:100
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::stream::ProducingModuleAdaptorBase::setModuleDescription
void setModuleDescription(ModuleDescription const &md)
Definition: ProducingModuleAdaptorBase.h:185
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
edm::PreallocationConfiguration
Definition: PreallocationConfiguration.h:27
edm::stream::ProducingModuleAdaptorBase::wantsStreamLuminosityBlocks
bool wantsStreamLuminosityBlocks() const
Definition: ProducingModuleAdaptorBase.h:93
edm::stream::ProducingModuleAdaptorBase::doStreamEndLuminosityBlock
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: ProducingModuleAdaptorBase.cc:240
Frameworkfwd.h
T
long double T
Definition: Basic3DVectorLD.h:48
edm::stream::ProducingModuleAdaptorBase::doStreamBeginLuminosityBlock
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: ProducingModuleAdaptorBase.cc:221
ParameterSetfwd.h
edm::stream::ProducingModuleAdaptorBase::commit
void commit(Event &iEvent, I *iID)
Definition: ProducingModuleAdaptorBase.h:144
edm::RunIndex
Definition: RunIndex.h:32
edm::stream::ProducingModuleAdaptorBase::doBeginRun
virtual void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)=0
edm::stream::ProducingModuleAdaptorBase::doEndStream
void doEndStream(StreamID)
Definition: ProducingModuleAdaptorBase.cc:180
LuminosityBlockIndex.h
edm::stream::ProducingModuleAdaptorBase::consumesInfo
std::vector< ConsumesInfo > consumesInfo() const
Definition: ProducingModuleAdaptorBase.cc:140
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
edm::ProducerBase
Definition: ProducerBase.h:70
edm::stream::ProducingModuleAdaptorBase::moduleDescription
const ModuleDescription & moduleDescription() const
Definition: ProducingModuleAdaptorBase.h:84
edm::Event
Definition: Event.h:73
edm::stream::ProducingModuleAdaptorBase::doBeginStream
void doBeginStream(StreamID)
Definition: ProducingModuleAdaptorBase.cc:176
edm::stream::ProducingModuleAdaptorBase::doBeginLuminosityBlock
virtual void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)=0
edm::stream::ProducingModuleAdaptorBase::doBeginProcessBlock
virtual void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)=0
ConsumesInfo.h
StreamID.h
edm::ProcessBlock
Definition: ProcessBlock.h:36
edm::stream::ProducingModuleAdaptorBase::commit
void commit(ProcessBlock &iProcessBlock)
Definition: ProducingModuleAdaptorBase.h:138
edm::stream::ProducingModuleAdaptorBase::operator=
const ProducingModuleAdaptorBase & operator=(const ProducingModuleAdaptorBase &)=delete
FWCoreCommonFwd.h
edm::stream::ProducingModuleAdaptorBase::convertCurrentProcessAlias
void convertCurrentProcessAlias(std::string const &processName)
Definition: ProducingModuleAdaptorBase.cc:133
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29
edm::stream::ProducingModuleAdaptorBase::doBeginJob
virtual void doBeginJob()=0