LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
trkf::KalmanFilterFinalTrackFitter Class Reference
Inheritance diagram for trkf::KalmanFilterFinalTrackFitter:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Classes

struct  Config
 
struct  Inputs
 
struct  Options
 

Public Types

using Parameters = art::EDProducer::Table< Config >
 
using ModuleType = EDProducer
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 KalmanFilterFinalTrackFitter (Parameters const &p)
 
 KalmanFilterFinalTrackFitter (KalmanFilterFinalTrackFitter const &)=delete
 
 KalmanFilterFinalTrackFitter (KalmanFilterFinalTrackFitter &&)=delete
 
KalmanFilterFinalTrackFitteroperator= (KalmanFilterFinalTrackFitter const &)=delete
 
KalmanFilterFinalTrackFitteroperator= (KalmanFilterFinalTrackFitter &&)=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)
 
void fillProductDescriptions ()
 
void registerProducts (ProductDescriptions &productsToRegister)
 
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)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
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 ()
 

Private Member Functions

void produce (art::Event &e) override
 
double setMomValue (art::Ptr< recob::Track > ptrack, const std::unique_ptr< art::FindManyP< anab::Calorimetry >> &trackCalo, const double pMC, const int pId) const
 
int setPId (const unsigned int iTrack, const std::unique_ptr< art::FindManyP< anab::ParticleID >> &trackId, const int pfPid=0) const
 
bool setDirFlip (const recob::Track &track, TVector3 &mcdir, const std::vector< art::Ptr< recob::Vertex >> *vertices=0) const
 
void restoreInputPoints (const recob::Trajectory &track, const std::vector< art::Ptr< recob::Hit >> &inHits, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits) const
 

Private Attributes

Parameters p_
 
TrackStatePropagator prop
 
trkf::TrackKalmanFitter kalmanFitter
 
trkf::TrackMomentumCalculator tmc {}
 
bool inputFromPF
 
art::InputTag pfParticleInputTag
 
art::InputTag trackInputTag
 
art::InputTag showerInputTag
 
art::InputTag caloInputTag
 
art::InputTag pidInputTag
 
art::InputTag simTrackInputTag
 
std::unique_ptr< art::FindManyP< anab::Calorimetry > > trackCalo
 
std::unique_ptr< art::FindManyP< anab::ParticleID > > trackId
 
std::unique_ptr< art::FindManyP< recob::Track > > assocTracks
 
std::unique_ptr< art::FindManyP< recob::Shower > > assocShowers
 
std::unique_ptr< art::FindManyP< recob::Vertex > > assocVertices
 

Detailed Description

Definition at line 41 of file KalmanFilterFinalTrackFitter_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 26 of file Producer.h.

Constructor & Destructor Documentation

KalmanFilterFinalTrackFitter::KalmanFilterFinalTrackFitter ( Parameters const &  p)
explicit

Definition at line 192 of file KalmanFilterFinalTrackFitter_module.cc.

References caloInputTag, inputFromPF, kalmanFitter, p_, pfParticleInputTag, pidInputTag, prop, showerInputTag, simTrackInputTag, and trackInputTag.

