CMS 3D CMS Logo

EDProducerBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_global_EDProducerBase_h
2 #define FWCore_Framework_global_EDProducerBase_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : EDProducerBase
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Thu, 18 Jul 2013 11:51:14 GMT
19 //
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
30 
31 // forward declarations
32 
33 namespace edm {
34  class ModuleCallingContext;
35  class PreallocationConfiguration;
36  class StreamID;
37  class GlobalSchedule;
38  class ActivityRegistry;
39  class ProductRegistry;
40  class ThinnedAssociationsHelper;
41  class WaitingTask;
42 
43  namespace maker {
44  template<typename T> class ModuleHolderT;
45  }
46 
47  namespace global {
48 
50  {
51 
52  public:
53  template <typename T> friend class edm::maker::ModuleHolderT;
54  template <typename T> friend class edm::WorkerT;
56 
57  friend class edm::GlobalSchedule;
58 
60  virtual ~EDProducerBase();
61 
62  static void fillDescriptions(ConfigurationDescriptions& descriptions);
63  static void prevalidate(ConfigurationDescriptions& descriptions);
64  static const std::string& baseType();
65 
66  // Warning: the returned moduleDescription will be invalid during construction
67  ModuleDescription const& moduleDescription() const { return moduleDescription_; }
68 
69  private:
70  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
72  ModuleCallingContext const*);
73  void doPreallocate(PreallocationConfiguration const&);
74  void doBeginJob();
75  void doEndJob();
76 
77  void doBeginStream(StreamID id);
78  void doEndStream(StreamID id);
79  void doStreamBeginRun(StreamID id,
80  RunPrincipal const& ep,
81  EventSetup const& c,
82  ModuleCallingContext const*);
83  void doStreamEndRun(StreamID id,
84  RunPrincipal const& ep,
85  EventSetup const& c,
86  ModuleCallingContext const*);
87  void doStreamBeginLuminosityBlock(StreamID id,
88  LuminosityBlockPrincipal const& ep,
89  EventSetup const& c,
90  ModuleCallingContext const*);
91  void doStreamEndLuminosityBlock(StreamID id,
92  LuminosityBlockPrincipal const& ep,
93  EventSetup const& c,
94  ModuleCallingContext const*);
95 
96 
97  void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
98  ModuleCallingContext const*);
99  void doEndRun(RunPrincipal const& rp, EventSetup const& c,
100  ModuleCallingContext const*);
101  void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
102  ModuleCallingContext const*);
103  void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
104  ModuleCallingContext const*);
105 
106  void doPreForkReleaseResources();
107  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
108 
109  //For now, the following are just dummy implemenations with no ability for users to override
110  void doRespondToOpenInputFile(FileBlock const& fb);
111  void doRespondToCloseInputFile(FileBlock const& fb);
114 
116  registerProducts(module, reg, moduleDescription_);
117  }
118  std::string workerType() const {return "WorkerT<EDProducer>";}
119 
120  virtual void produce(StreamID, Event&, EventSetup const&) const= 0;
121  //For now this is a placeholder
122  /*virtual*/ void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
123 
124  virtual void beginJob() {}
125  virtual void endJob(){}
126 
127  virtual void preForkReleaseResources() {}
128  virtual void postForkReacquireResources(unsigned int /*iChildIndex*/, unsigned int /*iNumberOfChildren*/) {}
129 
130  virtual void preallocStreams(unsigned int);
131  virtual void doBeginStream_(StreamID id);
132  virtual void doEndStream_(StreamID id);
133  virtual void doStreamBeginRun_(StreamID id, Run const& rp, EventSetup const& c);
134  virtual void doStreamEndRun_(StreamID id, Run const& rp, EventSetup const& c);
135  virtual void doStreamEndRunSummary_(StreamID id, Run const& rp, EventSetup const& c);
136  virtual void doStreamBeginLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
137  virtual void doStreamEndLuminosityBlock_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
138  virtual void doStreamEndLuminosityBlockSummary_(StreamID id, LuminosityBlock const& lbp, EventSetup const& c);
139 
140  virtual void doBeginRun_(Run const& rp, EventSetup const& c);
141  virtual void doBeginRunSummary_(Run const& rp, EventSetup const& c);
142  virtual void doEndRunSummary_(Run const& rp, EventSetup const& c);
143  virtual void doEndRun_(Run const& rp, EventSetup const& c);
144  virtual void doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c);
145  virtual void doBeginLuminosityBlockSummary_(LuminosityBlock const& rp, EventSetup const& c);
146  virtual void doEndLuminosityBlockSummary_(LuminosityBlock const& lb, EventSetup const& c);
147  virtual void doEndLuminosityBlock_(LuminosityBlock const& lb, EventSetup const& c);
148 
149  virtual void doBeginRunProduce_(Run& rp, EventSetup const& c);
150  virtual void doEndRunProduce_(Run& rp, EventSetup const& c);
151  virtual void doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
152  virtual void doEndLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c);
153 
154 
156  moduleDescription_ = md;
157  }
159  std::unique_ptr<std::vector<BranchID>[]> previousParentages_;
160  std::unique_ptr<ParentageID[]> previousParentageIds_;
161  };
162 
163  }
164 }
165 
166 #endif
ModuleDescription moduleDescription_
void setModuleDescription(ModuleDescription const &md)
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
std::unique_ptr< ParentageID[]> previousParentageIds_
void registerProductsAndCallbacks(EDProducerBase *module, ProductRegistry *reg)
virtual void preForkReleaseResources()
std::unique_ptr< std::vector< BranchID >[]> previousParentages_
ModuleDescription const & moduleDescription() const
virtual void postForkReacquireResources(unsigned int, unsigned int)
HLT enums.
std::string workerType() const
Definition: vlib.h:208
Definition: Run.h:42