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:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Classes

struct  Config
 
struct  Inputs
 

Public Types

using Parameters = art::EDProducer::Table< Config >
 
- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 

Public Member Functions

 VertexFitter (Parameters const &p)
 
 VertexFitter (VertexFitter const &)=delete
 
 VertexFitter (VertexFitter &&)=delete
 
VertexFitteroperator= (VertexFitter const &)=delete
 
VertexFitteroperator= (VertexFitter &&)=delete
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

void produce (art::Event &e) override
 

Private Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

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 41 of file VertexFitter_module.cc.

Member Typedef Documentation

Definition at line 62 of file VertexFitter_module.cc.

Constructor & Destructor Documentation

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

Definition at line 81 of file VertexFitter_module.cc.

82  : EDProducer{p}
83  , pfParticleInputTag(p().inputs().inputPFParticleLabel())
84  , trackInputTag(p().inputs().inputTracksLabel())
85  , fitter(p().geom3dvtxfit, p().propagator)
86 {
87  produces<std::vector<recob::Vertex>>();
88  produces<art::Assns<recob::PFParticle, recob::Vertex>>();
89  produces<art::Assns<recob::Vertex, recob::Track, recob::VertexAssnMeta>>();
90 }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
art::InputTag pfParticleInputTag
p
Definition: test.py:223
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)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 93 of file VertexFitter_module.cc.

94 {
95  using namespace std;
96 
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>>();
101 
102  const auto& inputPFParticle = e.getValidHandle<vector<recob::PFParticle>>(pfParticleInputTag);
103  art::FindManyP<recob::Track> const assocTracks{inputPFParticle, e, trackInputTag};
104 
105  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(e);
106 
107  // PtrMakers for Assns
108  art::PtrMaker<recob::Vertex> vtxPtrMaker(e);
109 
110  for (size_t iPF = 0; iPF < inputPFParticle->size(); ++iPF) {
111 
112  art::Ptr<recob::PFParticle> pfp(inputPFParticle, iPF);
113  if (pfp->IsPrimary() == false || pfp->NumDaughters() < 2) continue;
114  vector<art::Ptr<recob::Track>> tracks;
115  auto& pfd = pfp->Daughters();
116  for (auto ipfd : pfd) {
117  // Daugthers returns the id as in pfp->Self() not the key
118  // so need to find the key for the pfp with Self==ipfd
119  for (size_t jPF = 0; jPF < inputPFParticle->size(); ++jPF) {
120  art::Ptr<recob::PFParticle> pfpd(inputPFParticle, jPF);
121  if (pfpd->Self() != ipfd) continue;
122  vector<art::Ptr<recob::Track>> pftracks = assocTracks.at(jPF);
123  for (auto t : pftracks) {
124  tracks.push_back(t);
125  }
126  break;
127  }
128  }
129  if (tracks.size() < 2) continue;
130 
131  VertexWrapper vtx = fitter.fitTracks(detProp, tracks);
132  if (vtx.isValid() == false) continue;
133  vtx.setVertexId(outputVertices->size());
134 
135  auto meta = fitter.computeMeta(detProp, vtx, tracks);
136 
137  // Fill the output collections
138 
139  outputVertices->emplace_back(vtx.vertex());
140  const art::Ptr<recob::Vertex> aptr = vtxPtrMaker(outputVertices->size() - 1);
141  outputPFVxAssn->addSingle(art::Ptr<recob::PFParticle>(inputPFParticle, iPF), aptr);
142 
143  size_t itt = 0;
144  for (auto t : tracks) {
145  outputVxTkMtAssn->addSingle(aptr, t, meta[itt]);
146  itt++;
147  }
148  }
149 
150  e.put(std::move(outputVertices));
151  e.put(std::move(outputPFVxAssn));
152  e.put(std::move(outputVxTkMtAssn));
153 }
art::InputTag pfParticleInputTag
STL namespace.
std::vector< recob::VertexAssnMeta > computeMeta(detinfo::DetectorPropertiesData const &detProp, const VertexWrapper &vtx)
const double e
def move(depos, offset)
Definition: depos.py:107
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
art::InputTag trackInputTag
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
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

Member Data Documentation

Geometric3DVertexFitter trkf::VertexFitter::fitter
private

Definition at line 77 of file VertexFitter_module.cc.

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

Definition at line 75 of file VertexFitter_module.cc.

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

Definition at line 76 of file VertexFitter_module.cc.


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