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  virtual bool wantsGlobalRuns() const = 0;
76  virtual bool wantsGlobalLuminosityBlocks() const = 0;
77  bool wantsStreamRuns() const {return true;}
78  bool wantsStreamLuminosityBlocks() const {return true;}
79 
80  std::string workerType() const { return "WorkerT<EDAnalyzerAdaptorBase>";}
81  void
83  protected:
84  template<typename T> void createStreamModules(T iFunc) {
85  for(auto& m: m_streamModules) {
86  m = iFunc();
87  setModuleDescriptionPtr(m);
88  }
89  }
90 
91  //Same interface as EDConsumerBase
92  void itemsToGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
93  void itemsMayGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
94  std::vector<ProductResolverIndexAndSkipBit> const& itemsToGetFrom(BranchType) const;
95 
96  void updateLookup(BranchType iBranchType,
98  bool iPrefetchMayGet);
99 
100  const EDConsumerBase* consumer() const;
101 
102  void modulesWhoseProductsAreConsumed(std::vector<ModuleDescription const*>& modules,
103  ProductRegistry const& preg,
104  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
105  std::string const& processName) const;
106 
107  void convertCurrentProcessAlias(std::string const& processName);
108 
109  std::vector<ConsumesInfo> consumesInfo() const;
110 
111  private:
112  EDAnalyzerAdaptorBase(const EDAnalyzerAdaptorBase&) = delete; // stop default
113 
114  const EDAnalyzerAdaptorBase& operator=(const EDAnalyzerAdaptorBase&) = delete; // stop default
115 
116  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
118  ModuleCallingContext const*) ;
119  void doPreallocate(PreallocationConfiguration const&);
120  virtual void preallocLumis(unsigned int) {}
121 
122  //For now this is a placeholder
123  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
124 
125  virtual void setupStreamModules() = 0;
126  void doBeginJob();
127  virtual void doEndJob() = 0;
128 
129  void doBeginStream(StreamID id);
130  void doEndStream(StreamID id);
131  void doStreamBeginRun(StreamID id,
132  RunPrincipal const& ep,
133  EventSetup const& c,
134  ModuleCallingContext const*);
135  virtual void setupRun(EDAnalyzerBase*, RunIndex) = 0;
136  void doStreamEndRun(StreamID id,
137  RunPrincipal const& ep,
138  EventSetup const& c,
139  ModuleCallingContext const*);
140  virtual void streamEndRunSummary(EDAnalyzerBase*,edm::Run const&, edm::EventSetup const&) = 0;
141 
142  void doStreamBeginLuminosityBlock(StreamID id,
143  LuminosityBlockPrincipal const& ep,
144  EventSetup const& c,
145  ModuleCallingContext const*);
146  virtual void setupLuminosityBlock(EDAnalyzerBase*, LuminosityBlockIndex) = 0;
147  void doStreamEndLuminosityBlock(StreamID id,
148  LuminosityBlockPrincipal const& ep,
149  EventSetup const& c,
150  ModuleCallingContext const*);
151  virtual void streamEndLuminosityBlockSummary(EDAnalyzerBase*,edm::LuminosityBlock const&, edm::EventSetup const&) = 0;
152 
153  virtual void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
154  ModuleCallingContext const*)=0;
155  virtual void doEndRun(RunPrincipal const& rp, EventSetup const& c,
156  ModuleCallingContext const*)=0;
157  virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
158  ModuleCallingContext const*)=0;
159  virtual void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup 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);
167 
168  bool hasAcquire() const { return false; }
169  bool hasAccumulator() const { return false; }
170 
171  // ---------- member data --------------------------------
172  void setModuleDescriptionPtr(EDAnalyzerBase* m);
174  moduleDescription_ = md;
175  }
177 
178  std::vector<EDAnalyzerBase*> m_streamModules;
179  };
180  }
181 }
182 #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)
virtual void preallocLumis(unsigned int)
HLT enums.
long double T
Definition: Run.h:43