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