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 <array>
23 #include <map>
24 #include <string>
25 #include <vector>
26 #include <unordered_map>
27 
28 // user include files
44 
45 // forward declarations
46 
47 namespace edm {
48  class Event;
49  class ModuleCallingContext;
50  class ModuleProcessName;
51  class ProductResolverIndexHelper;
52  class EDConsumerBase;
53  class PreallocationConfiguration;
54  class ProductResolverIndexAndSkipBit;
55  class ThinnedAssociationsHelper;
56  class ActivityRegistry;
57  class WaitingTaskHolder;
58  class ServiceWeakToken;
59 
60  namespace maker {
61  template <typename T>
62  class ModuleHolderT;
63  }
64 
65  namespace eventsetup {
67  }
68 
69  namespace stream {
70  template <typename T>
71  class ProducingModuleAdaptorBase {
72  public:
73  template <typename U>
74  friend class edm::WorkerT;
75  template <typename U>
77 
79  ProducingModuleAdaptorBase(const ProducingModuleAdaptorBase&) = delete; // stop default
80  const ProducingModuleAdaptorBase& operator=(const ProducingModuleAdaptorBase&) = delete; // stop default
82 
83  // ---------- const member functions ---------------------
84 
85  // ---------- static member functions --------------------
86 
87  // ---------- member functions ---------------------------
89 
90  virtual bool wantsProcessBlocks() const = 0;
91  virtual bool wantsInputProcessBlocks() const = 0;
92  virtual bool wantsGlobalRuns() const = 0;
93  virtual bool wantsGlobalLuminosityBlocks() const = 0;
94  virtual bool hasAcquire() const = 0;
95  virtual bool hasAccumulator() const = 0;
96  bool wantsStreamRuns() const { return true; }
97  bool wantsStreamLuminosityBlocks() const { return true; }
98 
100 
101  void itemsToGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
102  void itemsMayGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
103  std::vector<ProductResolverIndexAndSkipBit> const& itemsToGetFrom(BranchType) const;
104 
105  std::vector<ESProxyIndex> const& esGetTokenIndicesVector(edm::Transition iTrans) const;
106  std::vector<ESRecordIndex> const& esGetTokenRecordIndicesVector(edm::Transition iTrans) const;
107 
108  void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const&, bool iPrefetchMayGet);
110  virtual void selectInputProcessBlocks(ProductRegistry const&, ProcessBlockHelperBase const&) = 0;
111 
112  void modulesWhoseProductsAreConsumed(std::array<std::vector<ModuleDescription const*>*, NumBranchTypes>& modules,
113  std::vector<ModuleProcessName>& modulesInPreviousProcesses,
114  ProductRegistry const& preg,
115  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
116  std::string const& processName) const;
117 
119 
120  std::vector<ConsumesInfo> consumesInfo() const;
121 
123  std::unordered_multimap<std::string, std::tuple<edm::TypeID const*, const char*, edm::ProductResolverIndex>>;
124 
125  void resolvePutIndicies(BranchType iBranchType,
126  ModuleToResolverIndicies const& iIndicies,
127  std::string const& moduleLabel);
128 
129  std::vector<edm::ProductResolverIndex> const& indiciesForPutProducts(BranchType iBranchType) const;
130 
131  ProductResolverIndex transformPrefetch_(size_t iTransformIndex) const;
132  size_t transformIndex_(edm::BranchDescription const& iBranch) const;
134  size_t iTransformIndex,
135  EventPrincipal const& iEvent,
137  ModuleCallingContext const*,
138  ServiceWeakToken const&);
139 
140  protected:
141  template <typename F>
142  void createStreamModules(F iFunc) {
143  unsigned int iStreamModule = 0;
144  for (auto& m : m_streamModules) {
145  m = iFunc(iStreamModule);
146  m->setModuleDescriptionPtr(&moduleDescription_);
147  ++iStreamModule;
148  }
149  }
150 
151  void commit(ProcessBlock& iProcessBlock) {
153  }
156  template <typename I>
157  void commit(Event& iEvent, I* iID) {
159  }
160 
161  const EDConsumerBase* consumer() { return m_streamModules[0]; }
162 
163  const ProducerBase* producer() { return m_streamModules[0]; }
164 
165  void deleteModulesEarly();
166 
167  private:
169  virtual void preallocRuns(unsigned int) {}
170  virtual void preallocLumis(unsigned int) {}
171  virtual void setupStreamModules() = 0;
172  virtual void doBeginJob() = 0;
173  virtual void doEndJob() = 0;
174 
175  void doBeginStream(StreamID);
176  void doEndStream(StreamID);
178  virtual void setupRun(T*, RunIndex) = 0;
180  virtual void streamEndRunSummary(T*, edm::Run const&, edm::EventSetup const&) = 0;
181 
183  virtual void setupLuminosityBlock(T*, LuminosityBlockIndex) = 0;
185  virtual void streamEndLuminosityBlockSummary(T*, edm::LuminosityBlock const&, edm::EventSetup const&) = 0;
186 
187  virtual void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0;
189  virtual void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0;
190  virtual void doBeginRun(RunTransitionInfo const&, ModuleCallingContext const*) = 0;
191  virtual void doEndRun(RunTransitionInfo const&, ModuleCallingContext const*) = 0;
192  virtual void doBeginLuminosityBlock(LumiTransitionInfo const&, ModuleCallingContext const*) = 0;
193  virtual void doEndLuminosityBlock(LumiTransitionInfo const&, ModuleCallingContext const*) = 0;
194 
197  virtual void doRespondToCloseOutputFile() = 0;
199 
200  // ---------- member data --------------------------------
203 
204  protected:
205  std::vector<T*> m_streamModules;
206  };
207  } // namespace stream
208 } // namespace edm
209 
210 #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
unsigned int ProductResolverIndex
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
void doTransformAsync(WaitingTaskHolder iTask, size_t iTransformIndex, EventPrincipal const &iEvent, ActivityRegistry *, ModuleCallingContext const *, ServiceWeakToken const &)
virtual void setupRun(T *, RunIndex)=0
size_t transformIndex_(edm::BranchDescription const &iBranch) const
void registerProductsAndCallbacks(ProducingModuleAdaptorBase const *, ProductRegistry *reg)
void commit_(std::vector< edm::ProductResolverIndex > const &iShouldPut)
Definition: Run.cc:85
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
ProductResolverIndex transformPrefetch_(size_t iTransformIndex) const
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