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
32 
33 // forward declarations
34 
35 namespace edm {
36  class ModuleCallingContext;
37  class PreallocationConfiguration;
38  class StreamID;
39  class GlobalSchedule;
40  class ActivityRegistry;
41  class ThinnedAssociationsHelper;
42 
43  namespace maker {
44  template <typename T>
45  class ModuleHolderT;
46  }
47 
48  namespace limited {
49 
50  class EDProducerBase : public ProducerBase, public EDConsumerBase {
51  public:
52  template <typename T>
54  template <typename T>
55  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
69 
70  virtual bool wantsProcessBlocks() const = 0;
71  virtual bool wantsInputProcessBlocks() const = 0;
72  virtual bool wantsGlobalRuns() const = 0;
73  virtual bool wantsGlobalLuminosityBlocks() const = 0;
74  virtual bool wantsStreamRuns() const = 0;
75  virtual bool wantsStreamLuminosityBlocks() const = 0;
76 
77  unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); }
78 
79  LimitedTaskQueue& queue() { return queue_; }
80 
81  private:
84  void doBeginJob();
85  void doEndJob();
86 
87  void doBeginStream(StreamID id);
88  void doEndStream(StreamID id);
93 
98  void doEndRun(RunTransitionInfo const&, ModuleCallingContext const*);
101 
102  //For now, the following are just dummy implemenations with no ability for users to override
107 
110  }
111  std::string workerType() const { return "WorkerT<EDProducer>"; }
112 
113  virtual void produce(StreamID, Event&, EventSetup const&) const = 0;
114  //For now this is a placeholder
116  ModuleCallingContext const& iModuleCallingContext,
117  Principal const& iPrincipal) const {}
118 
119  virtual void beginJob() {}
120  virtual void endJob() {}
121 
122  virtual void preallocStreams(unsigned int);
123  virtual void preallocLumis(unsigned int);
124  virtual void preallocLumisSummary(unsigned int);
125  virtual void preallocate(PreallocationConfiguration const&);
126  virtual void doBeginStream_(StreamID id);
127  virtual void doEndStream_(StreamID id);
128  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
129  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
130  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
131  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
132  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
133  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
134 
135  virtual void doBeginProcessBlock_(ProcessBlock const&);
136  virtual void doAccessInputProcessBlock_(ProcessBlock const&);
137  virtual void doEndProcessBlock_(ProcessBlock const&);
138  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
139  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
140  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
141  virtual void doEndRun_(Run const& rp, EventSetup const& c);
142  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
143  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
144  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
145  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
146 
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  virtual void clearInputProcessBlockCaches();
155  virtual bool hasAccumulator() const { return false; }
156 
157  bool hasAcquire() const { return false; }
158 
161  std::unique_ptr<std::vector<BranchID>[]> previousParentages_;
162  std::unique_ptr<ParentageID[]> previousParentageIds_;
164  };
165 
166  } // namespace limited
167 } // namespace edm
168 
169 #endif
void registerProductsAndCallbacks(EDProducerBase *module, ProductRegistry *reg)
void doRespondToCloseInputFile(FileBlock const &)
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
static void fillDescriptions(ConfigurationDescriptions &descriptions)
virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
static const std::string & baseType()
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doEndRunSummary_(Run const &rp, EventSetup const &c)
static void prevalidate(ConfigurationDescriptions &descriptions)
virtual bool wantsGlobalLuminosityBlocks() const =0
virtual void preallocLumis(unsigned int)
void registerProducts(ProducerBase *, ProductRegistry *, ModuleDescription const &)
Definition: ProducerBase.cc:57
std::string workerType() const
virtual void doStreamEndRunSummary_(StreamID id, Run const &rp, EventSetup const &c)
virtual void doEndLuminosityBlock_(LuminosityBlock const &lb, EventSetup const &c)
virtual bool wantsProcessBlocks() const =0
void doStreamBeginLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
void setModuleDescription(ModuleDescription const &md)
virtual bool wantsInputProcessBlocks() const =0
virtual void doStreamEndRun_(StreamID id, Run const &rp, EventSetup const &c)
virtual void doStreamBeginRun_(StreamID id, Run const &rp, EventSetup const &c)
virtual void doBeginRun_(Run const &rp, EventSetup const &c)
void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
virtual void clearInputProcessBlockCaches()
virtual bool wantsStreamRuns() const =0
void doBeginStream(StreamID id)
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void doEndStream_(StreamID id)
void doRespondToOpenInputFile(FileBlock const &)
ModuleDescription moduleDescription_
virtual bool wantsGlobalRuns() const =0
void doStreamEndRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
std::unique_ptr< ParentageID[]> previousParentageIds_
virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
unsigned int concurrencyLimit() const
virtual bool wantsStreamLuminosityBlocks() const =0
virtual void doEndProcessBlockProduce_(ProcessBlock &)
virtual void doBeginLuminosityBlock_(LuminosityBlock const &lbp, EventSetup const &c)
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
virtual void doBeginRunSummary_(Run const &rp, EventSetup const &c)
virtual void doEndLuminosityBlockSummary_(LuminosityBlock const &lb, EventSetup const &c)
virtual void preallocate(PreallocationConfiguration const &)
virtual void preallocStreams(unsigned int)
EDProducerBase(ParameterSet const &pset)
virtual void doBeginLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
HLT enums.
void doStreamBeginRun(StreamID, RunTransitionInfo const &, ModuleCallingContext const *)
void preActionBeforeRunEventAsync(WaitingTaskHolder iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
virtual void doBeginProcessBlockProduce_(ProcessBlock &)
LimitedTaskQueue & queue()
unsigned int concurrencyLimit() const
virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const &lbp, EventSetup const &c)
void doStreamEndLuminosityBlock(StreamID, LumiTransitionInfo const &, ModuleCallingContext const *)
virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const &rp, EventSetup const &c)
virtual void doEndLuminosityBlockProduce_(LuminosityBlock &lbp, EventSetup const &c)
ModuleDescription const & moduleDescription() const
virtual void doBeginRunProduce_(Run &rp, EventSetup const &c)
virtual void produce(StreamID, Event &, EventSetup const &) const =0
virtual void doBeginProcessBlock_(ProcessBlock const &)
virtual bool hasAccumulator() const
void doPreallocate(PreallocationConfiguration const &)
virtual void doAccessInputProcessBlock_(ProcessBlock const &)
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
virtual void doBeginStream_(StreamID id)
virtual void preallocLumisSummary(unsigned int)
virtual void doEndRunProduce_(Run &rp, EventSetup const &c)
virtual void doEndProcessBlock_(ProcessBlock const &)
virtual void doEndRun_(Run const &rp, EventSetup const &c)
Definition: Run.h:45