CMS 3D CMS Logo

EDProducer.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_EDProducer_h
2 #define FWCore_Framework_EDProducer_h
3 
4 /*----------------------------------------------------------------------
5 
6 EDProducer: The base class of "modules" whose main purpose is to insert new
7 EDProducts into an Event.
8 
9 
10 ----------------------------------------------------------------------*/
11 
18 
19 #include <string>
20 #include <vector>
21 
22 namespace edm {
23 
24  class ModuleCallingContext;
25  class PreallocationConfiguration;
26  class ActivityRegistry;
27  class ProductRegistry;
28  class ThinnedAssociationsHelper;
29  class WaitingTask;
30 
31  namespace maker {
32  template<typename T> class ModuleHolderT;
33  }
34 
35  class EDProducer : public ProducerBase, public EDConsumerBase {
36  public:
37  template <typename T> friend class maker::ModuleHolderT;
38  template <typename T> friend class WorkerT;
40 
41  EDProducer ();
42  ~EDProducer() override;
43 
44  static void fillDescriptions(ConfigurationDescriptions& descriptions);
45  static void prevalidate(ConfigurationDescriptions& descriptions);
46  static const std::string& baseType();
47 
48  // Warning: the returned moduleDescription will be invalid during construction
49  ModuleDescription const& moduleDescription() const { return moduleDescription_; }
50 
51  private:
52  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
53  ActivityRegistry* act,
54  ModuleCallingContext const* mcc);
55  //Needed by WorkerT but not supported
56  void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
57 
59  void doBeginJob();
60  void doEndJob();
61  void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
62  ModuleCallingContext const* mcc);
63  void doEndRun(RunPrincipal const& rp, EventSetup const& c,
64  ModuleCallingContext const* mcc);
65  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
66  ModuleCallingContext const* mcc);
67  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
68  ModuleCallingContext const* mcc);
69  void doRespondToOpenInputFile(FileBlock const& fb);
70  void doRespondToCloseInputFile(FileBlock const& fb);
74  registerProducts(module, reg, moduleDescription_);
75  }
76 
77  std::string workerType() const {return "WorkerT<EDProducer>";}
78 
80  return resourceAcquirer_;
81  }
82 
83  virtual void produce(Event&, EventSetup const&) = 0;
84  virtual void beginJob() {}
85  virtual void endJob(){}
86 
87  virtual void beginRun(Run const& /* iR */, EventSetup const& /* iE */){}
88  virtual void endRun(Run const& /* iR */, EventSetup const& /* iE */){}
89  virtual void beginLuminosityBlock(LuminosityBlock const& /* iL */, EventSetup const& /* iE */){}
90  virtual void endLuminosityBlock(LuminosityBlock const& /* iL */, EventSetup const& /* iE */){}
91  virtual void respondToOpenInputFile(FileBlock const&) {}
92  virtual void respondToCloseInputFile(FileBlock const&) {}
93 
95  moduleDescription_ = md;
96  }
98  std::vector<BranchID> previousParentage_;
101  };
102 }
103 
104 #endif
virtual void endJob()
Definition: EDProducer.h:85
virtual void beginRun(Run const &, EventSetup const &)
Definition: EDProducer.h:87
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducer.h:58
EDProducer ModuleType
Definition: EDProducer.h:39
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDProducer.h:92
virtual void beginJob()
Definition: EDProducer.h:84
ParentageID previousParentageId_
Definition: EDProducer.h:100
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: EDProducer.h:71
ModuleDescription const & moduleDescription() const
Definition: EDProducer.h:49
std::vector< BranchID > previousParentage_
Definition: EDProducer.h:98
void setModuleDescription(ModuleDescription const &md)
Definition: EDProducer.h:94
void registerProductsAndCallbacks(EDProducer *module, ProductRegistry *reg)
Definition: EDProducer.h:73
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
Definition: EDProducer.h:56
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDProducer.h:90
ModuleDescription moduleDescription_
Definition: EDProducer.h:97
std::string workerType() const
Definition: EDProducer.h:77
virtual void endRun(Run const &, EventSetup const &)
Definition: EDProducer.h:88
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDProducer.h:89
HLT enums.
SharedResourcesAcquirer resourceAcquirer_
Definition: EDProducer.h:99
SharedResourcesAcquirer & sharedResourcesAcquirer()
Definition: EDProducer.h:79
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDProducer.h:91
Definition: vlib.h:208
Definition: Run.h:43