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& itemsToGetFromEvent() 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  std::vector<ConsumesInfo> consumesInfo() const;
103 
104  private:
105  EDAnalyzerAdaptorBase(const EDAnalyzerAdaptorBase&); // stop default
106 
107  const EDAnalyzerAdaptorBase& operator=(const EDAnalyzerAdaptorBase&); // stop default
108 
109  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
111  ModuleCallingContext const*) ;
112  void doPreallocate(PreallocationConfiguration const&);
113 
114  //For now this is a placeholder
115  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
116 
117  virtual void setupStreamModules() = 0;
118  void doBeginJob();
119  virtual void doEndJob() = 0;
120 
121  void doBeginStream(StreamID id);
122  void doEndStream(StreamID id);
123  void doStreamBeginRun(StreamID id,
124  RunPrincipal const& ep,
125  EventSetup const& c,
126  ModuleCallingContext const*);
127  virtual void setupRun(EDAnalyzerBase*, RunIndex) = 0;
128  void doStreamEndRun(StreamID id,
129  RunPrincipal const& ep,
130  EventSetup const& c,
131  ModuleCallingContext const*);
132  virtual void streamEndRunSummary(EDAnalyzerBase*,edm::Run const&, edm::EventSetup const&) = 0;
133 
134  void doStreamBeginLuminosityBlock(StreamID id,
135  LuminosityBlockPrincipal const& ep,
136  EventSetup const& c,
137  ModuleCallingContext const*);
138  virtual void setupLuminosityBlock(EDAnalyzerBase*, LuminosityBlockIndex) = 0;
139  void doStreamEndLuminosityBlock(StreamID id,
140  LuminosityBlockPrincipal const& ep,
141  EventSetup const& c,
142  ModuleCallingContext const*);
143  virtual void streamEndLuminosityBlockSummary(EDAnalyzerBase*,edm::LuminosityBlock const&, edm::EventSetup const&) = 0;
144 
145  virtual void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
146  ModuleCallingContext const*)=0;
147  virtual void doEndRun(RunPrincipal const& rp, EventSetup const& c,
148  ModuleCallingContext const*)=0;
149  virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
150  ModuleCallingContext const*)=0;
151  virtual void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
152  ModuleCallingContext const*)=0;
153 
154  void doPreForkReleaseResources();
155  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
156 
157  //For now, the following are just dummy implemenations with no ability for users to override
158  void doRespondToOpenInputFile(FileBlock const& fb);
159  void doRespondToCloseInputFile(FileBlock const& fb);
162 
163  // ---------- member data --------------------------------
164  void setModuleDescriptionPtr(EDAnalyzerBase* m);
166  moduleDescription_ = md;
167  }
169 
170  std::vector<EDAnalyzerBase*> m_streamModules;
171  };
172  }
173 }
174 #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:42