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 <map>
23 #include <string>
24 #include <vector>
25 
26 // user include files
36 
37 
38 // forward declarations
39 
40 namespace edm {
41  class ModuleCallingContext;
42  class ProductResolverIndexHelper;
43  class EDConsumerBase;
44  class PreallocationConfiguration;
45  class ProductResolverIndexAndSkipBit;
46  class ActivityRegistry;
47  class ProductRegistry;
48  class ThinnedAssociationsHelper;
49  class WaitingTask;
50 
51  namespace maker {
52  template<typename T> class ModuleHolderT;
53  }
54 
55  namespace stream {
56  class EDAnalyzerBase;
57 
59  {
60 
61  public:
62  template <typename T> friend class edm::WorkerT;
63  template <typename T> friend class edm::maker::ModuleHolderT;
64 
66  virtual ~EDAnalyzerAdaptorBase();
67 
68  // ---------- const member functions ---------------------
69 
70  // ---------- static member functions --------------------
71 
72  // ---------- member functions ---------------------------
73  const ModuleDescription& moduleDescription() const { return moduleDescription_;}
74 
75  std::string workerType() const { return "WorkerT<EDAnalyzerAdaptorBase>";}
76  void
78  protected:
79  template<typename T> void createStreamModules(T iFunc) {
80  for(auto& m: m_streamModules) {
81  m = iFunc();
82  setModuleDescriptionPtr(m);
83  }
84  }
85 
86  //Same interface as EDConsumerBase
87  void itemsToGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
88  void itemsMayGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
89  std::vector<ProductResolverIndexAndSkipBit> const& itemsToGetFrom(BranchType) const;
90 
91  void updateLookup(BranchType iBranchType,
93  bool iPrefetchMayGet);
94 
95  const EDConsumerBase* consumer() const;
96 
97  void modulesWhoseProductsAreConsumed(std::vector<ModuleDescription const*>& modules,
98  ProductRegistry const& preg,
99  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
100  std::string const& processName) const;
101 
102  void convertCurrentProcessAlias(std::string const& processName);
103 
104  std::vector<ConsumesInfo> consumesInfo() const;
105 
106  private:
107  EDAnalyzerAdaptorBase(const EDAnalyzerAdaptorBase&) = delete; // stop default
108 
109  const EDAnalyzerAdaptorBase& operator=(const EDAnalyzerAdaptorBase&) = delete; // stop default
110 
111  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
113  ModuleCallingContext const*) ;
114  void doPreallocate(PreallocationConfiguration const&);
115 
116  //For now this is a placeholder
117  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
118 
119  virtual void setupStreamModules() = 0;
120  void doBeginJob();
121  virtual void doEndJob() = 0;
122 
123  void doBeginStream(StreamID id);
124  void doEndStream(StreamID id);
125  void doStreamBeginRun(StreamID id,
126  RunPrincipal const& ep,
127  EventSetup const& c,
128  ModuleCallingContext const*);
129  virtual void setupRun(EDAnalyzerBase*, RunIndex) = 0;
130  void doStreamEndRun(StreamID id,
131  RunPrincipal const& ep,
132  EventSetup const& c,
133  ModuleCallingContext const*);
134  virtual void streamEndRunSummary(EDAnalyzerBase*,edm::Run const&, edm::EventSetup const&) = 0;
135 
136  void doStreamBeginLuminosityBlock(StreamID id,
137  LuminosityBlockPrincipal const& ep,
138  EventSetup const& c,
139  ModuleCallingContext const*);
140  virtual void setupLuminosityBlock(EDAnalyzerBase*, LuminosityBlockIndex) = 0;
141  void doStreamEndLuminosityBlock(StreamID id,
142  LuminosityBlockPrincipal const& ep,
143  EventSetup const& c,
144  ModuleCallingContext const*);
145  virtual void streamEndLuminosityBlockSummary(EDAnalyzerBase*,edm::LuminosityBlock const&, edm::EventSetup const&) = 0;
146 
147  virtual void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
148  ModuleCallingContext const*)=0;
149  virtual void doEndRun(RunPrincipal const& rp, EventSetup const& c,
150  ModuleCallingContext const*)=0;
151  virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
152  ModuleCallingContext const*)=0;
153  virtual void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
154  ModuleCallingContext const*)=0;
155 
156  //For now, the following are just dummy implemenations with no ability for users to override
157  void doRespondToOpenInputFile(FileBlock const& fb);
158  void doRespondToCloseInputFile(FileBlock const& fb);
161 
162  // ---------- member data --------------------------------
163  void setModuleDescriptionPtr(EDAnalyzerBase* m);
165  moduleDescription_ = md;
166  }
168 
169  std::vector<EDAnalyzerBase*> m_streamModules;
170  };
171  }
172 }
173 #endif
void registerProductsAndCallbacks(ProductRegistry *iReg) override
Definition: ModuleHolder.h:76
std::vector< EDAnalyzerBase * > m_streamModules
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
BranchType
Definition: BranchType.h:11
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
const ModuleDescription & moduleDescription() const
void setModuleDescription(ModuleDescription const &md)
HLT enums.
long double T
Definition: Run.h:43