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 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();
82  }
83  }
84 
85  //Same interface as EDConsumerBase
86  void itemsToGet(BranchType, std::vector<ProductHolderIndexAndSkipBit>&) const;
87  void itemsMayGet(BranchType, std::vector<ProductHolderIndexAndSkipBit>&) const;
88  std::vector<ProductHolderIndexAndSkipBit> const& itemsToGetFromEvent() const;
89 
90  void updateLookup(BranchType iBranchType,
92 
93  const EDConsumerBase* consumer() const;
94 
95  void modulesDependentUpon(std::string const& iProcessName,
96  std::string const& iModuleLabel,
97  bool iPrint,
98  std::vector<char const*>& oModuleLabels) const;
99 
100  void modulesWhoseProductsAreConsumed(std::vector<ModuleDescription const*>& modules,
101  ProductRegistry const& preg,
102  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
103  std::string const& processName) const;
104 
105  std::vector<ConsumesInfo> consumesInfo() const;
106 
107  private:
108  EDAnalyzerAdaptorBase(const EDAnalyzerAdaptorBase&); // stop default
109 
110  const EDAnalyzerAdaptorBase& operator=(const EDAnalyzerAdaptorBase&); // stop default
111 
112  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
114  ModuleCallingContext 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 
135  LuminosityBlockPrincipal const& ep,
136  EventSetup const& c,
137  ModuleCallingContext const*);
140  LuminosityBlockPrincipal const& ep,
141  EventSetup const& c,
142  ModuleCallingContext const*);
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 
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
162 
163  // ---------- member data --------------------------------
166  moduleDescription_ = md;
167  }
169 
170  std::vector<EDAnalyzerBase*> m_streamModules;
171  };
172  }
173 }
174 #endif
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 itemsMayGet(BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
void doPreallocate(PreallocationConfiguration const &)
virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)=0
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 updateLookup(BranchType iBranchType, ProductHolderIndexHelper const &)
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
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
void modulesDependentUpon(std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
preg
Definition: Schedule.cc:374
long double T
std::vector< ProductHolderIndexAndSkipBit > const & itemsToGetFromEvent() const
virtual void doBeginRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)=0
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: Run.h:43
void itemsToGet(BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
void setModuleDescriptionPtr(EDAnalyzerBase *m)