CMS 3D CMS Logo

EDProducerBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_one_EDProducerBase_h
2 #define FWCore_Framework_one_EDProducerBase_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : one::EDProducerBase
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Thu, 02 May 2013 21:21:21 GMT
19 //
20 
21 // system include files
22 
23 // user include files
30 
31 // forward declarations
32 namespace edm {
33 
34  class ModuleCallingContext;
35  class PreallocationConfiguration;
36  class ActivityRegistry;
37  class ProductRegistry;
38  class ThinnedAssociationsHelper;
39  class WaitingTask;
40 
41  namespace maker {
42  template <typename T>
43  class ModuleHolderT;
44  }
45 
46  namespace one {
47 
48  class EDProducerBase : public ProducerBase, public EDConsumerBase {
49  public:
50  template <typename T>
52  template <typename T>
53  friend class edm::WorkerT;
55 
57  ~EDProducerBase() override;
58 
59  static void fillDescriptions(ConfigurationDescriptions& descriptions);
60  static void prevalidate(ConfigurationDescriptions& descriptions);
61  static const std::string& baseType();
62 
63  // Warning: the returned moduleDescription will be invalid during construction
64  ModuleDescription const& moduleDescription() const { return moduleDescription_; }
65 
66  virtual bool wantsGlobalRuns() const = 0;
67  virtual bool wantsGlobalLuminosityBlocks() const = 0;
68  bool wantsStreamRuns() const { return false; }
69  bool wantsStreamLuminosityBlocks() const { return false; };
70 
73 
74  private:
75  bool doEvent(EventPrincipal const& ep, EventSetupImpl const& c, ActivityRegistry*, ModuleCallingContext const*);
76  //For now this is a placeholder
77  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask,
78  ModuleCallingContext const& iModuleCallingContext,
79  Principal const& iPrincipal) const {}
80 
81  void doPreallocate(PreallocationConfiguration const&);
82  virtual void preallocLumis(unsigned int);
83  void doBeginJob();
84  void doEndJob();
85 
86  void doBeginRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*);
87  void doEndRun(RunPrincipal const& rp, EventSetupImpl const& c, ModuleCallingContext const*);
88  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp,
89  EventSetupImpl const& c,
90  ModuleCallingContext const*);
91  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp,
92  EventSetupImpl const& c,
93  ModuleCallingContext const*);
94 
95  //For now, the following are just dummy implemenations with no ability for users to override
96  void doRespondToOpenInputFile(FileBlock const& fb);
97  void doRespondToCloseInputFile(FileBlock const& fb);
99 
101  registerProducts(module, reg, moduleDescription_);
102  }
103  std::string workerType() const { return "WorkerT<EDProducer>"; }
104 
105  SharedResourcesAcquirer& sharedResourcesAcquirer() { return resourcesAcquirer_; }
106 
107  virtual void produce(Event&, EventSetup const&) = 0;
108  virtual void beginJob() {}
109  virtual void endJob() {}
110 
111  virtual void preallocThreads(unsigned int) {}
112 
113  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
114  virtual void doEndRun_(Run const& rp, EventSetup const& c);
115  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
116  virtual void doEndLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
117 
118  virtual void doBeginRunProduce_(Run& rp, EventSetup const& c);
119  virtual void doEndRunProduce_(Run& rp, EventSetup const& c);
120  virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
121  virtual void doEndLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
122 
123  virtual bool hasAccumulator() const { return false; }
124 
125  bool hasAcquire() const { return false; }
126 
127  virtual SharedResourcesAcquirer createAcquirer();
128 
129  void setModuleDescription(ModuleDescription const& md) { moduleDescription_ = md; }
131  std::vector<BranchID> previousParentage_;
133 
135  };
136 
137  } // namespace one
138 } // namespace edm
139 
140 #endif
SharedResourcesAcquirer & sharedResourcesAcquirer()
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
std::string workerType() const
SerialTaskQueue * globalRunsQueue() final
Definition: WorkerT.cc:142
SerialTaskQueue * globalLuminosityBlocksQueue() final
Definition: WorkerT.cc:146
bool wantsStreamLuminosityBlocks() const
bool wantsGlobalRuns() const final
Definition: WorkerT.cc:122
ModuleDescription const & moduleDescription() const
ParentageID previousParentageId_
void registerProductsAndCallbacks(EDProducerBase *module, ProductRegistry *reg)
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
bool wantsGlobalLuminosityBlocks() const final
Definition: WorkerT.cc:127
bool wantsStreamRuns() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
SharedResourcesAcquirer resourcesAcquirer_
EDProducerBase ModuleType
virtual void preallocThreads(unsigned int)
HLT enums.
void setModuleDescription(ModuleDescription const &md)
virtual bool hasAccumulator() const
Definition: vlib.h:198
std::vector< BranchID > previousParentage_
ModuleDescription moduleDescription_
Definition: Run.h:45