ToyProductProducerMultiput_module.cc
Go to the documentation of this file.
1 //--------------------------------------------------------------------
2 //
3 // Produces a ToyProductProducer instance.
4 //
5 //--------------------------------------------------------------------
6 
14 
15 #include "fhiclcpp/types/Atom.h"
16 
18 
19 namespace {
20  using namespace fhicl;
21  struct Config {
22  Atom<unsigned long> branchType{Name("branchType")};
23  };
24 } // namespace
25 
26 namespace art {
27  namespace test {
28  class ToyProductProducerMultiput;
29  }
30 } // namespace art
31 
33 
36 
37 public:
40  : EDProducer{p}, branchType_{BranchType(p().branchType())}
41  {
42  run_time_produces<IntProduct>(this, branchType_);
43  }
44 
45 private:
46  void
47  produce(Event& e) override
48  {
49  if (branchType_ != InEvent)
50  return;
51  e.put(std::make_unique<IntProduct>(1));
52  e.put(std::make_unique<IntProduct>(2));
53  }
54 
55  void
56  endSubRun(SubRun& sr) override
57  {
58  if (branchType_ != InSubRun)
59  return;
60  sr.put(std::make_unique<IntProduct>(3), subRunFragment());
61  sr.put(std::make_unique<IntProduct>(4), subRunFragment());
62  }
63 
64  void
65  endRun(Run& r) override
66  {
67  if (branchType_ != InRun)
68  return;
69  r.put(std::make_unique<IntProduct>(5), runFragment());
70  r.put(std::make_unique<IntProduct>(6), runFragment());
71  }
72 };
73 
Definition: test.py:1
Definition: Run.h:21
constexpr auto runFragment()
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:68
parameter set interface
p
Definition: test.py:228
constexpr auto subRunFragment()
BranchType
Definition: BranchType.h:18
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
static const double sr
Definition: Units.h:167
AdcRoiViewer::Name Name