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  void deleteModulesEarly();
153 
154  private:
156  virtual void preallocLumis(unsigned int) {}
157  virtual void setupStreamModules() = 0;
158  virtual void doBeginJob() = 0;
159  virtual void doEndJob() = 0;
160 
161  void doBeginStream(StreamID);
162  void doEndStream(StreamID);
164  virtual void setupRun(T*, RunIndex) = 0;
166  virtual void streamEndRunSummary(T*, edm::Run const&, edm::EventSetup const&) = 0;
167 
169  virtual void setupLuminosityBlock(T*, LuminosityBlockIndex) = 0;
171  virtual void streamEndLuminosityBlockSummary(T*, edm::LuminosityBlock const&, edm::EventSetup const&) = 0;
172 
173  virtual void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0;
175  virtual void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0;
176  virtual void doBeginRun(RunTransitionInfo const&, ModuleCallingContext const*) = 0;
177  virtual void doEndRun(RunTransitionInfo const&, ModuleCallingContext const*) = 0;
178  virtual void doBeginLuminosityBlock(LumiTransitionInfo const&, ModuleCallingContext const*) = 0;
179  virtual void doEndLuminosityBlock(LumiTransitionInfo const&, ModuleCallingContext const*) = 0;
180 
183  virtual void doRespondToCloseOutputFile() = 0;
185 
186  // ---------- member data --------------------------------
189 
190  protected:
191  std::vector<T*> m_streamModules;
192  };
193  } // namespace stream
194 } // namespace edm
195 
196 #endif
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void selectInputProcessBlocks(ProductRegistry const &, ProcessBlockHelperBase const &)=0
virtual void streamEndRunSummary(T *, edm::Run const &, edm::EventSetup const &)=0
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom(BranchType) const
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector(edm::Transition iTrans) const
const ModuleDescription & moduleDescription() const
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
void commit_(std::vector< edm::ProductResolverIndex > const &iShouldPut)
Definition: ProcessBlock.cc:29
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
virtual void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)=0
void doPreallocate(PreallocationConfiguration const &)
virtual void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)=0
BranchType
Definition: BranchType.h:11
virtual void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)=0
virtual bool hasAccumulator() const =0
virtual bool wantsGlobalLuminosityBlocks() const =0
int iEvent
Definition: GenABIO.cc:224
virtual void setupRun(T *, RunIndex)=0
void registerProductsAndCallbacks(ProducingModuleAdaptorBase const *, ProductRegistry *reg)
void commit_(std::vector< edm::ProductResolverIndex > const &iShouldPut)
Definition: Run.cc:83
void setModuleDescription(ModuleDescription const &md)
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
virtual void streamEndLuminosityBlockSummary(T *, edm::LuminosityBlock const &, edm::EventSetup const &)=0
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
const ProducingModuleAdaptorBase & operator=(const ProducingModuleAdaptorBase &)=delete
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
virtual void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)=0
std::vector< ESProxyIndex > const & esGetTokenIndicesVector(edm::Transition iTrans) const
Transition
Definition: Transition.h:12
const std::complex< double > I
Definition: I.h:8
virtual void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)=0
virtual bool wantsInputProcessBlocks() const =0
virtual void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)=0
virtual bool wantsProcessBlocks() const =0
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts(BranchType iBranchType) const
void convertCurrentProcessAlias(std::string const &processName)
virtual void setupLuminosityBlock(T *, LuminosityBlockIndex)=0
void resolvePutIndicies(BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
virtual void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)=0
virtual bool wantsGlobalRuns() const =0
HLT enums.
std::vector< ConsumesInfo > consumesInfo() const
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
virtual bool hasAcquire() const =0
long double T
std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > > ModuleToResolverIndicies
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
void commit_(std::vector< edm::ProductResolverIndex > const &iShouldPut)
Definition: Run.h:45