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  virtual ~EDProducer();
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);
71  void doPreForkReleaseResources();
72  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
76  registerProducts(module, reg, moduleDescription_);
77  }
78 
79  std::string workerType() const {return "WorkerT<EDProducer>";}
80 
82  return resourceAcquirer_;
83  }
84 
85  virtual void produce(Event&, EventSetup const&) = 0;
86  virtual void beginJob() {}
87  virtual void endJob(){}
88 
89  virtual void beginRun(Run const& /* iR */, EventSetup const& /* iE */){}
90  virtual void endRun(Run const& /* iR */, EventSetup const& /* iE */){}
91  virtual void beginLuminosityBlock(LuminosityBlock const& /* iL */, EventSetup const& /* iE */){}
92  virtual void endLuminosityBlock(LuminosityBlock const& /* iL */, EventSetup const& /* iE */){}
93  virtual void respondToOpenInputFile(FileBlock const&) {}
94  virtual void respondToCloseInputFile(FileBlock const&) {}
95  virtual void preForkReleaseResources() {}
96  virtual void postForkReacquireResources(unsigned int /*iChildIndex*/, unsigned int /*iNumberOfChildren*/) {}
97 
99  moduleDescription_ = md;
100  }
102  std::vector<BranchID> previousParentage_;
105  };
106 }
107 
108 #endif
virtual void endJob()
Definition: EDProducer.h:87
virtual void beginRun(Run const &, EventSetup const &)
Definition: EDProducer.h:89
virtual void postForkReacquireResources(unsigned int, unsigned int)
Definition: EDProducer.h:96
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducer.h:58
EDProducer ModuleType
Definition: EDProducer.h:39
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDProducer.h:94
virtual void beginJob()
Definition: EDProducer.h:86
ParentageID previousParentageId_
Definition: EDProducer.h:104
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: EDProducer.h:73
ModuleDescription const & moduleDescription() const
Definition: EDProducer.h:49
std::vector< BranchID > previousParentage_
Definition: EDProducer.h:102
void setModuleDescription(ModuleDescription const &md)
Definition: EDProducer.h:98
virtual void preForkReleaseResources()
Definition: EDProducer.h:95
void registerProductsAndCallbacks(EDProducer *module, ProductRegistry *reg)
Definition: EDProducer.h:75
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:92
ModuleDescription moduleDescription_
Definition: EDProducer.h:101
std::string workerType() const
Definition: EDProducer.h:79
virtual void endRun(Run const &, EventSetup const &)
Definition: EDProducer.h:90
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDProducer.h:91
HLT enums.
SharedResourcesAcquirer resourceAcquirer_
Definition: EDProducer.h:103
SharedResourcesAcquirer & sharedResourcesAcquirer()
Definition: EDProducer.h:81
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDProducer.h:93
Definition: vlib.h:208
Definition: Run.h:42