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  static bool wantsGlobalRuns() {return true;}
52  static bool wantsGlobalLuminosityBlocks() {return true;}
53  static bool wantsStreamRuns() {return false;}
54  static bool wantsStreamLuminosityBlocks() {return false;};
55 
56  private:
57  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
58  ActivityRegistry* act,
59  ModuleCallingContext const* mcc);
60  //Needed by WorkerT but not supported
61  void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
62 
64  void doBeginJob();
65  void doEndJob();
66  void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
67  ModuleCallingContext const* mcc);
68  void doEndRun(RunPrincipal const& rp, EventSetup const& c,
69  ModuleCallingContext const* mcc);
70  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
71  ModuleCallingContext const* mcc);
72  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
73  ModuleCallingContext const* mcc);
74  void doRespondToOpenInputFile(FileBlock const& fb);
75  void doRespondToCloseInputFile(FileBlock const& fb);
79  registerProducts(module, reg, moduleDescription_);
80  }
81 
82  std::string workerType() const {return "WorkerT<EDProducer>";}
83 
85  return resourceAcquirer_;
86  }
87 
88  virtual void produce(Event&, EventSetup const&) = 0;
89  virtual void beginJob() {}
90  virtual void endJob(){}
91 
92  virtual void beginRun(Run const& /* iR */, EventSetup const& /* iE */){}
93  virtual void endRun(Run const& /* iR */, EventSetup const& /* iE */){}
94  virtual void beginLuminosityBlock(LuminosityBlock const& /* iL */, EventSetup const& /* iE */){}
95  virtual void endLuminosityBlock(LuminosityBlock const& /* iL */, EventSetup const& /* iE */){}
96  virtual void respondToOpenInputFile(FileBlock const&) {}
97  virtual void respondToCloseInputFile(FileBlock const&) {}
98 
99  bool hasAcquire() const { return false; }
100 
102  moduleDescription_ = md;
103  }
105  std::vector<BranchID> previousParentage_;
108  };
109 }
110 
111 #endif
virtual void endJob()
Definition: EDProducer.h:90
virtual void beginRun(Run const &, EventSetup const &)
Definition: EDProducer.h:92
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducer.h:63
EDProducer ModuleType
Definition: EDProducer.h:39
static bool wantsStreamLuminosityBlocks()
Definition: EDProducer.h:54
static bool wantsStreamRuns()
Definition: EDProducer.h:53
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDProducer.h:97
virtual void beginJob()
Definition: EDProducer.h:89
ParentageID previousParentageId_
Definition: EDProducer.h:107
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: EDProducer.h:76
ModuleDescription const & moduleDescription() const
Definition: EDProducer.h:49
std::vector< BranchID > previousParentage_
Definition: EDProducer.h:105
void setModuleDescription(ModuleDescription const &md)
Definition: EDProducer.h:101
static bool wantsGlobalLuminosityBlocks()
Definition: EDProducer.h:52
void registerProductsAndCallbacks(EDProducer *module, ProductRegistry *reg)
Definition: EDProducer.h:78
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
Definition: EDProducer.h:61
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDProducer.h:95
bool hasAcquire() const
Definition: EDProducer.h:99
ModuleDescription moduleDescription_
Definition: EDProducer.h:104
std::string workerType() const
Definition: EDProducer.h:82
static bool wantsGlobalRuns()
Definition: EDProducer.h:51
virtual void endRun(Run const &, EventSetup const &)
Definition: EDProducer.h:93
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDProducer.h:94
HLT enums.
SharedResourcesAcquirer resourceAcquirer_
Definition: EDProducer.h:106
SharedResourcesAcquirer & sharedResourcesAcquirer()
Definition: EDProducer.h:84
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDProducer.h:96
Definition: vlib.h:208
Definition: Run.h:43