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 
16 
17 #include <string>
18 #include <vector>
19 
20 namespace edm {
21  class EDProducer : public ProducerBase {
22  public:
23  template <typename T> friend class WorkerT;
26 
27  EDProducer ();
28  virtual ~EDProducer();
29 
30  static void fillDescriptions(ConfigurationDescriptions& descriptions);
31  static void prevalidate(ConfigurationDescriptions& descriptions);
32  static const std::string& baseType();
33 
34  protected:
35  // The returned pointer will be null unless the this is currently
36  // executing its event loop function ('produce').
38 
39  private:
40  bool doEvent(EventPrincipal& ep, EventSetup const& c,
41  CurrentProcessingContext const* cpcp);
42  void doBeginJob();
43  void doEndJob();
44  bool doBeginRun(RunPrincipal& rp, EventSetup const& c,
45  CurrentProcessingContext const* cpc);
46  bool doEndRun(RunPrincipal& rp, EventSetup const& c,
47  CurrentProcessingContext const* cpc);
49  CurrentProcessingContext const* cpc);
51  CurrentProcessingContext const* cpc);
57  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
60  }
61 
62  std::string workerType() const {return "WorkerT<EDProducer>";}
63 
64  virtual void produce(Event&, EventSetup const&) = 0;
65  virtual void beginJob() {}
66  virtual void endJob(){}
67  virtual void beginRun(Run&, EventSetup const&){}
68  virtual void endRun(Run&, EventSetup const&){}
71  virtual void respondToOpenInputFile(FileBlock const&) {}
72  virtual void respondToCloseInputFile(FileBlock const&) {}
73  virtual void respondToOpenOutputFiles(FileBlock const&) {}
74  virtual void respondToCloseOutputFiles(FileBlock const&) {}
75  virtual void preForkReleaseResources() {}
76  virtual void postForkReacquireResources(unsigned int /*iChildIndex*/, unsigned int /*iNumberOfChildren*/) {}
77 
79  moduleDescription_ = md;
80  }
83  std::vector<BranchID> previousParentage_;
85  };
86 }
87 
88 #endif
virtual void endLuminosityBlock(LuminosityBlock &, EventSetup const &)
Definition: EDProducer.h:70
virtual void endJob()
Definition: EDProducer.h:66
bool doEvent(EventPrincipal &ep, EventSetup const &c, CurrentProcessingContext const *cpcp)
Definition: EDProducer.cc:27
virtual void postForkReacquireResources(unsigned int, unsigned int)
Definition: EDProducer.h:76
bool doEndRun(RunPrincipal &rp, EventSetup const &c, CurrentProcessingContext const *cpc)
Definition: EDProducer.cc:57
EDProducer ModuleType
Definition: EDProducer.h:24
bool doBeginRun(RunPrincipal &rp, EventSetup const &c, CurrentProcessingContext const *cpc)
Definition: EDProducer.cc:47
static const std::string & baseType()
Definition: EDProducer.cc:136
virtual void beginRun(Run &, EventSetup const &)
Definition: EDProducer.h:67
void registerProducts(ProducerBase *, ProductRegistry *, ModuleDescription const &)
Definition: ProducerBase.cc:60
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
Definition: EDProducer.cc:112
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDProducer.h:72
virtual void beginLuminosityBlock(LuminosityBlock &, EventSetup const &)
Definition: EDProducer.h:69
bool doEndLuminosityBlock(LuminosityBlockPrincipal &lbp, EventSetup const &c, CurrentProcessingContext const *cpc)
Definition: EDProducer.cc:77
virtual void beginJob()
Definition: EDProducer.h:65
ParentageID previousParentageId_
Definition: EDProducer.h:84
std::vector< BranchID > previousParentage_
Definition: EDProducer.h:83
void setModuleDescription(ModuleDescription const &md)
Definition: EDProducer.h:78
void registerAnyProducts(EDProducer *module, ProductRegistry *reg)
Definition: EDProducer.h:58
void doBeginJob()
Definition: EDProducer.cc:37
virtual void preForkReleaseResources()
Definition: EDProducer.h:75
virtual void respondToCloseOutputFiles(FileBlock const &)
Definition: EDProducer.h:74
void doPreForkReleaseResources()
Definition: EDProducer.cc:107
virtual void endRun(Run &, EventSetup const &)
Definition: EDProducer.h:68
void doRespondToOpenOutputFiles(FileBlock const &fb)
Definition: EDProducer.cc:97
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDProducer.cc:129
void doRespondToCloseOutputFiles(FileBlock const &fb)
Definition: EDProducer.cc:102
CurrentProcessingContext const * currentContext() const
Definition: EDProducer.cc:117
ModuleDescription moduleDescription_
Definition: EDProducer.h:81
std::string workerType() const
Definition: EDProducer.h:62
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDProducer.cc:122
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDProducer.cc:87
CurrentProcessingContext const * current_context_
Definition: EDProducer.h:82
virtual void respondToOpenOutputFiles(FileBlock const &)
Definition: EDProducer.h:73
author Stefano ARGIRO author Bill Tanenbaum
WorkerT< EDProducer > WorkerType
Definition: EDProducer.h:25
bool doBeginLuminosityBlock(LuminosityBlockPrincipal &lbp, EventSetup const &c, CurrentProcessingContext const *cpc)
Definition: EDProducer.cc:67
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDProducer.h:71
Definition: vlib.h:209
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDProducer.cc:92
Definition: Run.h:33
virtual ~EDProducer()
Definition: EDProducer.cc:24
virtual void produce(Event &, EventSetup const &)=0