10 #include "art/Framework/Core/EDProducer.h"
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "art/Framework/Principal/Handle.h"
14 #include "fhiclcpp/ParameterSet.h"
15 #include "art/Persistency/Common/PtrMaker.h"
16 #include "canvas/Persistency/Common/Assns.h"
37 void produce(art::Event &
e)
override;
46 AssnProducer2::AssnProducer2(fhicl::ParameterSet
const &
p)
48 , fInputLabel(
p.get<std::string>(
"input_label"))
50 produces<art::Assns<int, std::string>>();
55 art::Handle<std::vector<int>> ih;
57 art::Handle<std::vector<std::string>> sh;
60 art::PtrMaker<int> make_intptr(e, ih.id());
61 art::PtrMaker<std::string> make_strptr(e, sh.id());
63 auto assns = std::make_unique<art::Assns<int, std::string>>();
64 for (
size_t i=0; i < 3; ++i) {
65 auto p1 = make_intptr(i);
66 for(
size_t j=0; j < 2; ++j) {
67 auto p2 = make_strptr(i*2+j);
68 assns -> addSingle(
p1, p2);
71 e.put(std::move(assns));
AssnProducer2(fhicl::ParameterSet const &p)
void produce(art::Event &e) override
physics associatedGroupsWithLeft p1
AssnProducer2 & operator=(AssnProducer2 const &)=delete