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"
26 class TransferPFParticleT0;
43 void produce(art::Event&
e)
override;
56 fPFParticleLabelIn(
p.get<art::InputTag>(
"PFParticleLabelIn")),
57 fT0Label(
p.get<art::InputTag>(
"T0Label")),
58 fPFParticleLabelOut(
p.get<art::InputTag>(
"PFParticleLabelOut"))
60 produces<art::Assns<recob::PFParticle, anab::T0>>();
66 std::unique_ptr<art::Assns<recob::PFParticle, anab::T0>> assn(
new art::Assns<recob::PFParticle, anab::T0>);
69 art::Handle<std::vector<recob::PFParticle>> inpfp_handle;
70 e.getByLabel(fPFParticleLabelIn, inpfp_handle);
72 std::vector<art::Ptr<recob::PFParticle>> inpfps;
73 art::fill_ptr_vector(inpfps, inpfp_handle);
75 art::FindManyP<anab::T0> fmT0s(inpfps, e,
fT0Label);
77 art::Handle<std::vector<recob::PFParticle>> outpfp_handle;
78 e.getByLabel(fPFParticleLabelOut, outpfp_handle);
80 std::vector<art::Ptr<recob::PFParticle>> outpfps;
81 art::fill_ptr_vector(outpfps, outpfp_handle);
84 for (
unsigned i_in = 0; i_in < inpfps.size(); i_in++) {
86 const std::vector<art::Ptr<anab::T0>> &t0s = fmT0s.at(i_in);
87 if (!t0s.size())
continue;
89 for (
unsigned i_out = 0; i_out < outpfps.size(); i_out++) {
93 assn->addMany(outpfps.at(i_out), t0s);
99 e.put(std::move(assn));
size_t Self() const
Returns the index of this particle.
TransferPFParticleT0(fhicl::ParameterSet const &p)
fT0Label(p.get< art::InputTag >("T0Label",""))
TransferPFParticleT0 & operator=(TransferPFParticleT0 const &)=delete
art::InputTag fPFParticleLabelIn
Hierarchical representation of particle flow.
art::InputTag fPFParticleLabelOut
void produce(art::Event &e) override