CMS 3D CMS Logo

EDAnalyzerAdaptorBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_stream_EDAnalyzerAdaptorBase_h
2 #define FWCore_Framework_stream_EDAnalyzerAdaptorBase_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : EDAnalyzerAdaptorBase
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 
27 // user include files
41 
42 // forward declarations
43 
44 namespace edm {
45  class ModuleCallingContext;
46  class ModuleProcessName;
47  class ProductResolverIndexHelper;
48  class EDConsumerBase;
49  class PreallocationConfiguration;
50  class ProductResolverIndexAndSkipBit;
51  class ActivityRegistry;
52  class ThinnedAssociationsHelper;
53 
54  namespace maker {
55  template <typename T>
56  class ModuleHolderT;
57  }
58 
59  namespace eventsetup {
61  }
62 
63  namespace stream {
64  class EDAnalyzerBase;
65 
67  public:
68  template <typename T>
69  friend class edm::WorkerT;
70  template <typename T>
72 
74  EDAnalyzerAdaptorBase(const EDAnalyzerAdaptorBase&) = delete; // stop default
75  const EDAnalyzerAdaptorBase& operator=(const EDAnalyzerAdaptorBase&) = delete; // stop default
76  virtual ~EDAnalyzerAdaptorBase();
77 
78  // ---------- const member functions ---------------------
79 
80  // ---------- static member functions --------------------
81 
82  // ---------- member functions ---------------------------
84 
85  virtual bool wantsProcessBlocks() const noexcept = 0;
86  virtual bool wantsInputProcessBlocks() const noexcept = 0;
87  virtual bool wantsGlobalRuns() const noexcept = 0;
88  virtual bool wantsGlobalLuminosityBlocks() const noexcept = 0;
89  virtual bool wantsStreamRuns() const noexcept = 0;
90  virtual bool wantsStreamLuminosityBlocks() const noexcept = 0;
91 
92  std::string workerType() const { return "WorkerT<EDAnalyzerAdaptorBase>"; }
94 
95  protected:
96  template <typename T>
97  void createStreamModules(T iFunc) {
98  unsigned int iStreamModule = 0;
99  for (auto& m : m_streamModules) {
100  m = iFunc(iStreamModule);
102  ++iStreamModule;
103  }
104  }
105 
106  //Same interface as EDConsumerBase
107  void itemsToGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
108  void itemsMayGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
109  std::vector<ProductResolverIndexAndSkipBit> const& itemsToGetFrom(BranchType) const;
110 
111  std::vector<ESResolverIndex> const& esGetTokenIndicesVector(edm::Transition iTrans) const;
112  std::vector<ESRecordIndex> const& esGetTokenRecordIndicesVector(edm::Transition iTrans) const;
113 
114  void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const&, bool iPrefetchMayGet);
116  virtual void selectInputProcessBlocks(ProductRegistry const&, ProcessBlockHelperBase const&) = 0;
117 
118  const EDConsumerBase* consumer() const;
119 
120  void modulesWhoseProductsAreConsumed(std::array<std::vector<ModuleDescription const*>*, NumBranchTypes>& modules,
121  std::vector<ModuleProcessName>& modulesInPreviousProcesses,
122  ProductRegistry const& preg,
123  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
124  std::string const& processName) const;
125 
127 
128  std::vector<ConsumesInfo> consumesInfo() const;
129 
130  void deleteModulesEarly();
131 
132  private:
135  virtual void preallocRuns(unsigned int) {}
136  virtual void preallocLumis(unsigned int) {}
137 
138  //For now this is a placeholder
140  ModuleCallingContext const&,
141  Principal const&) const noexcept {}
142 
143  virtual void setupStreamModules() = 0;
144  virtual void doBeginJob() = 0;
145  virtual void doEndJob() = 0;
146 
147  void doBeginStream(StreamID id);
148  void doEndStream(StreamID id);
150  virtual void setupRun(EDAnalyzerBase*, RunIndex) = 0;
152  virtual void streamEndRunSummary(EDAnalyzerBase*, edm::Run const&, edm::EventSetup const&) = 0;
153 
158  edm::LuminosityBlock const&,
159  edm::EventSetup const&) = 0;
160 
161  virtual void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0;
163  virtual void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0;
164  virtual void doBeginRun(RunTransitionInfo const&, ModuleCallingContext const*) = 0;
165  virtual void doEndRun(RunTransitionInfo const&, ModuleCallingContext const*) = 0;
166  virtual void doBeginLuminosityBlock(LumiTransitionInfo const&, ModuleCallingContext const*) = 0;
167  virtual void doEndLuminosityBlock(LumiTransitionInfo const&, ModuleCallingContext const*) = 0;
168 
171  virtual void doRespondToCloseOutputFile() = 0;
173 
174  bool hasAcquire() const noexcept { return false; }
175  bool hasAccumulator() const noexcept { return false; }
176 
177  // ---------- member data --------------------------------
181 
182  std::vector<EDAnalyzerBase*> m_streamModules;
183  };
184  } // namespace stream
185 } // namespace edm
186 #endif
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
void registerProductsAndCallbacks(EDAnalyzerAdaptorBase const *, ProductRegistry *reg)
void preActionBeforeRunEventAsync(WaitingTaskHolder, ModuleCallingContext const &, Principal const &) const noexcept
std::vector< ConsumesInfo > consumesInfo() const
virtual bool wantsStreamLuminosityBlocks() const noexcept=0
virtual void preallocRuns(unsigned int)
virtual void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)=0
std::vector< EDAnalyzerBase * > m_streamModules
void doPreallocate(PreallocationConfiguration const &)
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)=0
virtual bool wantsProcessBlocks() const noexcept=0
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
const EDAnalyzerAdaptorBase & operator=(const EDAnalyzerAdaptorBase &)=delete
virtual void setupLuminosityBlock(EDAnalyzerBase *, LuminosityBlockIndex)=0
BranchType
Definition: BranchType.h:11
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
virtual void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)=0
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
void convertCurrentProcessAlias(std::string const &processName)
virtual bool wantsGlobalRuns() const noexcept=0
const EDConsumerBase * consumer() const
const ModuleDescription & moduleDescription() const
virtual bool wantsInputProcessBlocks() const noexcept=0
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom(BranchType) const
virtual void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)=0
Transition
Definition: Transition.h:12
virtual void streamEndLuminosityBlockSummary(EDAnalyzerBase *, edm::LuminosityBlock const &, edm::EventSetup const &)=0
void setModuleDescription(ModuleDescription const &md)
virtual void setupRun(EDAnalyzerBase *, RunIndex)=0
virtual void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)=0
void doRespondToOpenInputFile(FileBlock const &)
virtual void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)=0
void doRespondToCloseInputFile(FileBlock const &)
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
virtual bool wantsGlobalLuminosityBlocks() const noexcept=0
virtual void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)=0
virtual void preallocLumis(unsigned int)
HLT enums.
virtual void doRespondToCloseOutputFile()=0
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector(edm::Transition iTrans) const
virtual void selectInputProcessBlocks(ProductRegistry const &, ProcessBlockHelperBase const &)=0
virtual bool wantsStreamRuns() const noexcept=0
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
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
std::vector< ESResolverIndex > const & esGetTokenIndicesVector(edm::Transition iTrans) const
virtual void streamEndRunSummary(EDAnalyzerBase *, edm::Run const &, edm::EventSetup const &)=0
long double T
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
Definition: Run.h:45
void setModuleDescriptionPtr(EDAnalyzerBase *m)