CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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
36 
37 
38 // forward declarations
39 
40 namespace edm {
41  class ModuleCallingContext;
42  class ProductHolderIndexHelper;
43  class EDConsumerBase;
44  class PreallocationConfiguration;
45  class ProductHolderIndexAndSkipBit;
46  class ActivityRegistry;
47  class ProductRegistry;
48  class ThinnedAssociationsHelper;
49 
50  namespace maker {
51  template<typename T> class ModuleHolderT;
52  }
53 
54  namespace stream {
55  class EDAnalyzerBase;
56 
58  {
59 
60  public:
61  template <typename T> friend class edm::WorkerT;
62  template <typename T> friend class edm::maker::ModuleHolderT;
63 
65  virtual ~EDAnalyzerAdaptorBase();
66 
67  // ---------- const member functions ---------------------
68 
69  // ---------- static member functions --------------------
70 
71  // ---------- member functions ---------------------------
73 
74  std::string workerType() const { return "WorkerT<EDAnalyzerAdaptorBase>";}
75  void
77  protected:
78  template<typename T> void createStreamModules(T iFunc) {
79  for(auto& m: m_streamModules) {
80  m = iFunc();
81  }
82  }
83 
84  //Same interface as EDConsumerBase
85  void itemsToGet(BranchType, std::vector<ProductHolderIndexAndSkipBit>&) const;
86  void itemsMayGet(BranchType, std::vector<ProductHolderIndexAndSkipBit>&) const;
87  std::vector<ProductHolderIndexAndSkipBit> const& itemsToGetFromEvent() const;
88 
89  void updateLookup(BranchType iBranchType,
91 
92  const EDConsumerBase* consumer() const;
93 
94  void modulesDependentUpon(const std::string& iProcessName,
95  std::vector<const char*>& oModuleLabels) 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& ep, EventSetup const& c,
111  ModuleCallingContext const*) ;
113 
114  virtual void setupStreamModules() = 0;
115  void doBeginJob();
116  virtual void doEndJob() = 0;
117 
118  void doBeginStream(StreamID id);
119  void doEndStream(StreamID id);
120  void doStreamBeginRun(StreamID id,
121  RunPrincipal& ep,
122  EventSetup const& c,
123  ModuleCallingContext const*);
124  virtual void setupRun(EDAnalyzerBase*, RunIndex) = 0;
125  void doStreamEndRun(StreamID id,
126  RunPrincipal& ep,
127  EventSetup const& c,
128  ModuleCallingContext const*);
129  virtual void streamEndRunSummary(EDAnalyzerBase*,edm::Run const&, edm::EventSetup const&) = 0;
130 
133  EventSetup const& c,
134  ModuleCallingContext const*);
138  EventSetup const& c,
139  ModuleCallingContext const*);
141 
142  virtual void doBeginRun(RunPrincipal& rp, EventSetup const& c,
143  ModuleCallingContext const*)=0;
144  virtual void doEndRun(RunPrincipal& rp, EventSetup const& c,
145  ModuleCallingContext const*)=0;
147  ModuleCallingContext const*)=0;
148  virtual void doEndLuminosityBlock(LuminosityBlockPrincipal& lbp, EventSetup const& c,
149  ModuleCallingContext const*)=0;
150 
152  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
153 
154  //For now, the following are just dummy implemenations with no ability for users to override
159 
160  // ---------- member data --------------------------------
163  }
165 
166  std::vector<EDAnalyzerBase*> m_streamModules;
167  };
168  }
169 }
170 #endif
void registerProductsAndCallbacks(EDAnalyzerAdaptorBase const *, ProductRegistry *reg)
void doRespondToCloseInputFile(FileBlock const &fb)
std::vector< EDAnalyzerBase * > m_streamModules
void doStreamEndRun(StreamID id, RunPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
const EDConsumerBase * consumer() const
void itemsMayGet(BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
void doPreallocate(PreallocationConfiguration const &)
void modulesDependentUpon(const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
std::vector< ConsumesInfo > consumesInfo() const
bool doEvent(EventPrincipal &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
virtual void setupLuminosityBlock(EDAnalyzerBase *, LuminosityBlockIndex)=0
BranchType
Definition: BranchType.h:11
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
void updateLookup(BranchType iBranchType, ProductHolderIndexHelper const &)
const EDAnalyzerAdaptorBase & operator=(const EDAnalyzerAdaptorBase &)
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
void doStreamBeginRun(StreamID id, RunPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
virtual void doBeginRun(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *)=0
virtual void doEndRun(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *)=0
virtual void streamEndLuminosityBlockSummary(EDAnalyzerBase *, edm::LuminosityBlock const &, edm::EventSetup const &)=0
void setModuleDescription(ModuleDescription const &md)
virtual void setupRun(EDAnalyzerBase *, RunIndex)=0
virtual void doEndLuminosityBlock(LuminosityBlockPrincipal &lbp, EventSetup const &c, ModuleCallingContext const *)=0
const ModuleDescription & moduleDescription()
virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal &lbp, EventSetup const &c, ModuleCallingContext const *)=0
void modulesWhoseProductsAreConsumed(std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
virtual void streamEndRunSummary(EDAnalyzerBase *, edm::Run const &, edm::EventSetup const &)=0
preg
Definition: Schedule.cc:370
long double T
std::vector< ProductHolderIndexAndSkipBit > const & itemsToGetFromEvent() const
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: Run.h:41
void itemsToGet(BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const