8 #include "canvas/Persistency/Common/FindManyP.h" 47 Name(
"inputPFParticleLabel"),
48 Comment(
"Label of recob::PFParticle Collection to be fit")};
50 Name(
"inputTracksLabel"),
51 Comment(
"Label of recob::Track Collection associated to PFParticles")};
85 ,
fitter(
p().geom3dvtxfit,
p().propagator)
87 produces<std::vector<recob::Vertex>>();
88 produces<art::Assns<recob::PFParticle, recob::Vertex>>();
89 produces<art::Assns<recob::Vertex, recob::Track, recob::VertexAssnMeta>>();
97 auto outputVertices = make_unique<vector<recob::Vertex>>();
98 auto outputPFVxAssn = make_unique<art::Assns<recob::PFParticle, recob::Vertex>>();
99 auto outputVxTkMtAssn =
100 make_unique<art::Assns<recob::Vertex, recob::Track, recob::VertexAssnMeta>>();
103 art::FindManyP<recob::Track>
const assocTracks{inputPFParticle,
e,
trackInputTag};
110 for (
size_t iPF = 0; iPF < inputPFParticle->size(); ++iPF) {
114 vector<art::Ptr<recob::Track>>
tracks;
116 for (
auto ipfd : pfd) {
119 for (
size_t jPF = 0; jPF < inputPFParticle->size(); ++jPF) {
121 if (pfpd->
Self() != ipfd)
continue;
122 vector<art::Ptr<recob::Track>> pftracks = assocTracks.at(jPF);
123 for (
auto t : pftracks) {
129 if (tracks.size() < 2)
continue;
132 if (vtx.
isValid() ==
false)
continue;
139 outputVertices->emplace_back(vtx.
vertex());
144 for (
auto t : tracks) {
145 outputVxTkMtAssn->addSingle(aptr,
t, meta[itt]);
const std::vector< size_t > & Daughters() const
Returns the collection of daughter particles.
VertexFitter & operator=(VertexFitter const &)=delete
int NumDaughters() const
Returns the number of daughter particles flowing from this one.
size_t Self() const
Returns the index of this particle.
VertexFitter(Parameters const &p)
Wrapper class to facilitate vertex production.
EDProducer(fhicl::ParameterSet const &pset)
ChannelGroupService::Name Name
art::InputTag pfParticleInputTag
std::vector< recob::VertexAssnMeta > computeMeta(detinfo::DetectorPropertiesData const &detProp, const VertexWrapper &vtx)
3D vertex fitter based on the geometric properties (start position, direction, covariance) of the tra...
Module for fitting a vertex using the Geometric3DVertexFitter.
#define DEFINE_ART_MODULE(klass)
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
art::InputTag trackInputTag
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
bool IsPrimary() const
Returns whether the particle is the root of the flow.
VertexWrapper fitTracks(detinfo::DetectorPropertiesData const &detProp, const std::vector< art::Ptr< recob::Track >> &arttracks) const
void setVertexId(int newID)
Geometric3DVertexFitter fitter
void produce(art::Event &e) override
const recob::Vertex & vertex() const