194  : EDProducer{p}
195  , p_(p)
196  , prop{p_().propagator}
197  , kalmanFitter{&prop, p_().fitter}
198  , inputFromPF{p_().options().trackFromPF() || p_().options().showerFromPF()}
199 {
200 
201  if (inputFromPF) {
202  pfParticleInputTag = art::InputTag(p_().inputs().inputPFParticleLabel());
203  if (p_().options().showerFromPF())
204  showerInputTag = art::InputTag(p_().inputs().inputShowersLabel());
205  }
206  else {
207  trackInputTag = art::InputTag(p_().inputs().inputTracksLabel());
208  if (p_().options().idFromCollection())
209  pidInputTag = art::InputTag(p_().inputs().inputPidLabel());
210  }
211  if (p_().options().pFromCalo()) caloInputTag = art::InputTag(p_().inputs().inputCaloLabel());
212  if (p_().options().pFromMC() || p_().options().dirFromMC())
213  simTrackInputTag = art::InputTag(p_().inputs().inputMCLabel());
214 
215  produces<std::vector<recob::Track>>();
216  produces<art::Assns<recob::Track, recob::Hit, recob::TrackHitMeta>>();
217  produces<art::Assns<recob::Track, recob::Hit>>();
218  if (inputFromPF) { produces<art::Assns<recob::PFParticle, recob::Track>>(); }
219  if (p_().options().produceTrackFitHitInfo()) {
220  produces<std::vector<std::vector<recob::TrackFitHitInfo>>>();
221  }
222  if (p_().options().produceSpacePoints()) {
223  produces<std::vector<recob::SpacePoint>>();
224  produces<art::Assns<recob::Hit, recob::SpacePoint>>();
225  }
226 
227  //throw expections to avoid possible silent failures due to incompatible configuration options
228  if (p_().options().trackFromPF() == 0 && p_().options().idFromPF())
229  throw cet::exception("KalmanFilterFinalTrackFitter")
230  << "Incompatible configuration parameters: cannot use idFromPF=true with trackFromPF=false."
231  << "\n";
232  if (p_().options().trackFromPF() == 0 && p_().options().dirFromVtxPF())
233  throw cet::exception("KalmanFilterFinalTrackFitter")
234  << "Incompatible configuration parameters: cannot use dirFromVtxPF=true with "
235  "trackFromPF=false."
236  << "\n";
237 
238  unsigned int nIds = 0;
239  if (p_().options().idFromPF()) nIds++;
240  if (p_().options().idFromCollection()) nIds++;
241  if (nIds > 1) {
242  throw cet::exception("KalmanFilterFinalTrackFitter")
243  << "Incompatible configuration parameters: only at most one can be set to true among "
244  "idFromPF and idFromCollection."
245  << "\n";
246  }
247 
248  unsigned int nDirs = 0;
249  if (p_().options().dirFromVtxPF()) nDirs++;
250  if (p_().options().dirFromMC()) nDirs++;
251  if (p_().options().dirFromVec()) nDirs++;
252  if (p_().options().alwaysInvertDir()) nDirs++;
253  if (nDirs > 1) {
254  throw cet::exception("KalmanFilterFinalTrackFitter")
255  << "Incompatible configuration parameters: only at most one can be set to true among "
256  "dirFromVtxPF, dirFromMC, dirFromVec, and alwaysInvertDir."
257  << "\n";
258  }
259 
260  unsigned int nPFroms = 0;
261  if (p_().options().pFromCalo()) nPFroms++;
262  if (p_().options().pFromMSChi2()) nPFroms++;
263  if (p_().options().pFromLength()) nPFroms++;
264  if (p_().options().pFromMC()) nPFroms++;
265  if (nPFroms > 1) {
266  throw cet::exception("KalmanFilterFinalTrackFitter")
267  << "Incompatible configuration parameters: only at most one can be set to true among "
268  "pFromCalo, pFromMSChi2, pFromLength, and pFromMC."
269  << "\n";
270  }
271 
272  if (p_().options().keepInputTrajectoryPoints()) {
273  if (p_().fitter().sortHitsByPlane() || p_().fitter().sortOutputHitsMinLength() ||
274  p_().fitter().skipNegProp()) {
275  throw cet::exception("KalmanFilterTrajectoryFitter")
276  << "Incompatible configuration parameters: keepInputTrajectoryPoints needs the following "
277  "fitter options all set to false: sortHitsByPlane, sortOutputHitsMinLength, skipNegProp."
278  << "\n";
279  }
280  }
281 
282  if (p_().options().showerFromPF()) {
283  if (nPFroms > 0 || nIds > 0 || nDirs > 0) {
284  throw cet::exception("KalmanFilterTrajectoryFitter")
285  << "Incompatible configuration parameters: showerFromPF currently does not support "
286  "optional momentum values, particle hypotheses and directions."
287  << "\n";
288  }
289  }
290 }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
trkf::KalmanFilterFinalTrackFitter::KalmanFilterFinalTrackFitter ( KalmanFilterFinalTrackFitter const &  )
delete
trkf::KalmanFilterFinalTrackFitter::KalmanFilterFinalTrackFitter ( KalmanFilterFinalTrackFitter &&  )
delete

Member Function Documentation

template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Producer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 22 of file Producer.cc.

References art::detail::Producer::beginJobWithFrame(), and art::detail::Producer::setupQueues().

23  {
24  setupQueues(resources);
25  ProcessingFrame const frame{ScheduleID{}};
26  beginJobWithFrame(frame);
27  }
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 65 of file Producer.cc.

References art::detail::Producer::beginRunWithFrame(), art::RangeSet::forRun(), art::RunPrincipal::makeRun(), r, art::RunPrincipal::runID(), and art::ModuleContext::scheduleID().

66  {
67  auto r = rp.makeRun(mc, RangeSet::forRun(rp.runID()));
68  ProcessingFrame const frame{mc.scheduleID()};
69  beginRunWithFrame(r, frame);
70  r.commitProducts();
71  return true;
72  }
TRandom r
Definition: spectrum.C:23
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 85 of file Producer.cc.

