13 #include "boost/numeric/ublas/matrix_proxy.hpp" 14 #include "boost/numeric/ublas/vector_proxy.hpp" 15 #include "cetlib_except/exception.h" 29 #include "TLegendEntry.h" 33 #include "TPaveText.h" 35 #include "TVirtualPad.h" 52 const std::shared_ptr<const trkf::Surface>& psurf = hit.
getMeasSurface();
56 if (
auto pyz = dynamic_cast<const trkf::SurfYZPlane*>(psurf.get())) {
63 x = pyz->x0() + phit1->getMeasVector()(0);
69 double z0 = pyz->z0();
70 double y0 = pyz->y0();
71 double phi = pyz->phi();
74 z = z0 * std::cos(phi) + (ymax - y0) * std::sin(phi);
76 z = z0 * std::cos(phi) - (ymax + y0) * std::sin(phi);
78 else if (
auto pyz = dynamic_cast<const trkf::SurfYZLine*>(psurf.get())) {
91 double z0 = pyz->z0();
92 double y0 = pyz->y0();
93 double phi = pyz->phi();
96 z = z0 * std::cos(phi) + (ymax - y0) * std::sin(phi);
98 z = z0 * std::cos(phi) - (ymax + y0) * std::sin(phi);
136 double invp2 = invp * invp;
137 double invp3 = invp * invp2;
138 double invp4 = invp2 * invp2;
139 double mass2 = mass * mass;
140 double k = std::sqrt(invp2 + mass2 * invp4);
141 double dkdinvp = (invp + 2. * mass2 * invp3) / k;
142 double vark = var_invp * dkdinvp * dkdinvp;
172 double derivk1 = -0.5 *
trkf::trace(temp1) + 0.5 * inner_prod(defl, vtemp2);
173 double derivk2 = 0.5 *
trkf::trace(temp2) - inner_prod(defl, vtemp3);
180 double q = 1. / std::sqrt(k);
181 double varq = vark / (4. * k * k * k);
182 double derivq1 = (-2. * k / q) * derivk1;
183 double derivq2 = 6. * k * k * derivk1 + 4. * k * k * k * derivk2;
189 double q1 = q - derivq1 / derivq2;
190 double varq1 = -1. / derivq2;
195 double newvarq = 1. / (1. / varq + 1. / varq1);
196 double newq = newvarq * (q / varq + q1 / varq1);
204 double c2 = 2. / (q4 + q2 * std::sqrt(q4 + 4. * mass2));
205 double c = std::sqrt(c2);
206 double dcdq = -2. * (c / q) * (1. + mass2 * c2) / (1. + 2. * mass2 *
c2);
207 double varc = varq * dcdq * dcdq;
224 , fMaxSeedIncChisq(0.)
225 , fMaxSmoothIncChisq(0.)
230 , fMaxSeedPredDist(0.)
238 , fFitMomRange(false)
247 mf::LogInfo(
"KalmanFilterAlg") <<
"KalmanFilterAlg instantiated.";
312 throw cet::exception(
"KalmanFilterAlg") <<
"No direction for Kalman fit.\n";
322 std::ostringstream ostr;
323 ostr <<
"khit" << cnum;
329 fCanvases.back()->Divide(2, nview / 2 + 1);
333 for (
int iview = 0; iview < nview; ++iview) {
335 std::ostringstream ostr;
336 ostr <<
"Plane " << iview;
343 TPad* p =
new TPad(ostr.str().c_str(), ostr.str().c_str(), zmin, xmin, zmax, xmax);
344 p->SetBit(kCanDelete);
346 p->SetFillStyle(4000);
352 TText* t =
new TText(zmax - 0.02, xmax - 0.03, ostr.str().c_str());
353 t->SetBit(kCanDelete);
356 t->SetTextSize(0.04);
363 pz1->SetBit(kCanDelete);
367 px1->SetBit(kCanDelete);
372 pz2->SetBit(kCanDelete);
376 px2->SetBit(kCanDelete);
384 TLegend*
leg =
new TLegend(0.6, 0.5, 0.99, 0.99);
385 leg->SetBit(kCanDelete);
387 TLegendEntry* entry = 0;
390 m =
new TMarker(0., 0., 20);
391 m->SetBit(kCanDelete);
392 m->SetMarkerSize(1.2);
393 m->SetMarkerColor(kRed);
394 entry = leg->AddEntry(m,
"Hits on Track",
"P");
395 entry->SetBit(kCanDelete);
397 m =
new TMarker(0., 0., 20);
398 m->SetBit(kCanDelete);
399 m->SetMarkerSize(1.2);
400 m->SetMarkerColor(kOrange);
401 entry = leg->AddEntry(m,
"Smoothed Hits on Track",
"P");
402 entry->SetBit(kCanDelete);
404 m =
new TMarker(0., 0., 20);
405 m->SetBit(kCanDelete);
406 m->SetMarkerSize(1.2);
407 m->SetMarkerColor(kBlack);
408 entry = leg->AddEntry(m,
"Available Hits",
"P");
409 entry->SetBit(kCanDelete);
411 m =
new TMarker(0., 0., 20);
412 m->SetBit(kCanDelete);
413 m->SetMarkerSize(1.2);
414 m->SetMarkerColor(kBlue);
415 entry = leg->AddEntry(m,
"Rejected Hits",
"P");
416 entry->SetBit(kCanDelete);
418 m =
new TMarker(0., 0., 20);
419 m->SetBit(kCanDelete);
420 m->SetMarkerSize(1.2);
421 m->SetMarkerColor(kGreen);
422 entry = leg->AddEntry(m,
"Removed Hits",
"P");
423 entry->SetBit(kCanDelete);
425 m =
new TMarker(0., 0., 20);
426 m->SetBit(kCanDelete);
427 m->SetMarkerSize(1.2);
428 m->SetMarkerColor(kMagenta);
429 entry = leg->AddEntry(m,
"Seed Hits",
"P");
430 entry->SetBit(kCanDelete);
432 m =
new TMarker(0., 0., 20);
433 m->SetBit(kCanDelete);
434 m->SetMarkerSize(1.2);
435 m->SetMarkerColor(kCyan);
436 entry = leg->AddEntry(m,
"Unreachable Seed Hits",
"P");
437 entry->SetBit(kCanDelete);
443 fMessages =
new TPaveText(0.01, 0.01, 0.55, 0.99,
"");
449 TText* t =
fMessages->AddText(
"Enter buildTrack");
450 t->SetBit(kCanDelete);
466 const std::list<KHitGroup>& groups = hits.
getSorted();
467 for (
auto const& gr : groups) {
471 const std::vector<std::shared_ptr<const KHitBase>>& phits = gr.getHits();
472 for (
auto const& phit : phits) {
475 if (pl >= 0 && pl <
int(
fPads.size())) {
476 auto const [
z,
x] = hit_position(hit);
477 TMarker* marker =
new TMarker(z, x, 20);
480 marker->SetBit(kCanDelete);
481 marker->SetMarkerSize(0.5);
482 marker->SetMarkerColor(kMagenta);
492 const std::list<KHitGroup>& ugroups = hits.
getUnsorted();
493 for (
auto const& gr : ugroups) {
497 const std::vector<std::shared_ptr<const KHitBase>>& phits = gr.getHits();
498 for (
auto const& phit : phits) {
501 if (pl >= 0 && pl <
int(
fPads.size())) {
502 auto const [
z,
x] = hit_position(hit);
503 TMarker* marker =
new TMarker(z, x, 20);
506 marker->SetBit(kCanDelete);
507 marker->SetMarkerSize(0.5);
508 marker->SetMarkerColor(kCyan);
523 bool has_pref_plane =
false;
547 log <<
"Build Step " << step <<
"\n";
548 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
564 double path_est = gr.
getPath();
565 log <<
"Next surface: " << *(gr.
getSurface()) <<
"\n";
566 log <<
" Estimated path length of hit group = " << path_est <<
"\n";
574 std::shared_ptr<const Surface> psurf = trf.
getSurface();
598 log <<
"After propagation\n";
599 log <<
" Incremental propagation distance = " << ds <<
"\n";
600 log <<
" Path length of prediction surface = " << path <<
"\n";
601 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
607 const std::vector<std::shared_ptr<const KHitBase>>& hits = gr.
getHits();
608 double best_chisq = 0.;
609 std::shared_ptr<const KHitBase> best_hit;
620 TMarker* marker = marker_it->second;
621 marker->SetMarkerColor(kBlue);
632 log <<
"Trying Hit.\n" 633 << hit <<
"\nchisq = " << chisq <<
"\n" 634 <<
"prediction distance = " << preddist <<
"\n";
637 (best_hit.get() == 0 || chisq < best_chisq)) {
644 log <<
"Best hit incremental chisquare = " << best_chisq <<
"\n";
645 if (best_hit.get() != 0) {
646 log <<
"Hit after prediction\n";
650 log <<
"No hit passed chisquare cut.\n";
658 bool update_ok =
false;
659 if (best_hit.get() != 0) {
661 best_hit->update(trf);
663 if (!update_ok) trf = trf0;
666 ds += best_hit->getPredDistance();
667 tchisq += best_chisq;
679 if (
fTrace) log <<
"Quitting because pointing error got too large.\n";
702 int pl = best_hit->getMeasPlane();
703 if (pl >= 0 && pl <
int(
fPads.size())) {
704 auto marker_it =
fMarkerMap.find(best_hit->getID());
706 TMarker* marker = marker_it->second;
707 marker->SetMarkerColor(kRed);
729 if (
fTrace) log <<
"Killing reference track.\n";
733 log <<
"After update\n";
734 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
748 if (pref == 0 && dist &&
751 if (
fTrace) log <<
"Resorting measurements.\n";
752 hits.
sort(trf,
true, prop, dir);
779 log <<
"KalmanFilterAlg build track summary.\n" 781 <<
"Track has " << trg.
numHits() <<
" hits.\n" 782 <<
"Track length = " << path <<
"\n" 783 <<
"Track chisquare = " << fchisq <<
"\n";
792 t =
fMessages->AddText(
"Exit buildTrack, status success");
794 t =
fMessages->AddText(
"Exit buildTrack, status fail");
795 t->SetBit(kCanDelete);
900 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::smoothTrack(): no track!\n";
933 <<
"KalmanFilterAlg::smoothTrack(): invalid direction\n";
942 while (dofit && it != itend) {
945 log <<
"Smooth Step " << step <<
"\n";
946 log <<
"Reverse fit track:\n";
956 log <<
"Forward track:\n";
966 std::shared_ptr<const Surface> psurf = trh.
getSurface();
988 log <<
"Reverse fit track after propagation:\n";
989 log <<
" Propagation distance = " << ds <<
"\n";
1022 log <<
"Combined track:\n";
1029 if (not hit.
predict(trf, prop, &ref)) {
1051 bool update_ok = trf.
isValid();
1064 log <<
"Reverse fit track after update:\n";
1070 TMarker* marker = marker_it->second;
1071 marker->SetMarkerColor(kOrange);
1097 if (result && trg1 != 0 && trg1->
isValid()) {
1118 log <<
"KalmanFilterAlg smooth track summary.\n" 1120 <<
"Track has " << trg.
numHits() <<
" hits.\n" 1122 <<
"Track chisquare = " << fchisq <<
"\n";
1149 bool result =
false;
1152 TText* t =
fMessages->AddText(
"Enter extendTrack");
1153 t->SetBit(kCanDelete);
1160 unsigned int nhits0 = trg.
numHits();
1238 hits.
sort(trf,
true, prop, dir);
1247 const std::list<KHitGroup>& groups = hits.
getSorted();
1248 for (
auto const& gr : groups) {
1252 const std::vector<std::shared_ptr<const KHitBase>>& phits = gr.getHits();
1253 for (
auto const& phit : phits) {
1256 if (pl >= 0 && pl <
int(
fPads.size())) {
1260 TMarker* marker = 0;
1263 auto const [
z,
x] = hit_position(hit);
1264 marker =
new TMarker(z, x, 20);
1267 marker->SetBit(kCanDelete);
1268 marker->SetMarkerSize(0.5);
1272 marker = marker_it->second;
1273 marker->SetMarkerColor(kBlack);
1281 const std::list<KHitGroup>& ugroups = hits.
getUnsorted();
1282 for (
auto const& gr : ugroups) {
1286 const std::vector<std::shared_ptr<const KHitBase>>& phits = gr.getHits();
1287 for (
auto const& phit : phits) {
1290 if (pl >= 0 && pl <
int(
fPads.size())) {
1294 TMarker* marker = 0;
1297 auto const [
z,
x] = hit_position(hit);
1298 marker =
new TMarker(z, x, 20);
1301 marker->SetBit(kCanDelete);
1302 marker->SetMarkerSize(0.5);
1306 marker = marker_it->second;
1307 marker->SetMarkerColor(kBlue);
1318 int last_plane = -1;
1322 log <<
"Extend Step " << step <<
"\n";
1323 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
1338 <<
"KalmanFilterAlg::extendTrack(): invalid direction\n";
1343 double path_est = gr.
getPath();
1344 log <<
"Next surface: " << *(gr.
getSurface()) <<
"\n";
1345 log <<
" Estimated path length of hit group = " << path_est <<
"\n";
1353 std::shared_ptr<const Surface> psurf = trf.
getSurface();
1356 <<
"KalmanFilterAlg::extendTrack(): negative plane?\n";
1379 log <<
"After propagation\n";
1380 log <<
" Incremental distance = " << ds <<
"\n";
1381 log <<
" Track path length = " << path <<
"\n";
1382 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
1388 const std::vector<std::shared_ptr<const KHitBase>>& hits = gr.
getHits();
1389 double best_chisq = 0.;
1390 std::shared_ptr<const KHitBase> best_hit;
1401 TMarker* marker = marker_it->second;
1402 marker->SetMarkerColor(kBlue);
1410 bool ok = hit.
predict(trf, prop);
1414 if (
abs(preddist) <
fMaxPredDist && (best_hit.get() == 0 || chisq < best_chisq)) {
1421 log <<
"Best hit incremental chisquare = " << best_chisq <<
"\n";
1422 if (best_hit.get() != 0) {
1423 log <<
"Hit after prediction\n";
1427 log <<
"No hit passed chisquare cut.\n";
1435 bool update_ok =
false;
1436 if (best_hit.get() != 0) {
1438 best_hit->update(trf);
1440 if (!update_ok) trf = trf0;
1443 ds += best_hit->getPredDistance();
1444 tchisq += best_chisq;
1455 if (
fTrace) log <<
"Quitting because pointing error got too large.\n";
1478 int pl = best_hit->getMeasPlane();
1479 if (pl >= 0 && pl <
int(
fPads.size())) {
1480 auto marker_it =
fMarkerMap.find(best_hit->getID());
1482 TMarker* marker = marker_it->second;
1483 marker->SetMarkerColor(kRed);
1500 log <<
"After update\n";
1501 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
1517 if (
fTrace) log <<
"Resorting measurements.\n";
1518 hits.
sort(trf,
true, prop, dir);
1545 <<
"KalmanFilterAlg::extendTrack(): invalid direction [II]\n";
1551 log <<
"KalmanFilterAlg extend track summary.\n" 1553 <<
"Track has " << trg.
numHits() <<
" hits.\n" 1554 <<
"Track length = " << path <<
"\n" 1555 <<
"Track chisquare = " << fchisq <<
"\n";
1561 result = (trg.
numHits() > nhits0);
1566 t =
fMessages->AddText(
"Exit extendTrack, status success");
1568 t =
fMessages->AddText(
"Exit extendTrack, status fail");
1569 t->SetBit(kCanDelete);
1593 if (!trg.
isValid())
return false;
1600 <<
"KalmanFilterAlg::fitMomentumRange(): invalid end track\n";
1650 const std::multimap<double, KHitTrack>& trackmap = trg.
getTrackMap();
1651 if (trackmap.size() < 2)
return false;
1653 itend[0] = trackmap.begin();
1654 itend[1] = trackmap.end();
1662 for (
int i = 0; result && i < 2; ++i) {
1663 const KHitTrack& trh = itend[i]->second;
1667 for (
int j = 0; j < 4; ++j) {
1668 if (err(4, j) != 0.) result =
false;
1671 if (!result)
return result;
1687 double s_sample = itend[1]->first;
1688 const KETrack& tre = itend[1]->second;
1698 double invp0 = tre_noise.
getVector()(4);
1699 double var_invp0 = tre_noise.
getError()(4, 4);
1704 for (
auto it = trackmap.rbegin(); it != trackmap.rend(); ++it) {
1705 double s = it->first;
1720 std::shared_ptr<const Surface> psurf = trh.
getSurface();
1722 std::optional<double> dist_range =
1724 std::optional<double> dist_noise =
1730 bool momentum_updated =
false;
1731 if (dist_inf && dist_range && dist_noise) {
1735 double invp1 = tre_noise.
getVector()(4);
1736 double var_invp1 = tre_noise.
getError()(4, 4);
1741 double invp = 0.5 * (invp0 + invp1);
1742 double var_invp = 0.5 * (var_invp0 + var_invp1);
1743 double mass = tre_inf.
Mass();
1744 double beta = std::sqrt(1. + mass * mass * invp * invp);
1745 double invbp = invp / beta;
1763 project(tre_inf.
getError(), ublas::range(2, 4), ublas::range(2, 4));
1767 project(tre_noise.
getError(), ublas::range(2, 4), ublas::range(2, 4));
1773 double new_invp = invp;
1774 double new_var_invp = var_invp;
1775 update_momentum(defl, errc, errn, mass, new_invp, new_var_invp);
1780 double dp = 1. / new_invp - 1. / invp;
1781 invp0 = 1. / (1. / invp1 + dp);
1782 var_invp0 = new_var_invp;
1783 momentum_updated =
true;
1788 double invp_range = trk_range.
getVector()(4);
1789 if (invp0 > invp_range) invp0 = invp_range;
1794 if (momentum_updated) {
1799 double invp_range = trk_range.
getVector()(4);
1804 tre_noise.
getError()(4, 4) = var_invp0;
1813 const KHitTrack& trh0 = itend[0]->second;
1814 std::shared_ptr<const Surface> psurf = trh0.
getSurface();
1816 result = dist_noise.has_value();
1821 if (result) tremom = tre_noise;
1843 double invp_range = 0.;
1844 double invp_ms = 0.;
1859 if (invp_ms != 0.) p = 1. / invp_ms;
1860 double err_p = p * p * std::sqrt(var_invp);
1861 log <<
"Multiple scattering momentum estimate = " << p <<
"+-" << err_p <<
"\n";
1869 bool ok_range =
false;
1879 if (invp_range != 0.) p = 1. / invp_range;
1880 double err_p = p * p * std::sqrt(var_invp);
1881 log <<
"Range momentum estimate = " << p <<
"+-" << err_p <<
"\n";
1886 bool result =
false;
1888 tremom = tremom_range;
1925 std::multimap<double, KHitTrack>& trackmap = trg.
getTrackMap();
1929 if (trackmap.size() == 0)
return false;
1937 std::optional<double> dist0 =
1942 std::optional<double> dist1 =
1947 bool forward =
true;
1960 it = trackmap.end();
1973 it = trackmap.end();
1993 <<
"KalmanFilterAlg::updateMomentum(): invalid track\n";
2023 done = (it == trackmap.end());
2026 done = (it == trackmap.begin());
2033 if (erase_it == trackmap.end())
2036 trackmap.erase(erase_it);
2039 return not
empty(trackmap);
2060 for (
int ismooth = 0; ok && ismooth < nsmooth - 1; ++ismooth) {
2086 std::multimap<double, KHitTrack>& trackmap = trg.
getTrackMap();
2096 int ntrack = trackmap.size();
2098 for (
auto const& trackmap_entry : trackmap) {
2099 const KHitTrack& trh = trackmap_entry.second;
2103 TMarker* marker = marker_it->second;
2104 marker->SetMarkerColor(kGreen);
2129 if ((plane1 >= 0 && plane2 >= 0 && plane1 == plane2) || chisq1 >
fMaxEndChisq ||
2133 TMarker* marker = marker_it->second;
2134 marker->SetMarkerColor(kGreen);
2136 trackmap.erase(trackmap.begin(), it);
2143 it = trackmap.end();
2154 if ((plane1 >= 0 && plane2 >= 0 && plane1 == plane2) || chisq1 >
fMaxEndChisq ||
2159 TMarker* marker = marker_it->second;
2160 marker->SetMarkerColor(kGreen);
2162 trackmap.erase(it, trackmap.end());
2176 bool found_noise =
false;
2177 for (; it != trackmap.end(); ++it, ++nb, --ne) {
2178 if (jt == trackmap.end())
2179 jt = trackmap.begin();
2183 <<
"KalmanFilterAlg::cleanTrack(): nb not positive\n";
2186 <<
"KalmanFilterAlg::cleanTrack(): ne not positive\n";
2188 double disti = (*it).first;
2189 double distj = (*jt).first;
2190 double sep = disti - distj;
2193 <<
"KalmanFilterAlg::fitMomentumRange(): negative separation\n";
2204 for (
auto jt = trackmap.begin(); jt != it; ++jt) {
2209 TMarker* marker = marker_it->second;
2210 marker->SetMarkerColor(kGreen);
2213 trackmap.erase(trackmap.begin(), it);
2221 for (
auto jt = it; jt != trackmap.end(); ++jt) {
2226 TMarker* marker = marker_it->second;
2227 marker->SetMarkerColor(kGreen);
2230 trackmap.erase(it, trackmap.end());
2240 done = !found_noise;
bool fGTrace
Graphical trace flag.
const TrackError & getError() const
Track error matrix.
const std::shared_ptr< const KHitBase > & getHit() const
Measurement.
bool fFitMomRange
Fit momentum using range.
double fMaxPropDist
Maximum propagation distance to candidate surface.
double fGapDist
Minimum gap distance.
bool fFitMomMS
Fit momentum using multiple scattering.
double Mass() const
Based on pdg code.
const std::shared_ptr< const Surface > & getSurface() const
Surface.
double PointingError() const
Pointing error (radians).
double getPredDistance() const
Prediction distance.
void recalibrate()
Recalibrate track map.
std::map< int, TMarker * > fMarkerMap
Markers in current canvas.
int getMeasPlane() const
Measurement plane index.
const std::list< KHitGroup > & getUnused() const
bool smoothTrackIter(int niter, KGTrack &trg, const Propagator &prop) const
Iteratively smooth a track.
const KHitTrack & endTrack() const
Track at end point.
KSymMatrix< 5 >::type TrackError
Track error matrix, dimension 5x5.
const std::vector< std::shared_ptr< const KHitBase > > & getHits() const
Measurement collection accessor.
double fMaxEndChisq
Maximum incremental chisquare for endpoint hit.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Planar surface parallel to x-axis.
KalmanFilterAlg(const fhicl::ParameterSet &pset)
Constructor.
A collection of KHitGroups.
constexpr auto abs(T v)
Returns the absolute value of the argument.
void cleanTrack(KGTrack &trg) const
Clean track by removing noise hits near endpoints.
void addTrack(const KHitTrack &trh)
Add track.
double getPath() const
Estimated path distance.
FitStatus
Fit status enum.
int getID() const
Unique id.
std::vector< double > fGTraceZMin
Graphical trace minimum z for each view.
const std::multimap< double, KHitTrack > & getTrackMap() const
KHitTrack collection, indexed by path distance.
std::optional< double > vec_prop(KTrack &trk, const std::shared_ptr< const Surface > &psurf, PropDirection dir, bool doDedx, TrackMatrix *prop_matrix=0, TrackError *noise_matrix=0) const
Propagate without error (long distance).
double fMaxLDist
Maximum distance for linearized propagation.
double fMaxSortDist
Sort high distance threshold.
double fMaxSeedPredDist
Maximum prediciton distance to accept a hit in seed phase.
ublas::symmetric_matrix< double, ublas::lower, ublas::row_major, ublas::bounded_array< double, N *(N+1)/2 > > type
double fMaxPredDist
Maximum prediciton distance to accept a hit.
M::value_type trace(const M &m)
std::optional< double > noise_prop(KETrack &tre, const std::shared_ptr< const Surface > &psurf, PropDirection dir, bool doDedx, KTrack *ref=0) const
Propagate with error and noise.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
bool fitMomentumMS(const KGTrack &trg, const Propagator &prop, KETrack &tremom) const
Estimate track momentum using multiple scattering.
void setChisq(double chisq)
Set chisquare.
bool buildTrack(const KTrack &trk, KGTrack &trg, const Propagator &prop, const Propagator::PropDirection dir, KHitContainer &hits, bool linear) const
Make a new track.
double getPath() const
Propagation distance.
Kalman filter measurement class template.
ublas::vector< double, ublas::bounded_array< double, N > > type
bool syminvert(ublas::symmetric_matrix< T, TRI, L, A > &m)
double fGTraceWH
Window height.
TVirtualPad * fInfoPad
Information pad.
T get(std::string const &key) const
bool extendTrack(KGTrack &trg, const Propagator &prop, KHitContainer &hits) const
Add hits to existing track.
std::optional< double > err_prop(KETrack &tre, const std::shared_ptr< const Surface > &psurf, PropDirection dir, bool doDedx, KTrack *ref=0, TrackMatrix *prop_matrix=0) const
Propagate with error, but without noise.
std::vector< std::unique_ptr< TCanvas > > fCanvases
Graphical trace canvases.
const std::list< KHitGroup > & getUnsorted() const
double fGTraceXMin
Graphical trace minimum x.
double fGoodPErr
Pointing error threshold for switching to free propagation.
TPaveText * fMessages
Message box.
void setStat(FitStatus stat)
Set fit status.
double fMaxSeedIncChisq
Maximum incremental chisquare to accept a hit in seed phase.
double fMaxSmoothIncChisq
Maximum incremental chisquare to accept a hit in smooth phase.
double fMaxIncChisq
Maximum incremental chisquare to accept a hit.
bool smoothTrack(KGTrack &trg, KGTrack *trg1, const Propagator &prop) const
Smooth track.
double fMinSampleDist
Minimum sample distance (for momentum measurement).
Detector simulation of raw signals on wires.
double fMinSortDist
Sort low distance threshold.
const TrackVector & getVector() const
Track state vector.
virtual void update(KETrack &tre) const =0
Update track method.
virtual double getChisq() const =0
Return incremental chisquare.
double dist(const TReal *x, const TReal *y, const unsigned int dimension)
double fGTraceXMax
Graphical trace maximum x.
void sort(const KTrack &trk, bool addUnsorted, const Propagator &prop, Propagator::PropDirection dir=Propagator::UNKNOWN)
(Re)sort objects in unsorted and sorted lists.
std::vector< TVirtualPad * > fPads
View pads in current canvas.
size_t numHits() const
Number of measurements in track.
double fGTraceWW
Window width.
ublas::matrix< double, ublas::row_major, ublas::bounded_array< double, N *M > > type
virtual bool predict(const KETrack &tre, const Propagator &prop, const KTrack *ref=0) const =0
Prediction method (return false if fail).
const std::shared_ptr< const Surface > & getSurface() const
Surface accessor.
bool combineFit(const KFitTrack &trf)
Combine two tracks.
void setPath(double path)
Set propagation distance.
std::vector< double > fGTraceZMax
Graphical trace maximum z for each view.
int fMaxSamePlane
Maximum consecutive hits in same plane.
Line surface perpendicular to x-axis.
int fMaxNoiseHits
Maximum number of hits in noise cluster.
A collection of KHitTracks.
Basic Kalman filter track class, with fit information.
double fMaxPErr
Maximum pointing error for free propagation.
TPCGeo const & TPC(TPCID const &tpcid=details::tpc_zero) const
Returns the specified TPC.
bool fitMomentumRange(const KGTrack &trg, KETrack &tremom) const
Estimate track momentum using range.
bool isValid() const
Validity flag.
bool fitMomentum(const KGTrack &trg, const Propagator &prop, KETrack &tremom) const
Estimate track momentum using either range or multiple scattering.
bool updateMomentum(const KETrack &tremom, const Propagator &prop, KGTrack &trg) const
Set track momentum at each track surface.
double getChisq() const
Fit chisquare.
const KHitTrack & startTrack() const
Track at start point.
art framework interface to geometry description
double HalfWidth() const
Width is associated with x coordinate [cm].
const std::shared_ptr< const Surface > & getMeasSurface() const
Measurement surface.
int fMinLHits
Minimum number of hits to turn off linearized propagation.
cet::coded_exception< error, detail::translate > exception
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
bool isValid() const
Test if track is valid.
PropDirection
Propagation direction enum.
FitStatus getStat() const
Fit status.
int getPlane() const
Plane index.
int fPlane
Preferred view plane.
const std::list< KHitGroup > & getSorted() const