LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Producer.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_detail_Producer_h
2 #define art_Framework_Core_detail_Producer_h
3 // vim: set sw=2 expandtab :
4 
5 //=====================================================
6 // The base class of modules whose main purpose is to
7 // insert products into an Event.
8 //=====================================================
9 
13 #include "art/Framework/Core/fwd.h"
17 
18 #include <cstddef>
19 
20 namespace art::detail {
21  class SharedResources;
22 
23  class Producer : public Modifier {
24  public:
25  template <typename UserConfig, typename KeysToIgnore = void>
27 
28  virtual ~Producer() noexcept;
29  explicit Producer(fhicl::ParameterSet const&);
30  Producer(Producer const&) = delete;
31  Producer(Producer&&) = delete;
32  Producer& operator=(Producer const&) = delete;
33  Producer& operator=(Producer&&) = delete;
34 
35  // Interface provided for the worker.
36  void doBeginJob(SharedResources const& resources);
37  void doEndJob();
39  void doRespondToCloseInputFile(FileBlock const& fb);
40  void doRespondToOpenOutputFiles(FileBlock const& fb);
41  void doRespondToCloseOutputFiles(FileBlock const& fb);
42  bool doBeginRun(RunPrincipal& rp, ModuleContext const& mc);
43  bool doEndRun(RunPrincipal& rp, ModuleContext const& mc);
44  bool doBeginSubRun(SubRunPrincipal& srp, ModuleContext const& mc);
45  bool doEndSubRun(SubRunPrincipal& srp, ModuleContext const& mc);
46  bool doEvent(EventPrincipal& ep,
47  ModuleContext const& mc,
48  std::atomic<std::size_t>& counts_run,
49  std::atomic<std::size_t>& counts_passed,
50  std::atomic<std::size_t>& counts_failed);
51 
52  private:
53  virtual void setupQueues(SharedResources const&) = 0;
54  virtual void beginJobWithFrame(ProcessingFrame const&) = 0;
55  virtual void endJobWithFrame(ProcessingFrame const&) = 0;
56  virtual void respondToOpenInputFileWithFrame(FileBlock const&,
57  ProcessingFrame const&) = 0;
58  virtual void respondToCloseInputFileWithFrame(FileBlock const&,
59  ProcessingFrame const&) = 0;
60  virtual void respondToOpenOutputFilesWithFrame(FileBlock const&,
61  ProcessingFrame const&) = 0;
63  ProcessingFrame const&) = 0;
64  virtual void beginRunWithFrame(Run&, ProcessingFrame const&) = 0;
65  virtual void endRunWithFrame(Run&, ProcessingFrame const&) = 0;
66  virtual void beginSubRunWithFrame(SubRun&, ProcessingFrame const&) = 0;
67  virtual void endSubRunWithFrame(SubRun&, ProcessingFrame const&) = 0;
68  virtual void produceWithFrame(Event&, ProcessingFrame const&) = 0;
69 
70  bool const checkPutProducts_;
71  };
72 
73 } // namespace art::detail
74 
75 #endif /* art_Framework_Core_detail_Producer_h */
76 
77 // Local Variables:
78 // mode: c++
79 // End:
void doBeginJob(SharedResources const &resources)
Definition: Producer.cc:22
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: Producer.cc:37
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
void doRespondToOpenOutputFiles(FileBlock const &fb)
Definition: Producer.cc:51
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
STL namespace.
bool doBeginRun(RunPrincipal &rp, ModuleContext const &mc)
Definition: Producer.cc:65
Definition: Run.h:37
virtual void endJobWithFrame(ProcessingFrame const &)=0
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
void doRespondToCloseOutputFiles(FileBlock const &fb)
Definition: Producer.cc:58
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
bool const checkPutProducts_
Definition: Producer.h:70
bool doEndSubRun(SubRunPrincipal &srp, ModuleContext const &mc)
Definition: Producer.cc:95
parameter set interface
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: Producer.cc:44
bool doEndRun(RunPrincipal &rp, ModuleContext const &mc)
Definition: Producer.cc:75
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
bool doBeginSubRun(SubRunPrincipal &srp, ModuleContext const &mc)
Definition: Producer.cc:85
TFile fb("Li6.root")
bool doEvent(EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
Definition: Producer.cc:105
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
virtual ~Producer() noexcept
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0