References art::detail::Producer::beginSubRunWithFrame(), art::RangeSet::forSubRun(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::SubRunPrincipal::subRunID().

86  {
87  auto sr = srp.makeSubRun(mc, RangeSet::forSubRun(srp.subRunID()));
88  ProcessingFrame const frame{mc.scheduleID()};
89  beginSubRunWithFrame(sr, frame);
90  sr.commitProducts();
91  return true;
92  }
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
void art::detail::Producer::doEndJob ( )
inherited

Definition at line 30 of file Producer.cc.

References art::detail::Producer::endJobWithFrame().

31  {
32  ProcessingFrame const frame{ScheduleID{}};
33  endJobWithFrame(frame);
34  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 75 of file Producer.cc.

References art::detail::Producer::endRunWithFrame(), art::RunPrincipal::makeRun(), r, art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

76  {
77  auto r = rp.makeRun(mc, rp.seenRanges());
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(r, frame);
80  r.commitProducts();
81  return true;
82  }
TRandom r
Definition: spectrum.C:23
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 95 of file Producer.cc.

References art::detail::Producer::endSubRunWithFrame(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

96  {
97  auto sr = srp.makeSubRun(mc, srp.seenRanges());
98  ProcessingFrame const frame{mc.scheduleID()};
99  endSubRunWithFrame(sr, frame);
100  sr.commitProducts();
101  return true;
102  }
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool art::detail::Producer::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 
)
inherited

Definition at line 105 of file Producer.cc.

References art::detail::Producer::checkPutProducts_, e, art::EventPrincipal::makeEvent(), art::detail::Producer::produceWithFrame(), and art::ModuleContext::scheduleID().

110  {
111  auto e = ep.makeEvent(mc);
112  ++counts_run;
113  ProcessingFrame const frame{mc.scheduleID()};
114  produceWithFrame(e, frame);
115  e.commitProducts(checkPutProducts_, &expectedProducts<InEvent>());
116  ++counts_passed;
117  return true;
118  }
bool const checkPutProducts_
Definition: Producer.h:70
Float_t e
Definition: plot.C:35
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 44 of file Producer.cc.

References art::detail::Producer::respondToCloseInputFileWithFrame().

45  {
46  ProcessingFrame const frame{ScheduleID{}};
48  }
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 58 of file Producer.cc.

References art::detail::Producer::respondToCloseOutputFilesWithFrame().

59  {
60  ProcessingFrame const frame{ScheduleID{}};
62  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 37 of file Producer.cc.

References art::detail::Producer::respondToOpenInputFileWithFrame().

38  {
39  ProcessingFrame const frame{ScheduleID{}};
41  }
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 51 of file Producer.cc.

References art::detail::Producer::respondToOpenOutputFilesWithFrame().

52  {
53  ProcessingFrame const frame{ScheduleID{}};
55  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::Modifier::fillProductDescriptions ( )
inherited

Definition at line 10 of file Modifier.cc.

References art::ProductRegistryHelper::fillDescriptions(), and art::ModuleBase::moduleDescription().

11  {
13  }
void fillDescriptions(ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
KalmanFilterFinalTrackFitter& trkf::KalmanFilterFinalTrackFitter::operator= ( KalmanFilterFinalTrackFitter const &  )
delete
KalmanFilterFinalTrackFitter& trkf::KalmanFilterFinalTrackFitter::operator= ( KalmanFilterFinalTrackFitter &&  )
delete
void KalmanFilterFinalTrackFitter::produce ( art::Event e)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 292 of file KalmanFilterFinalTrackFitter_module.cc.

References assocShowers, assocTracks, assocVertices, art::Assns< L, R, D >::begin(), caloInputTag, dir, recob::Shower::Direction(), e, art::Assns< L, R, D >::end(), recob::Track::EndCovarianceLocal5D(), trkf::TrackKalmanFitter::fitTrack(), art::ProductRetriever::getProductID(), art::ProductRetriever::getValidHandle(), recob::Shower::ID(), recob::Track::ID(), trkmkr::OptionalOutputs::initTrackFitInfos(), inputFromPF, kalmanFitter, sim::MCStep::Momentum(), p_, sim::MCTrack::PdgCode(), pfParticleInputTag, pidInputTag, sim::MCTrack::Process(), art::ProductRetriever::productGetter(), art::Event::put(), restoreInputPoints(), setDirFlip(), setMomValue(), setPId(), showerInputTag, recob::Shower::ShowerStart(), simTrackInputTag, art::Assns< L, R, D >::size(), sim::MCTrack::Start(), track, trackCalo, trkmkr::OptionalOutputs::trackFitHitInfos(), trackId, trackInputTag, recob::Track::Trajectory(), recob::TrackTrajectory::Trajectory(), and recob::Track::VertexCovarianceLocal5D().

293 {
294  auto outputTracks = std::make_unique<std::vector<recob::Track>>();
295  auto outputHitsMeta =
296  std::make_unique<art::Assns<recob::Track, recob::Hit, recob::TrackHitMeta>>();
297  auto outputHits = std::make_unique<art::Assns<recob::Track, recob::Hit>>();
298  auto outputHitInfo = std::make_unique<std::vector<std::vector<recob::TrackFitHitInfo>>>();
299 
300  auto const tid = e.getProductID<std::vector<recob::Track>>();
301  auto const tidgetter = e.productGetter(tid);
302 
303  auto outputSpacePoints = std::make_unique<std::vector<recob::SpacePoint>>();
304  auto outputHitSpacePointAssn = std::make_unique<art::Assns<recob::Hit, recob::SpacePoint>>();
305  auto const spid = e.getProductID<std::vector<recob::SpacePoint>>();
306  auto const spidgetter = e.productGetter(spid);
307 
308  //FIXME, eventually remove this (ok only for single particle MC)
309  double pMC = -1.;
310  TVector3 mcdir;
311  if (p_().options().pFromMC() || p_().options().dirFromMC()) {
313  e.getValidHandle<std::vector<sim::MCTrack>>(simTrackInputTag);
314  for (unsigned int iMC = 0; iMC < simTracks->size(); ++iMC) {
315  const sim::MCTrack& mctrack = simTracks->at(iMC);
316  //fiducial cuts on MC tracks
317  if (mctrack.PdgCode() != 13) continue;
318  if (mctrack.Process() != "primary") continue;
319  pMC = mctrack.Start().Momentum().P() * 0.001;
320  mcdir = TVector3(mctrack.Start().Momentum().X() * 0.001 / pMC,
321  mctrack.Start().Momentum().Y() * 0.001 / pMC,
322  mctrack.Start().Momentum().Z() * 0.001 / pMC);
323  break;
324  }
325  }
326 
327  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(e);
328 
329  if (inputFromPF) {
330 
331  auto outputPFAssn = std::make_unique<art::Assns<recob::PFParticle, recob::Track>>();
332 
333  auto inputPFParticle = e.getValidHandle<std::vector<recob::PFParticle>>(pfParticleInputTag);
334  if (p_().options().trackFromPF())
335  assocTracks =
336  std::make_unique<art::FindManyP<recob::Track>>(inputPFParticle, e, pfParticleInputTag);
337  if (p_().options().showerFromPF())
338  assocShowers =
339  std::make_unique<art::FindManyP<recob::Shower>>(inputPFParticle, e, showerInputTag);
340  assocVertices =
341  std::make_unique<art::FindManyP<recob::Vertex>>(inputPFParticle, e, pfParticleInputTag);
342 
343  for (unsigned int iPF = 0; iPF < inputPFParticle->size(); ++iPF) {
344 
345  if (p_().options().trackFromPF()) {
346  const std::vector<art::Ptr<recob::Track>>& tracks = assocTracks->at(iPF);
347  auto const& tkHitsAssn =
349  const std::vector<art::Ptr<recob::Vertex>>& vertices = assocVertices->at(iPF);
350 
351  if (p_().options().pFromCalo()) {
352  trackCalo = std::make_unique<art::FindManyP<anab::Calorimetry>>(tracks, e, caloInputTag);
353  }
354 
355  for (unsigned int iTrack = 0; iTrack < tracks.size(); ++iTrack) {
356 
357  const recob::Track& track = *tracks[iTrack];
358  art::Ptr<recob::Track> ptrack = tracks[iTrack];
359  const int pId = setPId(iTrack, trackId, inputPFParticle->at(iPF).PdgCode());
360  const double mom = setMomValue(ptrack, trackCalo, pMC, pId);
361  const bool flipDir = setDirFlip(track, mcdir, &vertices);
362 
363  //this is not computationally optimal, but at least preserves the order unlike FindManyP
364  std::vector<art::Ptr<recob::Hit>> inHits;
365  for (auto it = tkHitsAssn.begin(); it != tkHitsAssn.end(); ++it) {
366  if (it->first == ptrack)
367  inHits.push_back(it->second);
368  else if (inHits.size() > 0)
369  break;
370  }
371 
372  recob::Track outTrack;
373  std::vector<art::Ptr<recob::Hit>> outHits;
374  trkmkr::OptionalOutputs optionals;
375  if (p_().options().produceTrackFitHitInfo()) optionals.initTrackFitInfos();
376  bool fitok = kalmanFitter.fitTrack(detProp,
377  track.Trajectory(),
378  track.ID(),
379  track.VertexCovarianceLocal5D(),
380  track.EndCovarianceLocal5D(),
381  inHits,
382  mom,
383  pId,
384  flipDir,
385  outTrack,
386  outHits,
387  optionals);
388  if (!fitok) continue;
389 
390  if (p_().options().keepInputTrajectoryPoints()) {
391  restoreInputPoints(track.Trajectory().Trajectory(), inHits, outTrack, outHits);
392  }
393 
394  outputTracks->emplace_back(std::move(outTrack));
395  art::Ptr<recob::Track> aptr(tid, outputTracks->size() - 1, tidgetter);
396  unsigned int ip = 0;
397  for (auto const& trhit : outHits) {
398  //the fitter produces collections with 1-1 match between hits and point
399  recob::TrackHitMeta metadata(ip, -1);
400  outputHitsMeta->addSingle(aptr, trhit, metadata);
401  outputHits->addSingle(aptr, trhit);
402  ip++;
403  }
404  outputPFAssn->addSingle(art::Ptr<recob::PFParticle>(inputPFParticle, iPF), aptr);
405  outputHitInfo->emplace_back(optionals.trackFitHitInfos());
406  }
407  }
408 
409  if (p_().options().showerFromPF()) {
410  art::Ptr<recob::PFParticle> pPF(inputPFParticle, iPF);
411  const std::vector<art::Ptr<recob::Shower>>& showers = assocShowers->at(iPF);
412  if (showers.size() == 0) continue;
413  auto const& pfClustersAssn =
415  auto const& clHitsAssn =
417  std::vector<art::Ptr<recob::Hit>> inHits;
418  for (auto itpf = pfClustersAssn.begin(); itpf != pfClustersAssn.end(); ++itpf) {
419  if (itpf->first == pPF) {
420  art::Ptr<recob::Cluster> clust = itpf->second;
421  for (auto it = clHitsAssn.begin(); it != clHitsAssn.end(); ++it) {
422  if (it->first == clust) inHits.push_back(it->second);
423  }
424  }
425  else if (inHits.size() > 0)
426  break;
427  }
428  for (unsigned int iShower = 0; iShower < showers.size(); ++iShower) {
429  const recob::Shower& shower = *showers[iShower];
430  recob::Track outTrack;
431  std::vector<art::Ptr<recob::Hit>> outHits;
432  trkmkr::OptionalOutputs optionals;
433  if (p_().options().produceTrackFitHitInfo()) optionals.initTrackFitInfos();
434  Point_t pos(shower.ShowerStart().X(), shower.ShowerStart().Y(), shower.ShowerStart().Z());
435  Vector_t dir(shower.Direction().X(), shower.Direction().Y(), shower.Direction().Z());
436  auto cov = SMatrixSym55();
437  auto pid = p_().options().pdgId();
438  auto mom = p_().options().pval();
439  bool fitok = kalmanFitter.fitTrack(detProp,
440  pos,
441  dir,
442  cov,
443  inHits,
444  std::vector<recob::TrajectoryPointFlags>(),
445  shower.ID(),
446  mom,
447  pid,
448  outTrack,
449  outHits,
450  optionals);
451  if (!fitok) continue;
452 
453  outputTracks->emplace_back(std::move(outTrack));
454  art::Ptr<recob::Track> aptr(tid, outputTracks->size() - 1, tidgetter);
455  unsigned int ip = 0;
456  for (auto const& trhit : outHits) {
457  // the fitter produces collections with 1-1 match between hits and point
458  recob::TrackHitMeta metadata(ip, -1);
459  outputHitsMeta->addSingle(aptr, trhit, metadata);
460  outputHits->addSingle(aptr, trhit);
461  if (p_().options().produceSpacePoints() && outputTracks->back().HasValidPoint(ip)) {
462  auto& tp = outputTracks->back().Trajectory().LocationAtPoint(ip);
463  double fXYZ[3] = {tp.X(), tp.Y(), tp.Z()};
464  double fErrXYZ[6] = {0};
465  recob::SpacePoint sp(fXYZ, fErrXYZ, -1.);
466  outputSpacePoints->emplace_back(std::move(sp));
467  art::Ptr<recob::SpacePoint> apsp(spid, outputSpacePoints->size() - 1, spidgetter);
468  outputHitSpacePointAssn->addSingle(trhit, apsp);
469  }
470  ip++;
471  }
472  outputPFAssn->addSingle(art::Ptr<recob::PFParticle>(inputPFParticle, iPF), aptr);
473  outputHitInfo->emplace_back(optionals.trackFitHitInfos());
474  }
475  }
476  }
477  e.put(std::move(outputTracks));
478  e.put(std::move(outputHitsMeta));
479  e.put(std::move(outputHits));
480  e.put(std::move(outputPFAssn));
481  if (p_().options().produceTrackFitHitInfo()) { e.put(std::move(outputHitInfo)); }
482  if (p_().options().produceSpacePoints()) {
483  e.put(std::move(outputSpacePoints));
484  e.put(std::move(outputHitSpacePointAssn));
485  }
486  }
487  else {
488 
490  e.getValidHandle<std::vector<recob::Track>>(trackInputTag);
491  auto const& tkHitsAssn = *e.getValidHandle<art::Assns<recob::Track, recob::Hit>>(trackInputTag);
492 
493  if (p_().options().pFromCalo()) {
494  trackCalo = std::make_unique<art::FindManyP<anab::Calorimetry>>(inputTracks, e, caloInputTag);
495  }
496 
497  if (p_().options().idFromCollection()) {
498  trackId = std::make_unique<art::FindManyP<anab::ParticleID>>(inputTracks, e, pidInputTag);
499  }
500 
501  for (unsigned int iTrack = 0; iTrack < inputTracks->size(); ++iTrack) {
502 
503  const recob::Track& track = inputTracks->at(iTrack);
504  art::Ptr<recob::Track> ptrack(inputTracks, iTrack);
505  const int pId = setPId(iTrack, trackId);
506  const double mom = setMomValue(ptrack, trackCalo, pMC, pId);
507  const bool flipDir = setDirFlip(track, mcdir);
508 
509  //this is not computationally optimal, but at least preserves the order unlike FindManyP
510  std::vector<art::Ptr<recob::Hit>> inHits;
511  for (auto it = tkHitsAssn.begin(); it != tkHitsAssn.end(); ++it) {
512  if (it->first == ptrack)
513  inHits.push_back(it->second);
514  else if (inHits.size() > 0)
515  break;
516  }
517 
518  recob::Track outTrack;
519  std::vector<art::Ptr<recob::Hit>> outHits;
520  trkmkr::OptionalOutputs optionals;
521  if (p_().options().produceTrackFitHitInfo()) optionals.initTrackFitInfos();
522  bool fitok = kalmanFitter.fitTrack(detProp,
523  track.Trajectory(),
524  track.ID(),
525  track.VertexCovarianceLocal5D(),
526  track.EndCovarianceLocal5D(),
527  inHits,
528  mom,
529  pId,
530  flipDir,
531  outTrack,
532  outHits,
533  optionals);
534  if (!fitok) continue;
535 
536  if (p_().options().keepInputTrajectoryPoints()) {
537  restoreInputPoints(track.Trajectory().Trajectory(), inHits, outTrack, outHits);
538  }
539 
540  outputTracks->emplace_back(std::move(outTrack));
541  art::Ptr<recob::Track> aptr(tid, outputTracks->size() - 1, tidgetter);
542  unsigned int ip = 0;
543  for (auto const& trhit : outHits) {
544  //the fitter produces collections with 1-1 match between hits and point
545  recob::TrackHitMeta metadata(ip, -1);
546  outputHitsMeta->addSingle(aptr, trhit, metadata);
547  outputHits->addSingle(aptr, trhit);
548  if (p_().options().produceSpacePoints() && outputTracks->back().HasValidPoint(ip)) {
549  auto& tp = outputTracks->back().Trajectory().LocationAtPoint(ip);
550  double fXYZ[3] = {tp.X(), tp.Y(), tp.Z()};
551  double fErrXYZ[6] = {0};
552  recob::SpacePoint sp(fXYZ, fErrXYZ, -1.);
553  outputSpacePoints->emplace_back(std::move(sp));
554  art::Ptr<recob::SpacePoint> apsp(spid, outputSpacePoints->size() - 1, spidgetter);
555  outputHitSpacePointAssn->addSingle(trhit, apsp);
556  }
557  ip++;
558  }
559  outputHitInfo->emplace_back(optionals.trackFitHitInfos());
560  }
561  e.put(std::move(outputTracks));
562  e.put(std::move(outputHitsMeta));
563  e.put(std::move(outputHits));
564  if (p_().options().produceTrackFitHitInfo()) { e.put(std::move(outputHitInfo)); }
565  if (p_().options().produceSpacePoints()) {
566  e.put(std::move(outputSpacePoints));
567  e.put(std::move(outputHitSpacePointAssn));
568  }
569  }
570 }
const TVector3 & ShowerStart() const
Definition: Shower.h:197
Trajectory_t const & Trajectory() const
Returns the plain trajectory of this object.
void initTrackFitInfos()
initialize the output vector of TrackFitHitInfos
Definition: TrackMaker.h:140
ProductID getProductID(std::string const &instance_name="") const
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
Definition: Track.h:132
recob::tracking::SMatrixSym55 SMatrixSym55
Definition: TrackState.h:15
size_type size() const
Definition: Assns.h:500
bool fitTrack(detinfo::DetectorPropertiesData const &detProp, const recob::TrackTrajectory &traj, int tkID, const SMatrixSym55 &covVtx, const SMatrixSym55 &covEnd, const std::vector< art::Ptr< recob::Hit >> &hits, const double pval, const int pdgid, const bool flipDirection, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits, trkmkr::OptionalOutputs &optionals) const
Fit track starting from TrackTrajectory.
Data related to recob::Hit associated with recob::Track.The purpose is to collect several variables t...
Definition: TrackHitMeta.h:43
std::unique_ptr< art::FindManyP< recob::Vertex > > assocVertices
recob::tracking::Point_t Point_t
const_iterator begin() const
Definition: Assns.h:507
double setMomValue(art::Ptr< recob::Track > ptrack, const std::unique_ptr< art::FindManyP< anab::Calorimetry >> &trackCalo, const double pMC, const int pId) const
EDProductGetter const * productGetter(ProductID const pid) const
int setPId(const unsigned int iTrack, const std::unique_ptr< art::FindManyP< anab::ParticleID >> &trackId, const int pfPid=0) const
std::unique_ptr< art::FindManyP< anab::ParticleID > > trackId
const TVector3 & Direction() const
Definition: Shower.h:188
int PdgCode() const
Definition: MCTrack.h:39
const TLorentzVector & Momentum() const
Definition: MCStep.h:34
const_iterator end() const
Definition: Assns.h:514
int ID() const
Definition: Track.h:244
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
const SMatrixSym55 & EndCovarianceLocal5D() const
Accessors to track parameters and covariance matrices in Local5D and Global6D coordinates.
Definition: Track.h:253
std::vector< recob::TrackFitHitInfo > trackFitHitInfos()
get the output vector of TrackFitHitInfos by releasing and moving
Definition: TrackMaker.h:151
TDirectory * dir
Definition: macro.C:5
std::unique_ptr< art::FindManyP< anab::Calorimetry > > trackCalo
std::unique_ptr< art::FindManyP< recob::Shower > > assocShowers
const std::string & Process() const
Definition: MCTrack.h:41
const MCStep & Start() const
Definition: MCTrack.h:42
Float_t e
Definition: plot.C:35
Float_t track
Definition: plot.C:35
recob::tracking::Vector_t Vector_t
int ID() const
Definition: Shower.h:183
const SMatrixSym55 & VertexCovarianceLocal5D() const
Accessors to track parameters and covariance matrices in Local5D and Global6D coordinates.
Definition: Track.h:252
bool setDirFlip(const recob::Track &track, TVector3 &mcdir, const std::vector< art::Ptr< recob::Vertex >> *vertices=0) const
Struct holding optional TrackMaker outputs.
Definition: TrackMaker.h:108
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Definition: Track.h:49
std::unique_ptr< art::FindManyP< recob::Track > > assocTracks
void restoreInputPoints(const recob::Trajectory &track, const std::vector< art::Ptr< recob::Hit >> &inHits, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits) const
void art::Modifier::registerProducts ( ProductDescriptions productsToRegister)
inherited

Definition at line 16 of file Modifier.cc.

References art::ModuleBase::moduleDescription(), and art::ProductRegistryHelper::registerProducts().

17  {
18  ProductRegistryHelper::registerProducts(productsToRegister,
20  }
void registerProducts(ProductDescriptions &productsToRegister, ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
void KalmanFilterFinalTrackFitter::restoreInputPoints ( const recob::Trajectory track,
const std::vector< art::Ptr< recob::Hit >> &  inHits,
recob::Track outTrack,
std::vector< art::Ptr< recob::Hit >> &  outHits 
) const
private

Definition at line 572 of file KalmanFilterFinalTrackFitter_module.cc.

References recob::Track::Chi2(), recob::Track::Covariances(), recob::Trajectory::DirectionAtPoint(), recob::Track::FlagsAtPoint(), recob::Track::ID(), recob::Trajectory::LocationAtPoint(), recob::Track::Ndof(), recob::TrajectoryPointFlagTraits::NoPoint, recob::Track::NumberTrajectoryPoints(), recob::Track::ParticleId(), and recob::Track::VertexMomentum().

Referenced by produce().

577 {
578  const auto np = outTrack.NumberTrajectoryPoints();
579  std::vector<Point_t> positions(np);
580  std::vector<Vector_t> momenta(np);
581  std::vector<recob::TrajectoryPointFlags> outFlags(np);
582  //
583  for (unsigned int p = 0; p < np; ++p) {
584  auto flag = outTrack.FlagsAtPoint(p);
585  auto mom = outTrack.VertexMomentum();
586  auto op = flag.fromHit();
587  positions[op] = track.LocationAtPoint(op);
588  momenta[op] = mom * track.DirectionAtPoint(op);
589  auto mask = flag.mask();
592  outFlags[op] = recob::TrajectoryPointFlags(op, mask);
593  }
594  auto covs = outTrack.Covariances();
595  outTrack = recob::Track(
596  recob::TrackTrajectory(std::move(positions), std::move(momenta), std::move(outFlags), true),
597  outTrack.ParticleId(),
598  outTrack.Chi2(),
599  outTrack.Ndof(),
600  std::move(covs.first),
601  std::move(covs.second),
602  outTrack.ID());
603  //
604  outHits.clear();
605  for (auto h : inHits)
606  outHits.push_back(h);
607 }
double VertexMomentum() const
Definition: Track.h:176
static constexpr Flag_t NoPoint
The trajectory point is not defined.
int ParticleId() const
Access to various track properties.
Definition: Track.h:211
float Chi2() const
Access to various track properties.
Definition: Track.h:208
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
Definition: Track.h:136
std::pair< SMatrixSym55, SMatrixSym55 > Covariances() const
Access to position, momentum or covariance at the start and end of the track.
Definition: Track.h:199
Vector_t DirectionAtPoint(size_t i) const
Computes and returns the direction of the trajectory at a point.
Definition: Trajectory.cxx:109
A trajectory in space reconstructed from hits.
Point_t const & LocationAtPoint(size_t i) const
Returns the position at the specified trajectory point.
Definition: Trajectory.h:216
int Ndof() const
Access to various track properties.
Definition: Track.h:210
int ID() const
Definition: Track.h:244
PointFlags_t const & FlagsAtPoint(size_t i) const
Access to i-th TrajectoryPoint or its Flags.
Definition: Track.h:152
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
Definition: Track.h:992
Set of flags pertaining a point of the track.
bool KalmanFilterFinalTrackFitter::setDirFlip ( const recob::Track track,
TVector3 &  mcdir,
const std::vector< art::Ptr< recob::Vertex >> *  vertices = 0 
) const
private

Definition at line 664 of file KalmanFilterFinalTrackFitter_module.cc.

References DEFINE_ART_MODULE, dir, recob::TrackTrajectory::End(), p_, recob::Track::Trajectory(), recob::TrackTrajectory::Vertex(), and recob::Track::VertexDirection().

Referenced by produce().

668 {
669  bool result = false;
670  if (p_().options().alwaysInvertDir()) { return true; }
671  else if (p_().options().dirFromMC()) {
672  auto tdir = track.VertexDirection();
673  if ((mcdir.X() * tdir.X() + mcdir.Y() * tdir.Y() + mcdir.Z() * tdir.Z()) < 0.) result = true;
674  }
675  else if (p_().options().dirFromVec()) {
676  std::array<float, 3> dir = p_().options().dirVec();
677  auto tdir = track.VertexDirection();
678  if ((dir[0] * tdir.X() + dir[1] * tdir.Y() + dir[2] * tdir.Z()) < 0.) result = true;
679  }
680  else if (p_().options().trackFromPF() && p_().options().dirFromVtxPF() && vertices->size() > 0) {
681  //if track end is closer to first vertex then track vertex, flip direction
682  double xyz[3];
683  (*vertices)[0]->XYZ(xyz);
684  auto& tv = track.Trajectory().Vertex();
685  auto& te = track.Trajectory().End();
686  if (((xyz[0] - te.X()) * (xyz[0] - te.X()) + (xyz[1] - te.Y()) * (xyz[1] - te.Y()) +
687  (xyz[2] - te.Z()) * (xyz[2] - te.Z())) >
688  ((xyz[0] - tv.X()) * (xyz[0] - tv.X()) + (xyz[1] - tv.Y()) * (xyz[1] - tv.Y()) +
689  (xyz[2] - tv.Z()) * (xyz[2] - tv.Z())))
690  result = true;
691  }
692  return result;
693 }
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
Definition: Track.h:132
Vector_t VertexDirection() const
Access to track direction at different points.
Definition: Track.h:166
Point_t const & Vertex() const
Returns the position of the first valid point of the trajectory [cm].
TDirectory * dir
Definition: macro.C:5
Point_t const & End() const
Returns the position of the last valid point of the trajectory [cm].
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
double KalmanFilterFinalTrackFitter::setMomValue ( art::Ptr< recob::Track ptrack,
const std::unique_ptr< art::FindManyP< anab::Calorimetry >> &  trackCalo,
const double  pMC,
const int  pId 
) const
private

Definition at line 609 of file KalmanFilterFinalTrackFitter_module.cc.

References trkf::TrackMomentumCalculator::GetMomentumMultiScatterChi2(), trkf::TrackMomentumCalculator::GetTrackMomentum(), art::Ptr< T >::key(), recob::Track::Length(), p_, tmc, and trackCalo.

Referenced by produce().

614 {
615  double result = p_().options().pval();
616  if (p_().options().pFromMSChi2()) { result = tmc.GetMomentumMultiScatterChi2(ptrack); }
617  else if (p_().options().pFromLength()) {
618  result = tmc.GetTrackMomentum(ptrack->Length(), pId);
619  }
620  else if (p_().options().pFromCalo()) {
621  //take average energy from available views
622  const std::vector<art::Ptr<anab::Calorimetry>>& calo = trackCalo->at(ptrack.key());
623  double sumenergy = 0.;
624  int nviews = 0.;
625  for (auto caloit : calo) {
626  if (caloit->KineticEnergy() > 0.) {
627  sumenergy += caloit->KineticEnergy();
628  nviews += 1;
629  }
630  }
631  if (nviews != 0 && sumenergy != 0.) {
632  //protect against problematic cases
633  result = sumenergy / (nviews * 1000.);
634  }
635  }
636  else if (p_().options().pFromMC() && pMC > 0.) {
637  result = pMC;
638  }
639  return result;
640 }
double GetMomentumMultiScatterChi2(art::Ptr< recob::Track > const &trk, const bool checkValidPoints=false, const int maxMomentum_MeV=7500)
Calculate muon momentum (GeV) using multiple coulomb scattering. Chi2 minimization of the Highland fo...
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:207
key_type key() const noexcept
Definition: Ptr.h:166
calorimetry
double GetTrackMomentum(double trkrange, int pdg) const
int KalmanFilterFinalTrackFitter::setPId ( const unsigned int  iTrack,
const std::unique_ptr< art::FindManyP< anab::ParticleID >> &  trackId,
const int  pfPid = 0 
) const
private

Definition at line 642 of file KalmanFilterFinalTrackFitter_module.cc.

Referenced by produce().

646 {
647  /*
648  int result = p_().options().pdgId();
649  if (p_().options().trackFromPF() && p_().options().idFromPF()) { result = pfPid; }
650  else if (p_().options().idFromCollection()) {
651  //take the pdgId corresponding to the minimum chi2 (should we give preference to the majority? fixme)
652  double minChi2 = -1.;
653  for (auto idit : trackId->at(iTrack)) {
654  if (idit->MinChi2() > 0. && (minChi2 < 0. || idit->MinChi2() < minChi2)) {
655  result = idit->Pdg();
656  minChi2 = idit->MinChi2();
657  }
658  }
659  }
660  */
661  return -1;
662 }
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)

Member Data Documentation

std::unique_ptr<art::FindManyP<recob::Shower> > trkf::KalmanFilterFinalTrackFitter::assocShowers
private

Definition at line 171 of file KalmanFilterFinalTrackFitter_module.cc.

Referenced by produce().

std::unique_ptr<art::FindManyP<recob::Track> > trkf::KalmanFilterFinalTrackFitter::assocTracks
private

Definition at line 170 of file KalmanFilterFinalTrackFitter_module.cc.

Referenced by produce().

std::unique_ptr<art::FindManyP<recob::Vertex> > trkf::KalmanFilterFinalTrackFitter::assocVertices
private

Definition at line 172 of file KalmanFilterFinalTrackFitter_module.cc.

Referenced by produce().

art::InputTag trkf::KalmanFilterFinalTrackFitter::caloInputTag
private
bool trkf::KalmanFilterFinalTrackFitter::inputFromPF
private
trkf::TrackKalmanFitter trkf::KalmanFilterFinalTrackFitter::kalmanFitter
private
Parameters trkf::KalmanFilterFinalTrackFitter::p_
private
art::InputTag trkf::KalmanFilterFinalTrackFitter::pfParticleInputTag
private
art::InputTag trkf::KalmanFilterFinalTrackFitter::pidInputTag
private
TrackStatePropagator trkf::KalmanFilterFinalTrackFitter::prop
private
art::InputTag trkf::KalmanFilterFinalTrackFitter::showerInputTag
private
art::InputTag trkf::KalmanFilterFinalTrackFitter::simTrackInputTag
private
trkf::TrackMomentumCalculator trkf::KalmanFilterFinalTrackFitter::tmc {}
mutableprivate

Definition at line 158 of file KalmanFilterFinalTrackFitter_module.cc.

Referenced by setMomValue().

std::unique_ptr<art::FindManyP<anab::Calorimetry> > trkf::KalmanFilterFinalTrackFitter::trackCalo
private

Definition at line 168 of file KalmanFilterFinalTrackFitter_module.cc.

Referenced by produce(), and setMomValue().

std::unique_ptr<art::FindManyP<anab::ParticleID> > trkf::KalmanFilterFinalTrackFitter::trackId
private

Definition at line 169 of file KalmanFilterFinalTrackFitter_module.cc.

Referenced by produce().

art::InputTag trkf::KalmanFilterFinalTrackFitter::trackInputTag
private

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