LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ResultsProducer.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
15 
16 #include <string>
17 
18 using namespace hep::concurrency;
19 using namespace std;
20 
22  "ResultsProducer";
23 
24 namespace art {
25 
26  [[noreturn]] std::unique_ptr<Worker>
27  ResultsProducer::doMakeWorker(WorkerParams const&)
28  {
30  << "Cannot call ResultsProducer::doMakeWorker\n";
31  }
32 
33  ResultsProducer::ResultsProducer() noexcept(false)
34  : ProductRegistryHelper{product_creation_mode::produces}
35  {
36  serialize(detail::LegacyResource);
37  }
38 
39  void
40  ResultsProducer::registerProducts(ProductDescriptions& productsToProduce,
41  ModuleDescription const& md)
42  {
43  ProductRegistryHelper::registerProducts(productsToProduce, md);
44  setModuleDescription(md);
45  }
46 
47  void
48  ResultsProducer::doBeginJob()
49  {
50  // If results producers ever become eligible for multi-threaded
51  // execution, the serial task queues will need to be setup here.
52  beginJob();
53  }
54 
55  void
56  ResultsProducer::doEndJob()
57  {
58  endJob();
59  }
60 
61  void
62  ResultsProducer::doBeginRun(RunPrincipal const& rp)
63  {
64  ModuleContext const mc{moduleDescription()};
65  beginRun(rp.makeRun(mc));
66  }
67 
68  void
69  ResultsProducer::doEndRun(RunPrincipal const& rp)
70  {
71  ModuleContext const mc{moduleDescription()};
72  endRun(rp.makeRun(mc));
73  }
74 
75  void
76  ResultsProducer::doBeginSubRun(SubRunPrincipal const& srp)
77  {
78  ModuleContext const mc{moduleDescription()};
79  beginSubRun(srp.makeSubRun(mc));
80  }
81 
82  void
83  ResultsProducer::doEndSubRun(SubRunPrincipal const& srp)
84  {
85  ModuleContext const mc{moduleDescription()};
86  endSubRun(srp.makeSubRun(mc));
87  }
88 
89  void
90  ResultsProducer::doEvent(EventPrincipal const& ep)
91  {
92  ModuleContext const mc{moduleDescription()};
93  event(ep.makeEvent(mc));
94  }
95 
96  void
97  ResultsProducer::doReadResults(ResultsPrincipal const& resp)
98  {
99  ModuleContext const mc{moduleDescription()};
100  readResults(resp.makeResults(mc));
101  }
102 
103  void
104  ResultsProducer::doWriteResults(ResultsPrincipal& resp)
105  {
106  ModuleContext const mc{moduleDescription()};
107  auto res = resp.makeResults(mc);
108  writeResults(res);
109  res.commitProducts();
110  }
111 
112  void
113  ResultsProducer::doClear()
114  {
115  clear();
116  }
117 
118  // Virtual functions to be overridden by users
119  void
120  ResultsProducer::readResults(Results const&)
121  {}
122 
123  void
125  {}
126 
127  void
128  ResultsProducer::endJob()
129  {}
130 
131  void
132  ResultsProducer::beginRun(Run const&)
133  {}
134 
135  void
136  ResultsProducer::endRun(Run const&)
137  {}
138 
139  void
140  ResultsProducer::beginSubRun(SubRun const&)
141  {}
142 
143  void
144  ResultsProducer::endSubRun(SubRun const&)
145  {}
146 
147  void
148  ResultsProducer::event(Event const&)
149  {}
150 
151 } // namespace art
Event makeEvent(ModuleContext const &mc)
STL namespace.
std::vector< BranchDescription > ProductDescriptions
Definition: Run.h:37
SharedResource_t const LegacyResource
Results makeResults(ModuleContext const &mc)
void beginJob()
Definition: Breakpoints.cc:14
Run makeRun(ModuleContext const &mc, RangeSet const &rs=RangeSet::invalid())
Definition: RunPrincipal.cc:24
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Definition: MVAAlg.h:12
SubRun makeSubRun(ModuleContext const &mc, RangeSet const &rs=RangeSet::invalid())
vec_iX clear()
Event finding and building.