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