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 TransferTrackT0;
44 void produce(art::Event&
e)
override;
57 fTrackLabelIn(
p.get<art::InputTag>(
"TrackLabelIn")),
58 fT0Label(
p.get<art::InputTag>(
"T0Label")),
59 fTrackLabelOut(
p.get<art::InputTag>(
"TrackLabelOut"))
61 produces<art::Assns<recob::Track, anab::T0>>();
67 std::unique_ptr<art::Assns<recob::Track, anab::T0>> assn(
new art::Assns<recob::Track, anab::T0>);
70 art::Handle<std::vector<recob::Track>> intrack_handle;
71 e.getByLabel(fTrackLabelIn, intrack_handle);
73 std::vector<art::Ptr<recob::Track>> intracks;
74 art::fill_ptr_vector(intracks, intrack_handle);
76 art::FindManyP<anab::T0> fmT0s(intracks, e,
fT0Label);
77 art::FindManyP<recob::PFParticle> fmInParticles(intracks, e, fTrackLabelIn);
79 art::Handle<std::vector<recob::Track>> outtrack_handle;
80 e.getByLabel(fTrackLabelOut, outtrack_handle);
82 std::vector<art::Ptr<recob::Track>> outtracks;
83 art::fill_ptr_vector(outtracks, outtrack_handle);
85 art::FindManyP<recob::PFParticle> fmOutParticles(outtracks, e, fTrackLabelOut);
88 for (
unsigned i_in = 0; i_in < intracks.size(); i_in++) {
90 const std::vector<art::Ptr<anab::T0>> &t0s = fmT0s.at(i_in);
91 if (!t0s.size())
continue;
93 for (
unsigned i_out = 0; i_out < outtracks.size(); i_out++) {
97 assn->addMany(outtracks.at(i_out), t0s);
103 e.put(std::move(assn));
art::InputTag fTrackLabelOut
art::InputTag fTrackLabelIn
size_t Self() const
Returns the index of this particle.
TransferTrackT0 & operator=(TransferTrackT0 const &)=delete
fT0Label(p.get< art::InputTag >("T0Label",""))
TransferTrackT0(fhicl::ParameterSet const &p)
Provides recob::Track data product.
Hierarchical representation of particle flow.
void produce(art::Event &e) override