#include <KalmanFilterAlg.h>
Public Member Functions | |
KalmanFilterAlg (const fhicl::ParameterSet &pset) | |
Constructor. More... | |
bool | getTrace () const |
Trace config parameters. More... | |
int | getPlane () const |
Preferred view plane. More... | |
void | setTrace (bool trace) |
Set trace config parameter. More... | |
void | setPlane (int plane) |
Set preferred view plane. More... | |
bool | buildTrack (const KTrack &trk, KGTrack &trg, const Propagator &prop, const Propagator::PropDirection dir, KHitContainer &hits, bool linear) const |
Make a new track. More... | |
bool | smoothTrack (KGTrack &trg, KGTrack *trg1, const Propagator &prop) const |
Smooth track. More... | |
bool | extendTrack (KGTrack &trg, const Propagator &prop, KHitContainer &hits) const |
Add hits to existing track. More... | |
bool | fitMomentumRange (const KGTrack &trg, KETrack &tremom) const |
Estimate track momentum using range. More... | |
bool | fitMomentumMS (const KGTrack &trg, const Propagator &prop, KETrack &tremom) const |
Estimate track momentum using multiple scattering. More... | |
bool | fitMomentum (const KGTrack &trg, const Propagator &prop, KETrack &tremom) const |
Estimate track momentum using either range or multiple scattering. More... | |
bool | updateMomentum (const KETrack &tremom, const Propagator &prop, KGTrack &trg) const |
Set track momentum at each track surface. More... | |
bool | smoothTrackIter (int niter, KGTrack &trg, const Propagator &prop) const |
Iteratively smooth a track. More... | |
void | cleanTrack (KGTrack &trg) const |
Clean track by removing noise hits near endpoints. More... | |
Private Attributes | |
bool | fTrace |
Trace flag. More... | |
double | fMaxPErr |
Maximum pointing error for free propagation. More... | |
double | fGoodPErr |
Pointing error threshold for switching to free propagation. More... | |
double | fMaxIncChisq |
Maximum incremental chisquare to accept a hit. More... | |
double | fMaxSeedIncChisq |
Maximum incremental chisquare to accept a hit in seed phase. More... | |
double | fMaxSmoothIncChisq |
Maximum incremental chisquare to accept a hit in smooth phase. More... | |
double | fMaxEndChisq |
Maximum incremental chisquare for endpoint hit. More... | |
int | fMinLHits |
Minimum number of hits to turn off linearized propagation. More... | |
double | fMaxLDist |
Maximum distance for linearized propagation. More... | |
double | fMaxPredDist |
Maximum prediciton distance to accept a hit. More... | |
double | fMaxSeedPredDist |
Maximum prediciton distance to accept a hit in seed phase. More... | |
double | fMaxPropDist |
Maximum propagation distance to candidate surface. More... | |
double | fMinSortDist |
Sort low distance threshold. More... | |
double | fMaxSortDist |
Sort high distance threshold. More... | |
int | fMaxSamePlane |
Maximum consecutive hits in same plane. More... | |
double | fGapDist |
Minimum gap distance. More... | |
int | fMaxNoiseHits |
Maximum number of hits in noise cluster. More... | |
double | fMinSampleDist |
Minimum sample distance (for momentum measurement). More... | |
bool | fFitMomRange |
Fit momentum using range. More... | |
bool | fFitMomMS |
Fit momentum using multiple scattering. More... | |
bool | fGTrace |
Graphical trace flag. More... | |
double | fGTraceWW |
Window width. More... | |
double | fGTraceWH |
Window height. More... | |
double | fGTraceXMin |
Graphical trace minimum x. More... | |
double | fGTraceXMax |
Graphical trace maximum x. More... | |
std::vector< double > | fGTraceZMin |
Graphical trace minimum z for each view. More... | |
std::vector< double > | fGTraceZMax |
Graphical trace maximum z for each view. More... | |
int | fPlane |
Preferred view plane. More... | |
std::vector< std::unique_ptr < TCanvas > > | fCanvases |
Graphical trace canvases. More... | |
std::vector< TVirtualPad * > | fPads |
View pads in current canvas. More... | |
TVirtualPad * | fInfoPad |
Information pad. More... | |
TPaveText * | fMessages |
Message box. More... | |
std::map< int, TMarker * > | fMarkerMap |
Markers in current canvas. More... | |
Definition at line 68 of file KalmanFilterAlg.h.
trkf::KalmanFilterAlg::KalmanFilterAlg | ( | const fhicl::ParameterSet & | pset | ) |
Constructor.
Definition at line 226 of file KalmanFilterAlg.cxx.
bool trkf::KalmanFilterAlg::buildTrack | ( | const KTrack & | trk, |
KGTrack & | trg, | ||
const Propagator & | prop, | ||
const Propagator::PropDirection | dir, | ||
KHitContainer & | hits, | ||
bool | linear | ||
) | const |
Make a new track.
Add hits to track.
Arguments:
trk - Starting track. trg - Result global track. prop - Propagator. dir - Direction. hits - Candidate hits.
Returns: True if success.
This method makes a unidirectional Kalman fit in the specified direction, visiting each surface of the passed KHitContainer and updating the track. In case of multiple measurements on the same surface, keep (at most) the one with the smallest incremental chisquare. Any measurements that fail the incremental chisquare cut are rejected. Resolved hits (accepted or rejected) are moved to the unused list in KHitContainer. The container is sorted at the start of the method, and may be resorted during the progress of the fit.
Definition at line 310 of file KalmanFilterAlg.cxx.
void trkf::KalmanFilterAlg::cleanTrack | ( | KGTrack & | trg | ) | const |
Clean track by removing noise hits near endpoints.
Clean track by removing noise hits near endpoints.
Arguments:
trg - Track.
Definition at line 2107 of file KalmanFilterAlg.cxx.
bool trkf::KalmanFilterAlg::extendTrack | ( | KGTrack & | trg, |
const Propagator & | prop, | ||
KHitContainer & | hits | ||
) | const |
Add hits to existing track.
Add hits to existing track.
Arguments:
trg - Track to extend. prop - Propagator. hits - Hit collection to choose hits from.
This method extends a KGTrack by adding hits. The KGTrack must have previously been produced by a unidirectional Kalman fit (it should be optimal at one end). This method finds the optimal end and extends the track in that direction. If any hits are added, the originally optimal end has its status reset to forward or backward, and the new endpoint is optimal. In any case, the final result is unidirectionally fit KGTrack.
Definition at line 1158 of file KalmanFilterAlg.cxx.
bool trkf::KalmanFilterAlg::fitMomentum | ( | const KGTrack & | trg, |
const Propagator & | prop, | ||
KETrack & | tremom | ||
) | const |
Estimate track momentum using either range or multiple scattering.
Estimate track momentum using either range or multiple scattering.
Arguments:
trg - Global track whose momentum is to be updated. prop - Propagator. tremom - Track with momentum estimate.
Returns: True if success.
Definition at line 1860 of file KalmanFilterAlg.cxx.
bool trkf::KalmanFilterAlg::fitMomentumMS | ( | const KGTrack & | trg, |
const Propagator & | prop, | ||
KETrack & | tremom | ||
) | const |
Estimate track momentum using multiple scattering.
Estimate track momentum using multiple scattering.
Arguments:
trg - Global track. prop - Propagator. tremom - Track containing momentum estimate.
Returns: True if success.
This method estimates the momentum of the specified track using multiple scattering. As a result of calling this method, the original global track is not updated, but a KETrack is produced near the starting surface that has the estimated momentum.
The global track passed as argument should have been smoothed prior to calling this method so that all or most fits are optimal. If either the first or last fit is not optimal, return false.
This method assumes that track parameter four is 1/p. This sort of momentum estimation only makes sense if the momentum track parameter is uncorrelated with any other track parameter. The error matrix of the first and last fit is checked for this. If it is found that either error matrix has correlated track parameter four with any other track parameter, this method returns without doing anything (return false).
Definition at line 1665 of file KalmanFilterAlg.cxx.
Estimate track momentum using range.
Estimate track momentum using range.
Arguments:
trg - Global track. prop - Propagator. tremom - Track with momentum estimate.
Returns: True if success.
This method generates a momentum-estimating track by extracting the last track from a global track, and setting its momentum to some small value.
Definition at line 1611 of file KalmanFilterAlg.cxx.
|
inline |
Preferred view plane.
Definition at line 80 of file KalmanFilterAlg.h.
|
inline |
Trace config parameters.
Definition at line 75 of file KalmanFilterAlg.h.
|
inline |
Set preferred view plane.
Definition at line 93 of file KalmanFilterAlg.h.
|
inline |
Set trace config parameter.
Definition at line 88 of file KalmanFilterAlg.h.
bool trkf::KalmanFilterAlg::smoothTrack | ( | KGTrack & | trg, |
KGTrack * | trg1, | ||
const Propagator & | prop | ||
) | const |
Smooth track.
Smooth track.
Arguments:
trg - Track to be smoothed. trg1 - Track to receive result of unidirectional fit. prop - Propagator.
Returns: True if success.
The starting track should be a global track that has been fit in one direction. Fit status should be optimal at (at least) one end. It is an error if the fit status is not optimal at either end. If the fit status is optimal at both ends, do nothing, but return success.
If the second argument is non-null, save the result of the unidirectional track fit produced as a byproduct of the smoothing operation. This track can be smoothed in order to iterate the Kalman fit, etc.
The Kalman smoothing algorithm starts at the optimal end and fits the track in the reverse direction, calculating optimal track parameters at each measurement surface.
All measurements are included in the reverse fit. No incremental chisquare cut is applied.
If any measurement surface can not be reached because of a measurement error, the entire smoothing operation is considered a failure. In that case, false is returned and the track is left in an undefined state.
Definition at line 850 of file KalmanFilterAlg.cxx.
bool trkf::KalmanFilterAlg::smoothTrackIter | ( | int | nsmooth, |
KGTrack & | trg, | ||
const Propagator & | prop | ||
) | const |
Iteratively smooth a track.
Iteratively smooth a track.
Arguments:
nsmooth - Number of iterations. trg - Track to be smoothed. prop - Propagator.
Returns: True if success.
The initial track should have been unidirectionally fit.
Definition at line 2078 of file KalmanFilterAlg.cxx.
bool trkf::KalmanFilterAlg::updateMomentum | ( | const KETrack & | tremom, |
const Propagator & | prop, | ||
KGTrack & | trg | ||
) | const |
Set track momentum at each track surface.
Set track momentum at each track surface.
Arguments:
tremom - Track containing momentum estimate. prop - Propagator. trg - Global track to be updated.
The track containing the momentum estimate is propagated to the first or last track fit of the global track (whichever is closer), then the momentum estimate is transfered to that track fit. In similar fashion, the momentum estimate is successively transfered from that track fit to each track fit of the global track.
Only momentum track parameters of the global track fits are updated. Other track parameters and their errors are unmodified. Unreachable track fits are deleted from the global track. Overall failure will occur if the momentum-estimating track can't be propagated to the initial track fit, or if the final global track has no valid track fits.
Definition at line 1942 of file KalmanFilterAlg.cxx.
|
mutableprivate |
Graphical trace canvases.
Definition at line 179 of file KalmanFilterAlg.h.
|
private |
Fit momentum using multiple scattering.
Definition at line 167 of file KalmanFilterAlg.h.
|
private |
Fit momentum using range.
Definition at line 166 of file KalmanFilterAlg.h.
|
private |
Minimum gap distance.
Definition at line 163 of file KalmanFilterAlg.h.
|
private |
Pointing error threshold for switching to free propagation.
Definition at line 150 of file KalmanFilterAlg.h.
|
private |
Graphical trace flag.
Definition at line 168 of file KalmanFilterAlg.h.
|
private |
Window height.
Definition at line 170 of file KalmanFilterAlg.h.
|
private |
Window width.
Definition at line 169 of file KalmanFilterAlg.h.
|
private |
Graphical trace maximum x.
Definition at line 172 of file KalmanFilterAlg.h.
|
private |
Graphical trace minimum x.
Definition at line 171 of file KalmanFilterAlg.h.
|
private |
Graphical trace maximum z for each view.
Definition at line 174 of file KalmanFilterAlg.h.
|
private |
Graphical trace minimum z for each view.
Definition at line 173 of file KalmanFilterAlg.h.
|
mutableprivate |
Information pad.
Definition at line 181 of file KalmanFilterAlg.h.
|
mutableprivate |
Markers in current canvas.
Definition at line 183 of file KalmanFilterAlg.h.
|
private |
Maximum incremental chisquare for endpoint hit.
Definition at line 154 of file KalmanFilterAlg.h.
|
private |
Maximum incremental chisquare to accept a hit.
Definition at line 151 of file KalmanFilterAlg.h.
|
private |
Maximum distance for linearized propagation.
Definition at line 156 of file KalmanFilterAlg.h.
|
private |
Maximum number of hits in noise cluster.
Definition at line 164 of file KalmanFilterAlg.h.
|
private |
Maximum pointing error for free propagation.
Definition at line 149 of file KalmanFilterAlg.h.
|
private |
Maximum prediciton distance to accept a hit.
Definition at line 157 of file KalmanFilterAlg.h.
|
private |
Maximum propagation distance to candidate surface.
Definition at line 159 of file KalmanFilterAlg.h.
|
private |
Maximum consecutive hits in same plane.
Definition at line 162 of file KalmanFilterAlg.h.
|
private |
Maximum incremental chisquare to accept a hit in seed phase.
Definition at line 152 of file KalmanFilterAlg.h.
|
private |
Maximum prediciton distance to accept a hit in seed phase.
Definition at line 158 of file KalmanFilterAlg.h.
|
private |
Maximum incremental chisquare to accept a hit in smooth phase.
Definition at line 153 of file KalmanFilterAlg.h.
|
private |
Sort high distance threshold.
Definition at line 161 of file KalmanFilterAlg.h.
|
mutableprivate |
Message box.
Definition at line 182 of file KalmanFilterAlg.h.
|
private |
Minimum number of hits to turn off linearized propagation.
Definition at line 155 of file KalmanFilterAlg.h.
|
private |
Minimum sample distance (for momentum measurement).
Definition at line 165 of file KalmanFilterAlg.h.
|
private |
Sort low distance threshold.
Definition at line 160 of file KalmanFilterAlg.h.
|
mutableprivate |
View pads in current canvas.
Definition at line 180 of file KalmanFilterAlg.h.
|
private |
Preferred view plane.
Definition at line 178 of file KalmanFilterAlg.h.
|
private |
Trace flag.
Definition at line 148 of file KalmanFilterAlg.h.