AssnsIterProducer2_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: AssnsIterProducer2
3 // Plugin Type: producer (art v2_05_00)
4 // File: AssnsIterProducer2_module.cc
5 //
6 // Generated at Tue Dec 13 14:04:05 2016 by Saba Sehrish using cetskelgen
7 // from cetlib version v1_21_00.
8 ////////////////////////////////////////////////////////////////////////
9 
18 #include "fhiclcpp/ParameterSet.h"
20 
21 namespace arttest {
22  class AssnsIterProducer2;
23 }
24 
26 
28 public:
29  explicit AssnsIterProducer2(fhicl::ParameterSet const& p);
30 
31 private:
32  void produce(art::Event& e) override;
33 
35 };
36 
38  : EDProducer{p}, fInputLabel(p.get<std::string>("input_label"))
39 {
40  produces<art::Assns<int, float, std::string>>();
41 }
42 
43 void
45 {
47  e.getByLabel(fInputLabel, ih);
49  e.getByLabel(fInputLabel, sh);
51  e.getByLabel(fInputLabel, fh);
52 
53  art::PtrMaker<int> make_intptr(e, ih.id());
54  art::PtrMaker<float> make_floatptr(e, fh.id());
55 
56  auto assns = std::make_unique<art::Assns<int, float, std::string>>();
57  for (size_t i = 0; i < 3; ++i) {
58  auto p1 = make_intptr(i);
59  for (size_t j = 0; j < 2; ++j) {
60  auto p2 = make_floatptr(i * 2 + j);
61  assns->addSingle(p1, p2, sh->at(i * 2 + j));
62  }
63  }
64  e.put(std::move(assns));
65 }
66 
std::string string
Definition: nybbler.cc:12
EDProducer()=default
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:435
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:68
void produce(art::Event &e) override
p
Definition: test.py:228
AssnsIterProducer2(fhicl::ParameterSet const &p)
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
ProductID id() const
Definition: Handle.h:211