test
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  class ProductRegistry;
29  class ThinnedAssociationsHelper;
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
50 
51  private:
52  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
53  ActivityRegistry* act,
54  ModuleCallingContext const* mcc);
56  void doBeginJob();
57  void doEndJob();
58  void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
59  ModuleCallingContext const* mcc);
60  void doEndRun(RunPrincipal const& rp, EventSetup const& c,
61  ModuleCallingContext const* mcc);
63  ModuleCallingContext const* mcc);
65  ModuleCallingContext const* mcc);
69  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
74  }
75 
76  std::string workerType() const {return "WorkerT<EDProducer>";}
77 
78  virtual void produce(Event&, EventSetup const&) = 0;
79  virtual void beginJob() {}
80  virtual void endJob(){}
81 
82  virtual void beginRun(Run const& /* iR */, EventSetup const& /* iE */){}
83  virtual void endRun(Run const& /* iR */, EventSetup const& /* iE */){}
84  virtual void beginLuminosityBlock(LuminosityBlock const& /* iL */, EventSetup const& /* iE */){}
85  virtual void endLuminosityBlock(LuminosityBlock const& /* iL */, EventSetup const& /* iE */){}
86  virtual void respondToOpenInputFile(FileBlock const&) {}
87  virtual void respondToCloseInputFile(FileBlock const&) {}
88  virtual void preForkReleaseResources() {}
89  virtual void postForkReacquireResources(unsigned int /*iChildIndex*/, unsigned int /*iNumberOfChildren*/) {}
90 
93  }
95  std::vector<BranchID> previousParentage_;
99  };
100 }
101 
102 #endif
virtual void endJob()
Definition: EDProducer.h:80
virtual void beginRun(Run const &, EventSetup const &)
Definition: EDProducer.h:82
virtual void postForkReacquireResources(unsigned int, unsigned int)
Definition: EDProducer.h:89
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducer.h:55
void doEndRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDProducer.cc:72
void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDProducer.cc:92
EDProducer ModuleType
Definition: EDProducer.h:39
static boost::mutex mutex
Definition: LHEProxy.cc:11
static const std::string & baseType()
Definition: EDProducer.cc:136
void registerProducts(ProducerBase *, ProductRegistry *, ModuleDescription const &)
Definition: ProducerBase.cc:60
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)
Definition: EDProducer.cc:117
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDProducer.h:87
virtual void beginJob()
Definition: EDProducer.h:79
ParentageID previousParentageId_
Definition: EDProducer.h:98
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: EDProducer.h:70
ModuleDescription const & moduleDescription() const
Definition: EDProducer.h:49
std::vector< BranchID > previousParentage_
Definition: EDProducer.h:95
bool doEvent(EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *act, ModuleCallingContext const *mcc)
Definition: EDProducer.cc:31
void setModuleDescription(ModuleDescription const &md)
Definition: EDProducer.h:91
void doBeginJob()
Definition: EDProducer.cc:50
virtual void preForkReleaseResources()
Definition: EDProducer.h:88
void registerProductsAndCallbacks(EDProducer *module, ProductRegistry *reg)
Definition: EDProducer.h:72
void doPreForkReleaseResources()
Definition: EDProducer.cc:112
std::mutex mutex_
Definition: EDProducer.h:97
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDProducer.h:85
void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDProducer.cc:82
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDProducer.cc:129
ModuleDescription moduleDescription_
Definition: EDProducer.h:94
std::string workerType() const
Definition: EDProducer.h:76
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDProducer.cc:122
virtual void endRun(Run const &, EventSetup const &)
Definition: EDProducer.h:83
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDProducer.h:84
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDProducer.cc:102
void doBeginRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: EDProducer.cc:62
SharedResourcesAcquirer resourceAcquirer_
Definition: EDProducer.h:96
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDProducer.h:86
Definition: vlib.h:208
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDProducer.cc:107
Definition: Run.h:43
virtual ~EDProducer()
Definition: EDProducer.cc:28
virtual void produce(Event &, EventSetup const &)=0