98 auto outputVertices = make_unique<vector<recob::Vertex>>();
99 auto outputPFVxAssn = make_unique<art::Assns<recob::PFParticle, recob::Vertex>>();
100 auto outputVxTkMtAssn =
101 make_unique<art::Assns<recob::Vertex, recob::Track, recob::VertexAssnMeta>>();
103 const auto& inputPFParticle =
e.getValidHandle<vector<recob::PFParticle>>(
pfParticleInputTag);
104 art::FindManyP<recob::Track>
const assocTracks{inputPFParticle,
e,
trackInputTag};
106 auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(
e);
109 art::PtrMaker<recob::Vertex> vtxPtrMaker(
e);
111 for (
size_t iPF = 0; iPF < inputPFParticle->size(); ++iPF) {
113 art::Ptr<recob::PFParticle> pfp(inputPFParticle, iPF);
114 if (pfp->IsPrimary() ==
false || pfp->NumDaughters() < 2)
continue;
115 vector<art::Ptr<recob::Track>>
tracks;
116 auto& pfd = pfp->Daughters();
117 for (
auto ipfd : pfd) {
120 for (
size_t jPF = 0; jPF < inputPFParticle->size(); ++jPF) {
121 art::Ptr<recob::PFParticle> pfpd(inputPFParticle, jPF);
122 if (pfpd->Self() != ipfd)
continue;
123 vector<art::Ptr<recob::Track>> pftracks = assocTracks.at(jPF);
124 for (
auto t : pftracks) {
130 if (tracks.size() < 2)
continue;
133 if (vtx.isValid() ==
false)
continue;
140 outputVertices->emplace_back(vtx.vertex());
141 const art::Ptr<recob::Vertex> aptr = vtxPtrMaker(outputVertices->size() - 1);
142 outputPFVxAssn->addSingle(art::Ptr<recob::PFParticle>(inputPFParticle, iPF), aptr);
145 for (
auto t : tracks) {
146 outputVxTkMtAssn->addSingle(aptr, t, meta[itt]);
151 e.put(std::move(outputVertices));
152 e.put(std::move(outputPFVxAssn));
153 e.put(std::move(outputVxTkMtAssn));
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
ClusterModuleLabel join with tracks
art::InputTag pfParticleInputTag
std::vector< recob::VertexAssnMeta > computeMeta(detinfo::DetectorPropertiesData const &detProp, const VertexWrapper &vtx)
art::InputTag trackInputTag
VertexWrapper fitTracks(detinfo::DetectorPropertiesData const &detProp, const std::vector< art::Ptr< recob::Track >> &arttracks) const
void setVertexId(int newID)
Geometric3DVertexFitter fitter