CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 <map>
23 #include <string>
24 #include <vector>
25 
26 // user include files
40 
41 // forward declarations
42 
43 namespace edm {
44  class ModuleCallingContext;
45  class ModuleProcessName;
46  class ProductResolverIndexHelper;
47  class EDConsumerBase;
48  class PreallocationConfiguration;
49  class ProductResolverIndexAndSkipBit;
50  class ActivityRegistry;
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  class EDAnalyzerBase;
64 
66  public:
67  template <typename T>
68  friend class edm::WorkerT;
69  template <typename T>
71 
73  EDAnalyzerAdaptorBase(const EDAnalyzerAdaptorBase&) = delete; // stop default
74  const EDAnalyzerAdaptorBase& operator=(const EDAnalyzerAdaptorBase&) = delete; // stop default
75  virtual ~EDAnalyzerAdaptorBase();
76 
77  // ---------- const member functions ---------------------
78 
79  // ---------- static member functions --------------------
80 
81  // ---------- member functions ---------------------------
83 
84  virtual bool wantsProcessBlocks() const = 0;
85  virtual bool wantsInputProcessBlocks() const = 0;
86  virtual bool wantsGlobalRuns() const = 0;
87  virtual bool wantsGlobalLuminosityBlocks() const = 0;
88  bool wantsStreamRuns() const { return true; }
89  bool wantsStreamLuminosityBlocks() const { return true; }
90 
91  std::string workerType() const { return "WorkerT<EDAnalyzerAdaptorBase>"; }
93 
94  protected:
95  template <typename T>
96  void createStreamModules(T iFunc) {
97  unsigned int iStreamModule = 0;
98  for (auto& m : m_streamModules) {
99  m = iFunc(iStreamModule);
101  ++iStreamModule;
102  }
103  }
104 
105  //Same interface as EDConsumerBase
106  void itemsToGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
107  void itemsMayGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
108  std::vector<ProductResolverIndexAndSkipBit> const& itemsToGetFrom(BranchType) const;
109 
110  std::vector<ESProxyIndex> const& esGetTokenIndicesVector(edm::Transition iTrans) const;
111  std::vector<ESRecordIndex> const& esGetTokenRecordIndicesVector(edm::Transition iTrans) const;
112 
113  void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const&, bool iPrefetchMayGet);
115  virtual void selectInputProcessBlocks(ProductRegistry const&, ProcessBlockHelperBase const&) = 0;
116 
117  const EDConsumerBase* consumer() const;
118 
119  void modulesWhoseProductsAreConsumed(std::array<std::vector<ModuleDescription const*>*, NumBranchTypes>& modules,
120  std::vector<ModuleProcessName>& modulesInPreviousProcesses,
121  ProductRegistry const& preg,
122  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
123  std::string const& processName) const;
124 
126 
127  std::vector<ConsumesInfo> consumesInfo() const;
128 
129  void deleteModulesEarly();
130 
131  private:
134  virtual void preallocLumis(unsigned int) {}
135 
136  //For now this is a placeholder
138  ModuleCallingContext const&,
139  Principal const&) const {}
140 
141  virtual void setupStreamModules() = 0;
142  virtual void doBeginJob() = 0;
143  virtual void doEndJob() = 0;
144 
145  void doBeginStream(StreamID id);
146  void doEndStream(StreamID id);
148  virtual void setupRun(EDAnalyzerBase*, RunIndex) = 0;
150  virtual void streamEndRunSummary(EDAnalyzerBase*, edm::Run const&, edm::EventSetup const&) = 0;
151 
156  edm::LuminosityBlock const&,
157  edm::EventSetup const&) = 0;
158 
159  virtual void doBeginProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0;
161  virtual void doEndProcessBlock(ProcessBlockPrincipal const&, ModuleCallingContext const*) = 0;
162  virtual void doBeginRun(RunTransitionInfo const&, ModuleCallingContext const*) = 0;
163  virtual void doEndRun(RunTransitionInfo const&, ModuleCallingContext const*) = 0;
164  virtual void doBeginLuminosityBlock(LumiTransitionInfo const&, ModuleCallingContext const*) = 0;
165  virtual void doEndLuminosityBlock(LumiTransitionInfo const&, ModuleCallingContext const*) = 0;
166 
169  virtual void doRespondToCloseOutputFile() = 0;
171 
172  bool hasAcquire() const { return false; }
173  bool hasAccumulator() const { return false; }
174 
175  // ---------- member data --------------------------------
179 
180  std::vector<EDAnalyzerBase*> m_streamModules;
181  };
182  } // namespace stream
183 } // namespace edm
184 #endif
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
void registerProductsAndCallbacks(EDAnalyzerAdaptorBase const *, ProductRegistry *reg)
tuple array
Definition: mps_check.py:216
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom(BranchType) const
virtual void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)=0
std::vector< EDAnalyzerBase * > m_streamModules
const EDConsumerBase * consumer() const
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
std::vector< ConsumesInfo > consumesInfo() const
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 bool wantsInputProcessBlocks() const =0
virtual void setupLuminosityBlock(EDAnalyzerBase *, LuminosityBlockIndex)=0
BranchType
Definition: BranchType.h:11
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)=0
void preActionBeforeRunEventAsync(WaitingTaskHolder, ModuleCallingContext const &, Principal const &) const
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
void convertCurrentProcessAlias(std::string const &processName)
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
virtual void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)=0
Transition
Definition: Transition.h:12
virtual bool wantsGlobalLuminosityBlocks() const =0
virtual void streamEndLuminosityBlockSummary(EDAnalyzerBase *, edm::LuminosityBlock const &, edm::EventSetup const &)=0
const ModuleDescription & moduleDescription() const
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
virtual bool wantsProcessBlocks() const =0
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector(edm::Transition iTrans) const
std::vector< ESProxyIndex > const & esGetTokenIndicesVector(edm::Transition iTrans) const
void doRespondToCloseInputFile(FileBlock const &)
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
virtual void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)=0
virtual void preallocLumis(unsigned int)
virtual void doRespondToCloseOutputFile()=0
virtual void selectInputProcessBlocks(ProductRegistry const &, ProcessBlockHelperBase const &)=0
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
virtual void streamEndRunSummary(EDAnalyzerBase *, edm::Run const &, edm::EventSetup const &)=0
preg
Definition: Schedule.cc:687
long double T
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
virtual bool wantsGlobalRuns() const =0
Definition: Run.h:45
void setModuleDescriptionPtr(EDAnalyzerBase *m)
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const