CMS 3D CMS Logo

EDProducerBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_global_EDProducerBase_h
2 #define FWCore_Framework_global_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
30 
31 // forward declarations
32 
33 namespace edm {
34  class ModuleCallingContext;
35  class PreallocationConfiguration;
36  class StreamID;
37  class GlobalSchedule;
38  class ActivityRegistry;
39  class ProductRegistry;
40  class ThinnedAssociationsHelper;
41  class WaitingTask;
42  class WaitingTaskWithArenaHolder;
43 
44  namespace maker {
45  template <typename T>
46  class ModuleHolderT;
47  }
48 
49  namespace global {
50 
51  class EDProducerBase : public ProducerBase, public EDConsumerBase {
52  public:
53  template <typename T>
55  template <typename T>
56  friend class edm::WorkerT;
58 
59  friend class edm::GlobalSchedule;
60 
62  ~EDProducerBase() override;
63 
64  static void fillDescriptions(ConfigurationDescriptions& descriptions);
65  static void prevalidate(ConfigurationDescriptions& descriptions);
66  static const std::string& baseType();
67 
68  // Warning: the returned moduleDescription will be invalid during construction
69  ModuleDescription const& moduleDescription() const { return moduleDescription_; }
70 
71  virtual bool wantsGlobalRuns() const = 0;
72  virtual bool wantsGlobalLuminosityBlocks() const = 0;
73  virtual bool wantsStreamRuns() const = 0;
74  virtual bool wantsStreamLuminosityBlocks() const = 0;
75 
76  private:
77  bool doEvent(EventPrincipal const&, EventSetupImpl const&, ActivityRegistry*, ModuleCallingContext const*);
78  void doAcquire(EventPrincipal const&,
79  EventSetupImpl const&,
81  ModuleCallingContext const*,
83  void doPreallocate(PreallocationConfiguration const&);
84  void doBeginJob();
85  void doEndJob();
86 
87  void doBeginStream(StreamID id);
88  void doEndStream(StreamID id);
89  void doStreamBeginRun(StreamID id, RunPrincipal const& ep, EventSetupImpl const& c, ModuleCallingContext const*);
90  void doStreamEndRun(StreamID id, RunPrincipal const& ep, EventSetupImpl const& c, ModuleCallingContext const*);
91  void doStreamBeginLuminosityBlock(StreamID id,
92  LuminosityBlockPrincipal const& ep,
93  EventSetupImpl const& c,
94  ModuleCallingContext const*);
95  void doStreamEndLuminosityBlock(StreamID id,
96  LuminosityBlockPrincipal const& ep,
97  EventSetupImpl const& c,
98  ModuleCallingContext const*);
99 
100  void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*);
101  void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*);
102  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp,
103  EventSetupImpl const& c,
104  ModuleCallingContext const*);
105  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp,
106  EventSetupImpl const& c,
107  ModuleCallingContext const*);
108 
109  //For now, the following are just dummy implemenations with no ability for users to override
110  void doRespondToOpenInputFile(FileBlock const& fb);
111  void doRespondToCloseInputFile(FileBlock const& fb);
113 
115  registerProducts(module, reg, moduleDescription_);
116  }
117  std::string workerType() const { return "WorkerT<EDProducer>"; }
118 
119  virtual void produce(StreamID, Event&, EventSetup const&) const = 0;
120  //For now this is a placeholder
121  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask,
122  ModuleCallingContext const& iModuleCallingContext,
123  Principal const& iPrincipal) const {}
124 
125  virtual void beginJob() {}
126  virtual void endJob() {}
127 
128  virtual void preallocStreams(unsigned int);
129  virtual void preallocLumis(unsigned int);
130  virtual void preallocLumisSummary(unsigned int);
131  virtual void preallocate(PreallocationConfiguration const&);
132  virtual void doBeginStream_(StreamID id);
133  virtual void doEndStream_(StreamID id);
134  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
135  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
136  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
137  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
138  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
139  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
140 
141  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
142  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
143  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
144  virtual void doEndRun_(Run const& rp, EventSetup const& c);
145  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
146  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
147  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
148  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
149 
150  virtual void doBeginRunProduce_(Run& rp, EventSetup const& c);
151  virtual void doEndRunProduce_(Run& rp, EventSetup const& c);
152  virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
153  virtual void doEndLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
154 
155  virtual bool hasAccumulator() const { return false; }
156 
157  virtual bool hasAcquire() const { return false; }
158 
159  virtual void doAcquire_(StreamID, Event const&, edm::EventSetup const&, WaitingTaskWithArenaHolder&);
160 
161  void setModuleDescription(ModuleDescription const& md) { moduleDescription_ = md; }
163  std::unique_ptr<std::vector<BranchID>[]> previousParentages_;
164  std::unique_ptr<std::vector<BranchID>[]> gotBranchIDsFromAcquire_;
165  std::unique_ptr<ParentageID[]> previousParentageIds_;
166  };
167 
168  } // namespace global
169 } // namespace edm
170 
171 #endif
ModuleDescription moduleDescription_
void setModuleDescription(ModuleDescription const &md)
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
std::unique_ptr< ParentageID[]> previousParentageIds_
void registerProductsAndCallbacks(EDProducerBase *module, ProductRegistry *reg)
virtual bool hasAcquire() const
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
virtual bool hasAccumulator() const
std::unique_ptr< std::vector< BranchID >[]> gotBranchIDsFromAcquire_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ModuleDescription const & moduleDescription() const
HLT enums.
std::string workerType() const
Definition: vlib.h:198
Definition: Run.h:45