AssnsProducer2_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: AssnsProducer2
3 // Plugin Type: producer (art v2_05_00)
4 // File: AssnsProducer2_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"
19 
20 namespace arttest {
21  class AssnsProducer2;
22 }
23 
25 
27 public:
28  explicit AssnsProducer2(fhicl::ParameterSet const& p);
29 
30 private:
31  void produce(art::Event& e) override;
32 
34 };
35 
37  : EDProducer{p}, fInputLabel(p.get<std::string>("input_label"))
38 {
39  produces<art::Assns<int, std::string>>();
40 }
41 
42 void
44 {
46  e.getByLabel(fInputLabel, ih);
48  e.getByLabel(fInputLabel, sh);
49 
50  art::PtrMaker<int> make_intptr(e, ih.id());
51  art::PtrMaker<std::string> make_strptr(e, sh.id());
52 
53  auto assns = std::make_unique<art::Assns<int, std::string>>();
54  for (size_t i = 0; i < 3; ++i) {
55  auto p1 = make_intptr(i);
56  for (size_t j = 0; j < 2; ++j) {
57  auto p2 = make_strptr(i * 2 + j);
58  assns->addSingle(p1, p2);
59  }
60  }
61  e.put(std::move(assns));
62 }
63 
AssnsProducer2(fhicl::ParameterSet const &p)
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
void produce(art::Event &e) override
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:68
p
Definition: test.py:228
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
ProductID id() const
Definition: Handle.h:211