All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
trkf::VertexFitter Class Reference

Module for fitting a vertex using the Geometric3DVertexFitter. More...

Inheritance diagram for trkf::VertexFitter:

Classes

struct  Config
 
struct  Inputs
 

Public Types

using Parameters = art::EDProducer::Table< Config >
 

Public Member Functions

 VertexFitter (Parameters const &p)
 
 VertexFitter (VertexFitter const &)=delete
 
 VertexFitter (VertexFitter &&)=delete
 
VertexFitteroperator= (VertexFitter const &)=delete
 
VertexFitteroperator= (VertexFitter &&)=delete
 

Private Member Functions

void produce (art::Event &e) override
 

Private Attributes

art::InputTag pfParticleInputTag
 
art::InputTag trackInputTag
 
Geometric3DVertexFitter fitter
 

Detailed Description

Module for fitting a vertex using the Geometric3DVertexFitter.

It selects primary PFParticles, and then collects all tracks associated to its daughters; if at least 2 tracks are found, they are passed to the vertex fitter.

Inputs are: a PFParticle collection, and the associated tracks.

Outputs are: vector of recob::Vertex, Assns of (neutrino) recob::PFParticle to recob::Vertex, Assns of recob::Vertex and recob::Track with recob::VertexAssnMeta.

For configuration options see Geometric3DVertexFitter::Parameters

Author
G. Cerati (FNAL, MicroBooNE)
Date
2017
Version
1.0

Definition at line 42 of file VertexFitter_module.cc.

Member Typedef Documentation

using trkf::VertexFitter::Parameters = art::EDProducer::Table<Config>

Definition at line 63 of file VertexFitter_module.cc.

Constructor & Destructor Documentation

trkf::VertexFitter::VertexFitter ( Parameters const &  p)
explicit

Definition at line 82 of file VertexFitter_module.cc.

83  : EDProducer{p}
84  , pfParticleInputTag(p().inputs().inputPFParticleLabel())
85  , trackInputTag(p().inputs().inputTracksLabel())
86  , fitter(p().geom3dvtxfit, p().propagator)
87 {
88  produces<std::vector<recob::Vertex>>();
89  produces<art::Assns<recob::PFParticle, recob::Vertex>>();
90  produces<art::Assns<recob::Vertex, recob::Track, recob::VertexAssnMeta>>();
91 }
pdgs p
Definition: selectors.fcl:22
art::InputTag pfParticleInputTag
art::InputTag trackInputTag
Geometric3DVertexFitter fitter
trkf::VertexFitter::VertexFitter ( VertexFitter const &  )
delete
trkf::VertexFitter::VertexFitter ( VertexFitter &&  )
delete

Member Function Documentation

VertexFitter& trkf::VertexFitter::operator= ( VertexFitter const &  )
delete
VertexFitter& trkf::VertexFitter::operator= ( VertexFitter &&  )
delete
void trkf::VertexFitter::produce ( art::Event &  e)
overrideprivate

Definition at line 94 of file VertexFitter_module.cc.

95 {
96  using namespace std;
97 
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>>();
102 
103  const auto& inputPFParticle = e.getValidHandle<vector<recob::PFParticle>>(pfParticleInputTag);
104  art::FindManyP<recob::Track> const assocTracks{inputPFParticle, e, trackInputTag};
105 
106  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(e);
107 
108  // PtrMakers for Assns
109  art::PtrMaker<recob::Vertex> vtxPtrMaker(e);
110 
111  for (size_t iPF = 0; iPF < inputPFParticle->size(); ++iPF) {
112 
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) {
118  // Daugthers returns the id as in pfp->Self() not the key
119  // so need to find the key for the pfp with Self==ipfd
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) {
125  tracks.push_back(t);
126  }
127  break;
128  }
129  }
130  if (tracks.size() < 2) continue;
131 
132  VertexWrapper vtx = fitter.fitTracks(detProp, tracks);
133  if (vtx.isValid() == false) continue;
134  vtx.setVertexId(outputVertices->size());
135 
136  auto meta = fitter.computeMeta(detProp, vtx, tracks);
137 
138  // Fill the output collections
139 
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);
143 
144  size_t itt = 0;
145  for (auto t : tracks) {
146  outputVxTkMtAssn->addSingle(aptr, t, meta[itt]);
147  itt++;
148  }
149  }
150 
151  e.put(std::move(outputVertices));
152  e.put(std::move(outputPFVxAssn));
153  e.put(std::move(outputVxTkMtAssn));
154 }
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
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)
Definition: VertexWrapper.h:41
Geometric3DVertexFitter fitter
do i e
auto const detProp

Member Data Documentation

Geometric3DVertexFitter trkf::VertexFitter::fitter
private

Definition at line 78 of file VertexFitter_module.cc.

art::InputTag trkf::VertexFitter::pfParticleInputTag
private

Definition at line 76 of file VertexFitter_module.cc.

art::InputTag trkf::VertexFitter::trackInputTag
private

Definition at line 77 of file VertexFitter_module.cc.


The documentation for this class was generated from the following file: