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 "art/Framework/Principal/Run.h"
15 #include "art/Framework/Principal/SubRun.h"
16 #include "canvas/Utilities/InputTag.h"
17 #include "fhiclcpp/ParameterSet.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
27 class TransferPFParticleFlashMatch;
44 void produce(art::Event&
e)
override;
57 fPFParticleLabelIn(
p.get<art::InputTag>(
"PFParticleLabelIn")),
58 fFlashLabel(
p.get<art::InputTag>(
"FlashLabel")),
59 fPFParticleLabelOut(
p.get<art::InputTag>(
"PFParticleLabelOut"))
61 produces<art::Assns<recob::PFParticle, sbn::SimpleFlashMatch>>();
67 std::unique_ptr<art::Assns<recob::PFParticle, sbn::SimpleFlashMatch>> assn(
new art::Assns<recob::PFParticle, sbn::SimpleFlashMatch>);
70 art::Handle<std::vector<recob::PFParticle>> inpfp_handle;
71 e.getByLabel(fPFParticleLabelIn, inpfp_handle);
73 std::vector<art::Ptr<recob::PFParticle>> inpfps;
74 art::fill_ptr_vector(inpfps, inpfp_handle);
76 art::FindManyP<sbn::SimpleFlashMatch> fmFlash(inpfps, e, fFlashLabel);
78 art::Handle<std::vector<recob::PFParticle>> outpfp_handle;
79 e.getByLabel(fPFParticleLabelOut, outpfp_handle);
81 std::vector<art::Ptr<recob::PFParticle>> outpfps;
82 art::fill_ptr_vector(outpfps, outpfp_handle);
85 for (
unsigned i_in = 0; i_in < inpfps.size(); i_in++) {
87 const std::vector<art::Ptr<sbn::SimpleFlashMatch>> &flashVec = fmFlash.at(i_in);
88 if (!flashVec.size())
continue;
90 for (
unsigned i_out = 0; i_out < outpfps.size(); i_out++) {
94 assn->addMany(outpfps.at(i_out), flashVec);
100 e.put(std::move(assn));
TransferPFParticleFlashMatch(fhicl::ParameterSet const &p)
size_t Self() const
Returns the index of this particle.
art::InputTag fFlashLabel
art::InputTag fPFParticleLabelIn
TransferPFParticleFlashMatch & operator=(TransferPFParticleFlashMatch const &)=delete
void produce(art::Event &e) override
Hierarchical representation of particle flow.
art::InputTag fPFParticleLabelOut