CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
17 
18 #include <string>
19 #include <vector>
20 
21 namespace edm {
22 
23  class ModuleCallingContext;
24  class PreallocationConfiguration;
25 
26  namespace maker {
27  template<typename T> class ModuleHolderT;
28  }
29 
30  class EDProducer : public ProducerBase, public EDConsumerBase {
31  public:
32  template <typename T> friend class maker::ModuleHolderT;
33  template <typename T> friend class WorkerT;
35 
36  EDProducer ();
37  virtual ~EDProducer();
38 
39  static void fillDescriptions(ConfigurationDescriptions& descriptions);
40  static void prevalidate(ConfigurationDescriptions& descriptions);
41  static const std::string& baseType();
42 
43  // Warning: the returned moduleDescription will be invalid during construction
45 
46  private:
47  bool doEvent(EventPrincipal& ep, EventSetup const& c,
48  ModuleCallingContext const* mcc);
50  void doBeginJob();
51  void doEndJob();
52  void doBeginRun(RunPrincipal& rp, EventSetup const& c,
53  ModuleCallingContext const* mcc);
54  void doEndRun(RunPrincipal& rp, EventSetup const& c,
55  ModuleCallingContext const* mcc);
57  ModuleCallingContext const* mcc);
59  ModuleCallingContext const* mcc);
63  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
66  }
67 
68  std::string workerType() const {return "WorkerT<EDProducer>";}
69 
70  virtual void produce(Event&, EventSetup const&) = 0;
71  virtual void beginJob() {}
72  virtual void endJob(){}
73 
74  virtual void beginRun(Run const&iR, EventSetup const&iE){}
75  virtual void endRun(Run const& iR, EventSetup const& iE){}
76  virtual void beginLuminosityBlock(LuminosityBlock const& iL, EventSetup const& iE){}
77  virtual void endLuminosityBlock(LuminosityBlock const& iL, EventSetup const& iE){}
78  virtual void respondToOpenInputFile(FileBlock const&) {}
79  virtual void respondToCloseInputFile(FileBlock const&) {}
80  virtual void preForkReleaseResources() {}
81  virtual void postForkReacquireResources(unsigned int /*iChildIndex*/, unsigned int /*iNumberOfChildren*/) {}
82 
84  moduleDescription_ = md;
85  }
87  std::vector<BranchID> previousParentage_;
89  };
90 }
91 
92 #endif
virtual void endJob()
Definition: EDProducer.h:72
virtual void postForkReacquireResources(unsigned int, unsigned int)
Definition: EDProducer.h:81
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducer.h:49
EDProducer ModuleType
Definition: EDProducer.h:34
virtual void endRun(Run const &iR, EventSetup const &iE)
Definition: EDProducer.h:75
static const std::string & baseType()
Definition: EDProducer.cc:119
void registerProducts(ProducerBase *, ProductRegistry *, ModuleDescription const &)
Definition: ProducerBase.cc:60
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
Definition: EDProducer.cc:100
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDProducer.h:79
bool doEvent(EventPrincipal &ep, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDProducer.cc:25
virtual void beginJob()
Definition: EDProducer.h:71
ParentageID previousParentageId_
Definition: EDProducer.h:88
ModuleDescription const & moduleDescription() const
Definition: EDProducer.h:44
void doBeginRun(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDProducer.cc:45
void doEndRun(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDProducer.cc:55
std::vector< BranchID > previousParentage_
Definition: EDProducer.h:87
void setModuleDescription(ModuleDescription const &md)
Definition: EDProducer.h:83
virtual void beginRun(Run const &iR, EventSetup const &iE)
Definition: EDProducer.h:74
void doBeginJob()
Definition: EDProducer.cc:35
virtual void preForkReleaseResources()
Definition: EDProducer.h:80
void registerProductsAndCallbacks(EDProducer *module, ProductRegistry *reg)
Definition: EDProducer.h:64
void doPreForkReleaseResources()
Definition: EDProducer.cc:95
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDProducer.cc:112
ModuleDescription moduleDescription_
Definition: EDProducer.h:86
std::string workerType() const
Definition: EDProducer.h:68
friend class maker::ModuleHolderT
Definition: EDProducer.h:32
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDProducer.cc:105
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDProducer.cc:85
void doEndLuminosityBlock(LuminosityBlockPrincipal &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDProducer.cc:75
void doBeginLuminosityBlock(LuminosityBlockPrincipal &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDProducer.cc:65
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDProducer.h:78
Definition: vlib.h:208
virtual void beginLuminosityBlock(LuminosityBlock const &iL, EventSetup const &iE)
Definition: EDProducer.h:76
virtual void endLuminosityBlock(LuminosityBlock const &iL, EventSetup const &iE)
Definition: EDProducer.h:77
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDProducer.cc:90
Definition: Run.h:41
virtual ~EDProducer()
Definition: EDProducer.cc:22
virtual void produce(Event &, EventSetup const &)=0