LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
Fit tracks using Kalman Filter fit+smooth. More...
#include "TrackKalmanFitter.h"
Classes | |
struct | Config |
Public Types | |
using | Parameters = fhicl::Table< Config > |
Public Member Functions | |
TrackKalmanFitter (const TrackStatePropagator *prop, bool useRMS, bool sortHitsByPlane, bool sortHitsByWire, bool sortOutputHitsMinLength, bool skipNegProp, bool cleanZigzag, bool rejectHighMultHits, bool rejectHitsNegativeGOF, float hitErr2ScaleFact, bool tryNoSkipWhenFails, bool tryBothDirs, bool pickBestHitOnWire, float maxResidue, float maxResidueFirstHit, float maxChi2, float maxDist, float negDistTolerance, int dumpLevel) | |
Constructor from TrackStatePropagator and values of configuration parameters. More... | |
TrackKalmanFitter (const TrackStatePropagator *prop, Parameters const &p) | |
Constructor from TrackStatePropagator and Parameters table. More... | |
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. More... | |
bool | fitTrack (detinfo::DetectorPropertiesData const &detProp, const Point_t &position, const Vector_t &direction, SMatrixSym55 &trackStateCov, const std::vector< art::Ptr< recob::Hit >> &hits, const std::vector< recob::TrajectoryPointFlags > &flags, const int tkID, const double pval, const int pdgid, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits, trkmkr::OptionalOutputs &optionals) const |
Fit track starting from intial position, direction, and flags. More... | |
bool | doFitWork (KFTrackState &trackState, detinfo::DetectorPropertiesData const &detProp, std::vector< HitState > &hitstatev, std::vector< recob::TrajectoryPointFlags::Mask_t > &hitflagsv, std::vector< KFTrackState > &fwdPrdTkState, std::vector< KFTrackState > &fwdUpdTkState, std::vector< unsigned int > &hitstateidx, std::vector< unsigned int > &rejectedhsidx, std::vector< unsigned int > &sortedtksidx, bool applySkipClean=true) const |
Function where the core of the fit is performed. More... | |
Private Member Functions | |
KFTrackState | setupInitialTrackState (const Point_t &position, const Vector_t &direction, SMatrixSym55 &trackStateCov, const double pval, const int pdgid) const |
Return track state from intial position, direction, and covariance. More... | |
bool | setupInputStates (detinfo::DetectorPropertiesData const &detProp, const std::vector< art::Ptr< recob::Hit >> &hits, const std::vector< recob::TrajectoryPointFlags > &flags, std::vector< HitState > &hitstatev, std::vector< recob::TrajectoryPointFlags::Mask_t > &hitflagsv) const |
Setup vectors of HitState and Masks to be used during the fit. More... | |
void | sortOutput (std::vector< HitState > &hitstatev, std::vector< KFTrackState > &fwdUpdTkState, std::vector< unsigned int > &hitstateidx, std::vector< unsigned int > &rejectedhsidx, std::vector< unsigned int > &sortedtksidx, std::vector< recob::TrajectoryPointFlags::Mask_t > &hitflagsv, bool applySkipClean=true) const |
Sort the output states. More... | |
bool | fillResult (const std::vector< art::Ptr< recob::Hit >> &inHits, const int tkID, const int pdgid, std::vector< HitState > &hitstatev, std::vector< recob::TrajectoryPointFlags::Mask_t > &hitflagsv, std::vector< KFTrackState > &fwdPrdTkState, std::vector< KFTrackState > &fwdUpdTkState, std::vector< unsigned int > &hitstateidx, std::vector< unsigned int > &rejectedhsidx, std::vector< unsigned int > &sortedtksidx, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits, trkmkr::OptionalOutputs &optionals) const |
Fill the output objects. More... | |
Private Attributes | |
art::ServiceHandle< geo::Geometry const > | geom |
const TrackStatePropagator * | propagator |
bool | useRMS_ |
bool | sortHitsByPlane_ |
bool | sortHitsByWire_ |
bool | sortOutputHitsMinLength_ |
bool | skipNegProp_ |
bool | cleanZigzag_ |
bool | rejectHighMultHits_ |
bool | rejectHitsNegativeGOF_ |
float | hitErr2ScaleFact_ |
bool | tryNoSkipWhenFails_ |
bool | tryBothDirs_ |
bool | pickBestHitOnWire_ |
float | maxResidue_ |
float | maxResidueFirstHit_ |
float | maxChi2_ |
float | maxDist_ |
float | negDistTolerance_ |
int | dumpLevel_ |
Fit tracks using Kalman Filter fit+smooth.
This algorithm fits tracks using a Kalman Filter forward fit followed by a backward smoothing. The resulting track will feature covariance matrices at start and end positions. Fundamental components of the fit are trkf::KFTrackState and trkf::TrackStatePropagator.
Inputs are: recob::TrackTrajectory, initial covariance, associated hits, momentum estimate, particle id hypothesis. Alternatively, instead of a TrackTrajectory the fit can be input with initial position and direction, and vector of recob::TrajectoryPointFlags.
Outputs are: resulting recob::Track, associated hits, and trkmkr::OptionalOutputs.
For configuration options see TrackKalmanFitter::Config
Definition at line 56 of file TrackKalmanFitter.h.
Definition at line 151 of file TrackKalmanFitter.h.
|
inline |
Constructor from TrackStatePropagator and values of configuration parameters.
Definition at line 154 of file TrackKalmanFitter.h.
References cluster::sortHitsByWire().
|
inlineexplicit |
Constructor from TrackStatePropagator and Parameters table.
Definition at line 197 of file TrackKalmanFitter.h.
References hits(), and lar::dump::vector().
bool trkf::TrackKalmanFitter::doFitWork | ( | KFTrackState & | trackState, |
detinfo::DetectorPropertiesData const & | detProp, | ||
std::vector< HitState > & | hitstatev, | ||
std::vector< recob::TrajectoryPointFlags::Mask_t > & | hitflagsv, | ||
std::vector< KFTrackState > & | fwdPrdTkState, | ||
std::vector< KFTrackState > & | fwdUpdTkState, | ||
std::vector< unsigned int > & | hitstateidx, | ||
std::vector< unsigned int > & | rejectedhsidx, | ||
std::vector< unsigned int > & | sortedtksidx, | ||
bool | applySkipClean = true |
||
) | const |
Function where the core of the fit is performed.
Definition at line 295 of file TrackKalmanFitter.cxx.
References util::abs(), trkf::TrackStatePropagator::BACKWARD, util::begin(), trkf::KFTrackState::chi2(), trkf::KFTrackState::covariance(), recob::TrajectoryPointFlagTraits::DeltaRay, recob::TrajectoryPointFlagTraits::DetectorIssue, larg4::dist(), trkf::TrackStatePropagator::distanceToPlane(), trkf::KFTrackState::dump(), trkf::TrackState::dump(), dumpLevel_, util::end(), recob::TrajectoryPointFlagTraits::ExcludedFromFit, trkf::TrackStatePropagator::FORWARD, geom, recob::TrajectoryPointFlagTraits::HitIgnored, geo::GeometryCore::Iterate(), maxChi2_, maxDist_, geo::GeometryCore::MaxPlanes(), maxResidue_, maxResidueFirstHit_, recob::TrajectoryPointFlagTraits::Merged, trkf::KFTrackState::momentum(), negDistTolerance_, recob::TrajectoryPointFlagTraits::NoPoint, pickBestHitOnWire_, trkf::TrackState::plane(), trkf::KFTrackState::position(), trkf::TrackStatePropagator::propagateToPlane(), propagator, recob::TrajectoryPointFlagTraits::Rejected, trkf::KFTrackState::residual(), trkf::KFTrackState::setCovariance(), recob::TrajectoryPointFlagTraits::Shared, skipNegProp_, sortHitsByPlane_, sortHitsByWire_, sortOutput(), recob::TrajectoryPointFlagTraits::Suspicious, trkf::KFTrackState::trackState(), and trkf::KFTrackState::updateWithHitState().
Referenced by fitTrack().
|
private |
Fill the output objects.
Definition at line 940 of file TrackKalmanFitter.cxx.
References trkmkr::TrackCreationBookKeeper::addPoint(), recob::Track::Chi2PerNdof(), trkf::KFTrackState::covariance(), dumpLevel_, e, recob::TrajectoryPointFlagTraits::ExcludedFromFit, trkmkr::TrackCreationBookKeeper::finalizeTrack(), recob::Track::HasValidPoint(), recob::TrajectoryPointFlagTraits::HitIgnored, trkmkr::OptionalOutputs::isTrackFitInfosInit(), util::kBogusD, recob::Track::Length(), recob::Track::MomentumAtPoint(), recob::Track::NextValidPoint(), recob::TrajectoryPointFlagTraits::NoPoint, propagator, recob::TrajectoryPointFlagTraits::Rejected, trkf::TrackStatePropagator::rotateToPlane(), trkmkr::OptionalPointElement::setTrackFitHitInfo(), recob::Track::Start(), recob::Track::StartCovariance(), and recob::Track::StartDirection().
Referenced by fitTrack().
bool trkf::TrackKalmanFitter::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.
Definition at line 36 of file TrackKalmanFitter.cxx.
References recob::TrackTrajectory::End(), recob::TrackTrajectory::EndDirection(), recob::TrackTrajectory::Flags(), hits(), tryBothDirs_, recob::TrackTrajectory::Vertex(), and recob::TrackTrajectory::VertexDirection().
Referenced by trkmkr::KalmanFilterFitTrackMaker::makeTrackImpl(), trkf::KalmanFilterTrajectoryFitter::produce(), and trkf::KalmanFilterFinalTrackFitter::produce().
bool trkf::TrackKalmanFitter::fitTrack | ( | detinfo::DetectorPropertiesData const & | detProp, |
const Point_t & | position, | ||
const Vector_t & | direction, | ||
SMatrixSym55 & | trackStateCov, | ||
const std::vector< art::Ptr< recob::Hit >> & | hits, | ||
const std::vector< recob::TrajectoryPointFlags > & | flags, | ||
const int | tkID, | ||
const double | pval, | ||
const int | pdgid, | ||
recob::Track & | outTrack, | ||
std::vector< art::Ptr< recob::Hit >> & | outHits, | ||
trkmkr::OptionalOutputs & | optionals | ||
) | const |
Fit track starting from intial position, direction, and flags.
Definition at line 136 of file TrackKalmanFitter.cxx.
References cleanZigzag_, doFitWork(), dumpLevel_, fillResult(), hits(), setupInitialTrackState(), setupInputStates(), skipNegProp_, and tryNoSkipWhenFails_.
|
private |
Return track state from intial position, direction, and covariance.
Definition at line 221 of file TrackKalmanFitter.cxx.
Referenced by fitTrack().
|
private |
Setup vectors of HitState and Masks to be used during the fit.
Definition at line 246 of file TrackKalmanFitter.cxx.
References detinfo::DetectorPropertiesData::ConvertTicksToX(), recob::TrajectoryPointFlags::DefaultFlagsMask(), dumpLevel_, recob::TrajectoryPointFlagTraits::ExcludedFromFit, geom, detinfo::DetectorPropertiesData::GetXTicksCoefficient(), hitErr2ScaleFact_, hits(), recob::TrajectoryPointFlagTraits::Merged, recob::TrajectoryPointFlagTraits::NoPoint, rejectHighMultHits_, rejectHitsNegativeGOF_, recob::TrajectoryPointFlagTraits::Suspicious, useRMS_, geo::GeometryCore::WireIDToWireGeo(), and x.
Referenced by fitTrack().
|
private |
Sort the output states.
Definition at line 815 of file TrackKalmanFitter.cxx.
References cleanZigzag_, dir, dumpLevel_, util::end(), recob::TrajectoryPointFlagTraits::ExcludedFromFit, geom, geo::GeometryCore::MaxPlanes(), negDistTolerance_, skipNegProp_, and sortOutputHitsMinLength_.
Referenced by doFitWork().
|
private |
Definition at line 305 of file TrackKalmanFitter.h.
Referenced by fitTrack(), and sortOutput().
|
private |
Definition at line 317 of file TrackKalmanFitter.h.
Referenced by doFitWork(), fillResult(), fitTrack(), setupInputStates(), and sortOutput().
|
private |
Definition at line 298 of file TrackKalmanFitter.h.
Referenced by doFitWork(), setupInputStates(), and sortOutput().
|
private |
Definition at line 308 of file TrackKalmanFitter.h.
Referenced by setupInputStates().
|
private |
Definition at line 314 of file TrackKalmanFitter.h.
Referenced by doFitWork().
|
private |
Definition at line 315 of file TrackKalmanFitter.h.
Referenced by doFitWork().
|
private |
Definition at line 312 of file TrackKalmanFitter.h.
Referenced by doFitWork().
|
private |
Definition at line 313 of file TrackKalmanFitter.h.
Referenced by doFitWork().
|
private |
Definition at line 316 of file TrackKalmanFitter.h.
Referenced by doFitWork(), and sortOutput().
|
private |
Definition at line 311 of file TrackKalmanFitter.h.
Referenced by doFitWork().
|
private |
Definition at line 299 of file TrackKalmanFitter.h.
Referenced by doFitWork(), and fillResult().
|
private |
Definition at line 306 of file TrackKalmanFitter.h.
Referenced by setupInputStates().
|
private |
Definition at line 307 of file TrackKalmanFitter.h.
Referenced by setupInputStates().
|
private |
Definition at line 304 of file TrackKalmanFitter.h.
Referenced by doFitWork(), fitTrack(), and sortOutput().
|
private |
Definition at line 301 of file TrackKalmanFitter.h.
Referenced by doFitWork().
|
private |
Definition at line 302 of file TrackKalmanFitter.h.
Referenced by doFitWork().
|
private |
Definition at line 303 of file TrackKalmanFitter.h.
Referenced by sortOutput().
|
private |
Definition at line 310 of file TrackKalmanFitter.h.
Referenced by fitTrack().
|
private |
Definition at line 309 of file TrackKalmanFitter.h.
Referenced by fitTrack().
|
private |
Definition at line 300 of file TrackKalmanFitter.h.
Referenced by setupInputStates().