IntArrayProducer_module.cc
Go to the documentation of this file.
1 // ======================================================================
2 // Produces an IntArray instance.
3 // ======================================================================
4 
10 
11 #include <memory>
12 
13 namespace {
14  constexpr std::size_t sz{4u};
15 }
16 
17 namespace arttest {
18  class IntArrayProducer;
19 }
20 
22 public:
23  struct Config {
24  };
26  explicit IntArrayProducer(Parameters const& ps) : EDProducer{ps}
27  {
28  produces<IntArray<sz>>();
29  }
30 
31 private:
32  void
33  produce(art::Event& e) override
34  {
35  int const value = e.id().event();
36  auto p = std::make_unique<IntArray<sz>>();
37  for (int k = 0; k != sz; ++k) {
38  p->arr[k] = value + k;
39  }
40  e.put(move(p));
41  }
42 
43 }; // IntArrayProducer
44 
static const double ps
Definition: Units.h:103
EDProducer()=default
IntArrayProducer(Parameters const &ps)
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:68
p
Definition: test.py:228
void produce(art::Event &e) override
EventNumber_t event() const
Definition: EventID.h:117
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
EventID id() const
Definition: Event.cc:37