CMS 3D CMS Logo

EDProducerBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_limited_EDProducerBase_h
2 #define FWCore_Framework_limited_EDProducerBase_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : EDProducerBase
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Thu, 18 Jul 2013 11:51:14 GMT
19 //
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
31 
32 // forward declarations
33 
34 namespace edm {
35  class ModuleCallingContext;
36  class PreallocationConfiguration;
37  class StreamID;
38  class GlobalSchedule;
39  class ActivityRegistry;
40  class ProductRegistry;
41  class ThinnedAssociationsHelper;
42  class WaitingTask;
43 
44  namespace maker {
45  template<typename T> class ModuleHolderT;
46  }
47 
48  namespace limited {
49 
51  {
52 
53  public:
54  template <typename T> friend class edm::maker::ModuleHolderT;
55  template <typename T> friend class edm::WorkerT;
57 
58  friend class edm::GlobalSchedule;
59 
61  ~EDProducerBase() override;
62 
63  static void fillDescriptions(ConfigurationDescriptions& descriptions);
64  static void prevalidate(ConfigurationDescriptions& descriptions);
65  static const std::string& baseType();
66 
67  // Warning: the returned moduleDescription will be invalid during construction
68  ModuleDescription const& moduleDescription() const { return moduleDescription_; }
69 
70  unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); }
71 
73  return queue_;
74  }
75  private:
76  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
78  ModuleCallingContext const*);
79  void doPreallocate(PreallocationConfiguration const&);
80  void doBeginJob();
81  void doEndJob();
82 
83  void doBeginStream(StreamID id);
84  void doEndStream(StreamID id);
85  void doStreamBeginRun(StreamID id,
86  RunPrincipal const& ep,
87  EventSetup const& c,
88  ModuleCallingContext const*);
89  void doStreamEndRun(StreamID id,
90  RunPrincipal const& ep,
91  EventSetup const& c,
92  ModuleCallingContext const*);
93  void doStreamBeginLuminosityBlock(StreamID id,
94  LuminosityBlockPrincipal const& ep,
95  EventSetup const& c,
96  ModuleCallingContext const*);
97  void doStreamEndLuminosityBlock(StreamID id,
98  LuminosityBlockPrincipal const& ep,
99  EventSetup const& c,
100  ModuleCallingContext const*);
101 
102 
103  void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
104  ModuleCallingContext const*);
105  void doEndRun(RunPrincipal const& rp, EventSetup const& c,
106  ModuleCallingContext const*);
107  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
108  ModuleCallingContext const*);
109  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
110  ModuleCallingContext const*);
111 
112  //For now, the following are just dummy implemenations with no ability for users to override
113  void doRespondToOpenInputFile(FileBlock const& fb);
114  void doRespondToCloseInputFile(FileBlock const& fb);
117 
119  registerProducts(module, reg, moduleDescription_);
120  }
121  std::string workerType() const {return "WorkerT<EDProducer>";}
122 
123  virtual void produce(StreamID, Event&, EventSetup const&) const= 0;
124  //For now this is a placeholder
125  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
126 
127  virtual void beginJob() {}
128  virtual void endJob(){}
129 
130  virtual void preallocStreams(unsigned int);
131  virtual void doBeginStream_(StreamID id);
132  virtual void doEndStream_(StreamID id);
133  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
134  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
135  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
136  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
137  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
138  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
139 
140  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
141  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
142  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
143  virtual void doEndRun_(Run const& rp, EventSetup const& c);
144  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
145  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
146  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
147  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
148 
149  virtual void doBeginRunProduce_(Run& rp, EventSetup const& c);
150  virtual void doEndRunProduce_(Run& rp, EventSetup const& c);
151  virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
152  virtual void doEndLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
153 
154 
156  moduleDescription_ = md;
157  }
159  std::unique_ptr<std::vector<BranchID>[]> previousParentages_;
160  std::unique_ptr<ParentageID[]> previousParentageIds_;
162  };
163 
164  }
165 }
166 
167 #endif
void registerProductsAndCallbacks(EDProducerBase *module, ProductRegistry *reg)
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
ModuleDescription const & moduleDescription() const
void setModuleDescription(ModuleDescription const &md)
unsigned int concurrencyLimit() const
ModuleDescription moduleDescription_
std::string workerType() const
std::unique_ptr< ParentageID[]> previousParentageIds_
HLT enums.
LimitedTaskQueue & queue()
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
Definition: vlib.h:208
Definition: Run.h:43