Producer.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
12 
13 namespace art::detail {
14 
15  Producer::~Producer() noexcept = default;
16 
17  Producer::Producer(fhicl::ParameterSet const& pset)
18  : checkPutProducts_{pset.get<bool>("errorOnFailureToPut", true)}
19  {}
20 
21  void
23  {
24  setupQueues(resources);
25  ProcessingFrame const frame{ScheduleID{}};
26  beginJobWithFrame(frame);
27  }
28 
29  void
31  {
32  ProcessingFrame const frame{ScheduleID{}};
33  endJobWithFrame(frame);
34  }
35 
36  void
38  {
39  ProcessingFrame const frame{ScheduleID{}};
41  }
42 
43  void
45  {
46  ProcessingFrame const frame{ScheduleID{}};
48  }
49 
50  void
52  {
53  ProcessingFrame const frame{ScheduleID{}};
55  }
56 
57  void
59  {
60  ProcessingFrame const frame{ScheduleID{}};
62  }
63 
64  bool
66  {
67  Run r{rp, mc, RangeSet::forRun(rp.runID())};
68  ProcessingFrame const frame{mc.scheduleID()};
69  beginRunWithFrame(r, frame);
70  r.movePutProductsToPrincipal(rp);
71  return true;
72  }
73 
74  bool
76  {
77  Run r{rp, mc, rp.seenRanges()};
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(r, frame);
80  r.movePutProductsToPrincipal(rp);
81  return true;
82  }
83 
84  bool
86  {
87  SubRun sr{srp, mc, RangeSet::forSubRun(srp.subRunID())};
88  ProcessingFrame const frame{mc.scheduleID()};
89  beginSubRunWithFrame(sr, frame);
90  sr.movePutProductsToPrincipal(srp);
91  return true;
92  }
93 
94  bool
96  {
97  SubRun sr{srp, mc, srp.seenRanges()};
98  ProcessingFrame const frame{mc.scheduleID()};
99  endSubRunWithFrame(sr, frame);
100  sr.movePutProductsToPrincipal(srp);
101  return true;
102  }
103 
104  bool
106  ModuleContext const& mc,
107  std::atomic<size_t>& counts_run,
108  std::atomic<size_t>& counts_passed,
109  std::atomic<size_t>& /*counts_failed*/)
110  {
111  Event e{ep, mc};
112  ++counts_run;
113  ProcessingFrame const frame{mc.scheduleID()};
114  produceWithFrame(e, frame);
115  e.movePutProductsToPrincipal(
116  ep, checkPutProducts_, &expectedProducts<InEvent>());
117  ++counts_passed;
118  return true;
119  }
120 
121 } // namespace art::detail
void doBeginJob(SharedResources const &resources)
Definition: Producer.cc:22
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
RunID const & runID() const
Definition: Principal.cc:1052
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
auto scheduleID() const
Definition: ModuleContext.h:28
bool doBeginRun(RunPrincipal &rp, ModuleContext const &mc)
Definition: Producer.cc:65
Definition: Run.h:17
virtual void endJobWithFrame(ProcessingFrame const &)=0
auto scheduleID() const
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
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
bool const checkPutProducts_
Definition: Producer.h:69
const double e
RangeSet seenRanges() const
Definition: Principal.cc:878
bool doEndSubRun(SubRunPrincipal &srp, ModuleContext const &mc)
Definition: Producer.cc:95
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: Producer.cc:44
SubRunID subRunID() const
Definition: Principal.cc:1058
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
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
static constexpr double sr
Definition: Units.h:166
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51