test
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 ProductResolverIndexHelper;
43  class EDConsumerBase;
44  class PreallocationConfiguration;
45  class ProductResolverIndexAndSkipBit;
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();
82  }
83  }
84 
85  //Same interface as EDConsumerBase
86  void itemsToGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
87  void itemsMayGet(BranchType, std::vector<ProductResolverIndexAndSkipBit>&) const;
88  std::vector<ProductResolverIndexAndSkipBit> const& itemsToGetFromEvent() const;
89 
90  void updateLookup(BranchType iBranchType,
92  bool iPrefetchMayGet);
93 
94  const EDConsumerBase* consumer() const;
95 
96  void modulesWhoseProductsAreConsumed(std::vector<ModuleDescription const*>& modules,
97  ProductRegistry const& preg,
98  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
99  std::string const& processName) const;
100 
101  std::vector<ConsumesInfo> consumesInfo() const;
102 
103  private:
104  EDAnalyzerAdaptorBase(const EDAnalyzerAdaptorBase&); // stop default
105 
106  const EDAnalyzerAdaptorBase& operator=(const EDAnalyzerAdaptorBase&); // stop default
107 
108  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
110  ModuleCallingContext const*) ;
112 
113  virtual void setupStreamModules() = 0;
114  void doBeginJob();
115  virtual void doEndJob() = 0;
116 
117  void doBeginStream(StreamID id);
118  void doEndStream(StreamID id);
119  void doStreamBeginRun(StreamID id,
120  RunPrincipal const& ep,
121  EventSetup const& c,
122  ModuleCallingContext const*);
123  virtual void setupRun(EDAnalyzerBase*, RunIndex) = 0;
124  void doStreamEndRun(StreamID id,
125  RunPrincipal const& ep,
126  EventSetup const& c,
127  ModuleCallingContext const*);
128  virtual void streamEndRunSummary(EDAnalyzerBase*,edm::Run const&, edm::EventSetup const&) = 0;
129 
131  LuminosityBlockPrincipal const& ep,
132  EventSetup const& c,
133  ModuleCallingContext const*);
136  LuminosityBlockPrincipal const& ep,
137  EventSetup const& c,
138  ModuleCallingContext const*);
140 
141  virtual void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
142  ModuleCallingContext const*)=0;
143  virtual void doEndRun(RunPrincipal const& rp, EventSetup const& c,
144  ModuleCallingContext const*)=0;
145  virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
146  ModuleCallingContext const*)=0;
147  virtual void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
148  ModuleCallingContext const*)=0;
149 
151  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
152 
153  //For now, the following are just dummy implemenations with no ability for users to override
158 
159  // ---------- member data --------------------------------
162  moduleDescription_ = md;
163  }
165 
166  std::vector<EDAnalyzerBase*> m_streamModules;
167  };
168  }
169 }
170 #endif
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
void registerProductsAndCallbacks(EDAnalyzerAdaptorBase const *, ProductRegistry *reg)
virtual void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)=0
void doRespondToCloseInputFile(FileBlock const &fb)
bool doEvent(EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
std::vector< EDAnalyzerBase * > m_streamModules
const EDConsumerBase * consumer() const
void doPreallocate(PreallocationConfiguration const &)
virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)=0
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
std::vector< ConsumesInfo > consumesInfo() const
virtual void doEndRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)=0
virtual void setupLuminosityBlock(EDAnalyzerBase *, LuminosityBlockIndex)=0
BranchType
Definition: BranchType.h:11
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
const EDAnalyzerAdaptorBase & operator=(const EDAnalyzerAdaptorBase &)
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
virtual void streamEndLuminosityBlockSummary(EDAnalyzerBase *, edm::LuminosityBlock const &, edm::EventSetup const &)=0
const ModuleDescription & moduleDescription() const
void setModuleDescription(ModuleDescription const &md)
virtual void setupRun(EDAnalyzerBase *, RunIndex)=0
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent() const
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:383
long double T
virtual void doBeginRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)=0
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: Run.h:42
void setModuleDescriptionPtr(EDAnalyzerBase *m)
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const