EDProducer.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_EDProducer_h
2 #define art_Framework_Core_EDProducer_h
3 
4 // ======================================================================
5 //
6 // EDProducer - The base class of "modules" whose main purpose is to
7 // insert new EDProducts into an Event.
8 //
9 // ======================================================================
10 
19 #include "fhiclcpp/ParameterSet.h"
20 
21 #include <memory>
22 #include <string>
23 
24 // ----------------------------------------------------------------------
25 
26 namespace art {
27 
28  class EDProducer : public ProducerBase,
29  public Consumer,
30  public EngineCreator {
31  public:
32  template <typename T>
33  friend class WorkerT;
36 
37  virtual ~EDProducer() = default;
38 
39  template <typename PROD, BranchType B = InEvent>
40  ProductID getProductID(std::string const& instanceName = {}) const;
41 
42  template <typename UserConfig, typename KeysToIgnore = void>
44 
45  protected:
46  // The returned pointer will be null unless the this is currently
47  // executing its event loop function ('produce').
49 
50  private:
52 
54  void doBeginJob();
55  void doEndJob();
56  bool doBeginRun(RunPrincipal& rp, CPC_exempt_ptr cpc);
57  bool doEndRun(RunPrincipal& rp, CPC_exempt_ptr cpc);
64 
66  workerType() const
67  {
68  return "WorkerT<EDProducer>";
69  }
70 
71  virtual void produce(Event&) = 0;
72  virtual void
74  {}
75  virtual void
77  {}
78 
79  virtual void
81  {}
82  virtual void
84  {}
85  virtual void
87  {}
88  virtual void
90  {}
91 
92  virtual void
94  {}
95  virtual void
97  {}
98  virtual void
100  {}
101  virtual void
103  {}
104 
105  void
107  {
109  // Since the module description in the Consumer base class is
110  // owned by pointer, we must give it the owned object of this
111  // class--i.e. moduleDescription_, not md.
113  }
114 
117  bool checkPutProducts_{true};
118  std::set<TypeLabel> missingConsumes_{};
119  }; // EDProducer
120 
121  template <typename PROD, BranchType B>
122  inline ProductID
123  EDProducer::getProductID(std::string const& instanceName) const
124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
128 } // art
129 
130 // ======================================================================
131 
132 #endif /* art_Framework_Core_EDProducer_h */
133 
134 // Local Variables:
135 // mode: c++
136 // End:
CPC_exempt_ptr current_context_
Definition: EDProducer.h:116
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
virtual void beginJob()
Definition: EDProducer.h:73
virtual void endRun(Run &)
Definition: EDProducer.h:86
void doRespondToCloseInputFile(FileBlock const &fb)
virtual void endSubRun(SubRun &)
Definition: EDProducer.h:89
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDProducer.h:96
std::set< TypeLabel > missingConsumes_
Definition: EDProducer.h:118
std::string workerType() const
Definition: EDProducer.h:66
ProductID getProductID(std::string const &instanceName={}) const
Definition: EDProducer.h:123
bool doEvent(EventPrincipal &ep, CPC_exempt_ptr cpcp, CountingStatistics &)
bool doEndRun(RunPrincipal &rp, CPC_exempt_ptr cpc)
Definition: Run.h:31
bool checkPutProducts_
Definition: EDProducer.h:117
virtual void beginSubRun(SubRun &)
Definition: EDProducer.h:83
virtual void beginRun(Run &)
Definition: EDProducer.h:80
bool doEndSubRun(SubRunPrincipal &srp, CPC_exempt_ptr cpc)
bool doBeginRun(RunPrincipal &rp, CPC_exempt_ptr cpc)
virtual void endJob()
Definition: EDProducer.h:76
virtual void respondToCloseOutputFiles(FileBlock const &)
Definition: EDProducer.h:102
void setModuleDescription(ModuleDescription const &md)
virtual void respondToOpenOutputFiles(FileBlock const &)
Definition: EDProducer.h:99
void setModuleDescription(ModuleDescription const &md)
Definition: EDProducer.h:106
bool doBeginSubRun(SubRunPrincipal &srp, CPC_exempt_ptr cpc)
virtual ~EDProducer()=default
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
void doRespondToOpenOutputFiles(FileBlock const &fb)
void doRespondToCloseOutputFiles(FileBlock const &fb)
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDProducer.h:93
void doRespondToOpenInputFile(FileBlock const &fb)
virtual void produce(Event &)=0
CurrentProcessingContext const * currentContext() const