13 #include "boost/numeric/ublas/matrix_proxy.hpp" 14 #include "boost/numeric/ublas/vector_proxy.hpp" 15 #include "cetlib_except/exception.h" 27 #include "TLegendEntry.h" 31 #include "TPaveText.h" 33 #include "TVirtualPad.h" 54 const std::shared_ptr<const trkf::Surface>& psurf = hit.
getMeasSurface();
58 if (
const trkf::SurfYZPlane* pyz = dynamic_cast<const trkf::SurfYZPlane*>(&*psurf)) {
71 double z0 = pyz->z0();
72 double y0 = pyz->y0();
73 double phi = pyz->phi();
77 z = z0 * std::cos(phi) + (ymax - y0) * std::sin(phi);
79 z = z0 * std::cos(phi) - (ymax + y0) * std::sin(phi);
81 else if (
const trkf::SurfYZLine* pyz = dynamic_cast<const trkf::SurfYZLine*>(&*psurf)) {
94 double z0 = pyz->z0();
95 double y0 = pyz->y0();
96 double phi = pyz->phi();
100 z = z0 * std::cos(phi) + (ymax - y0) * std::sin(phi);
102 z = z0 * std::cos(phi) - (ymax + y0) * std::sin(phi);
140 double invp2 = invp * invp;
141 double invp3 = invp * invp2;
142 double invp4 = invp2 * invp2;
143 double mass2 = mass * mass;
144 double k = std::sqrt(invp2 + mass2 * invp4);
145 double dkdinvp = (invp + 2. * mass2 * invp3) / k;
146 double vark = var_invp * dkdinvp * dkdinvp;
175 prod(temp1, vtemp1, vtemp2);
177 double derivk1 = -0.5 *
trkf::trace(temp1) + 0.5 * inner_prod(defl, vtemp2);
178 double derivk2 = 0.5 *
trkf::trace(temp2) - inner_prod(defl, vtemp3);
185 double q = 1. / std::sqrt(k);
186 double varq = vark / (4. * k * k *
k);
187 double derivq1 = (-2. * k / q) * derivk1;
188 double derivq2 = 6. * k * k * derivk1 + 4. * k * k * k * derivk2;
194 double q1 = q - derivq1 / derivq2;
195 double varq1 = -1. / derivq2;
200 double newvarq = 1. / (1. / varq + 1. / varq1);
201 double newq = newvarq * (q / varq + q1 / varq1);
209 double c2 = 2. / (q4 + q2 * std::sqrt(q4 + 4. * mass2));
210 double c = std::sqrt(c2);
211 double dcdq = -2. * (c / q) * (1. + mass2 * c2) / (1. + 2. * mass2 * c2);
212 double varc = varq * dcdq * dcdq;
229 , fMaxSeedIncChisq(0.)
230 , fMaxSmoothIncChisq(0.)
235 , fMaxSeedPredDist(0.)
243 , fFitMomRange(false)
252 mf::LogInfo(
"KalmanFilterAlg") <<
"KalmanFilterAlg instantiated.";
318 throw cet::exception(
"KalmanFilterAlg") <<
"No direction for Kalman fit.\n";
328 std::ostringstream ostr;
329 ostr <<
"khit" << cnum;
335 fCanvases.back()->Divide(2, nview / 2 + 1);
339 for (
int iview = 0; iview < nview; ++iview) {
341 std::ostringstream ostr;
342 ostr <<
"Plane " << iview;
349 TPad*
p =
new TPad(ostr.str().c_str(), ostr.str().c_str(), zmin, xmin, zmax, xmax);
350 p->SetBit(kCanDelete);
352 p->SetFillStyle(4000);
358 TText*
t =
new TText(zmax - 0.02, xmax - 0.03, ostr.str().c_str());
359 t->SetBit(kCanDelete);
362 t->SetTextSize(0.04);
369 pz1->SetBit(kCanDelete);
373 px1->SetBit(kCanDelete);
378 pz2->SetBit(kCanDelete);
382 px2->SetBit(kCanDelete);
390 TLegend*
leg =
new TLegend(0.6, 0.5, 0.99, 0.99);
391 leg->SetBit(kCanDelete);
393 TLegendEntry*
entry = 0;
396 m =
new TMarker(0., 0., 20);
397 m->SetBit(kCanDelete);
398 m->SetMarkerSize(1.2);
399 m->SetMarkerColor(kRed);
400 entry = leg->AddEntry(m,
"Hits on Track",
"P");
401 entry->SetBit(kCanDelete);
403 m =
new TMarker(0., 0., 20);
404 m->SetBit(kCanDelete);
405 m->SetMarkerSize(1.2);
406 m->SetMarkerColor(kOrange);
407 entry = leg->AddEntry(m,
"Smoothed Hits on Track",
"P");
408 entry->SetBit(kCanDelete);
410 m =
new TMarker(0., 0., 20);
411 m->SetBit(kCanDelete);
412 m->SetMarkerSize(1.2);
413 m->SetMarkerColor(kBlack);
414 entry = leg->AddEntry(m,
"Available Hits",
"P");
415 entry->SetBit(kCanDelete);
417 m =
new TMarker(0., 0., 20);
418 m->SetBit(kCanDelete);
419 m->SetMarkerSize(1.2);
420 m->SetMarkerColor(kBlue);
421 entry = leg->AddEntry(m,
"Rejected Hits",
"P");
422 entry->SetBit(kCanDelete);
424 m =
new TMarker(0., 0., 20);
425 m->SetBit(kCanDelete);
426 m->SetMarkerSize(1.2);
427 m->SetMarkerColor(kGreen);
428 entry = leg->AddEntry(m,
"Removed Hits",
"P");
429 entry->SetBit(kCanDelete);
431 m =
new TMarker(0., 0., 20);
432 m->SetBit(kCanDelete);
433 m->SetMarkerSize(1.2);
434 m->SetMarkerColor(kMagenta);
435 entry = leg->AddEntry(m,
"Seed Hits",
"P");
436 entry->SetBit(kCanDelete);
438 m =
new TMarker(0., 0., 20);
439 m->SetBit(kCanDelete);
440 m->SetMarkerSize(1.2);
441 m->SetMarkerColor(kCyan);
442 entry = leg->AddEntry(m,
"Unreachable Seed Hits",
"P");
443 entry->SetBit(kCanDelete);
449 fMessages =
new TPaveText(0.01, 0.01, 0.55, 0.99,
"");
455 TText*
t =
fMessages->AddText(
"Enter buildTrack");
456 t->SetBit(kCanDelete);
472 const std::list<KHitGroup>& groups = hits.
getSorted();
473 for (
auto const& gr : groups) {
477 const std::vector<std::shared_ptr<const KHitBase>>& phits = gr.getHits();
478 for (
auto const& phit : phits) {
481 if (pl >= 0 && pl <
int(
fPads.size())) {
484 hit_position(hit, z, x);
485 TMarker* marker =
new TMarker(z, x, 20);
488 marker->SetBit(kCanDelete);
489 marker->SetMarkerSize(0.5);
490 marker->SetMarkerColor(kMagenta);
500 const std::list<KHitGroup>& ugroups = hits.
getUnsorted();
501 for (
auto const& gr : ugroups) {
505 const std::vector<std::shared_ptr<const KHitBase>>& phits = gr.getHits();
506 for (
auto const& phit : phits) {
509 if (pl >= 0 && pl <
int(
fPads.size())) {
512 hit_position(hit, z, x);
513 TMarker* marker =
new TMarker(z, x, 20);
516 marker->SetBit(kCanDelete);
517 marker->SetMarkerSize(0.5);
518 marker->SetMarkerColor(kCyan);
533 bool has_pref_plane =
false;
557 log <<
"Build Step " << step <<
"\n";
558 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
574 double path_est = gr.
getPath();
575 log <<
"Next surface: " << *(gr.
getSurface()) <<
"\n";
576 log <<
" Estimated path length of hit group = " << path_est <<
"\n";
584 std::shared_ptr<const Surface> psurf = trf.
getSurface();
608 log <<
"After propagation\n";
609 log <<
" Incremental propagation distance = " << ds <<
"\n";
610 log <<
" Path length of prediction surface = " << path <<
"\n";
611 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
617 const std::vector<std::shared_ptr<const KHitBase>>& hits = gr.
getHits();
618 double best_chisq = 0.;
619 std::shared_ptr<const KHitBase> best_hit;
630 TMarker* marker = marker_it->second;
631 marker->SetMarkerColor(kBlue);
643 log <<
"Trying Hit.\n" 644 << hit <<
"\nchisq = " << chisq <<
"\n" 645 <<
"prediction distance = " << preddist <<
"\n";
648 (best_hit.get() == 0 || chisq < best_chisq)) {
655 log <<
"Best hit incremental chisquare = " << best_chisq <<
"\n";
656 if (best_hit.get() != 0) {
657 log <<
"Hit after prediction\n";
661 log <<
"No hit passed chisquare cut.\n";
669 bool update_ok =
false;
670 if (best_hit.get() != 0) {
672 best_hit->update(trf);
674 if (!update_ok) trf = trf0;
677 ds += best_hit->getPredDistance();
678 tchisq += best_chisq;
690 if (
fTrace) log <<
"Quitting because pointing error got too large.\n";
713 int pl = best_hit->getMeasPlane();
714 if (pl >= 0 && pl <
int(
fPads.size())) {
715 auto marker_it =
fMarkerMap.find(best_hit->getID());
717 TMarker* marker = marker_it->second;
718 marker->SetMarkerColor(kRed);
740 if (
fTrace) log <<
"Killing reference track.\n";
744 log <<
"After update\n";
745 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
759 if (pref == 0 && dist &&
762 if (
fTrace) log <<
"Resorting measurements.\n";
763 hits.
sort(trf,
true, prop, dir);
790 log <<
"KalmanFilterAlg build track summary.\n" 792 <<
"Track has " << trg.
numHits() <<
" hits.\n" 793 <<
"Track length = " << path <<
"\n" 794 <<
"Track chisquare = " << fchisq <<
"\n";
803 t =
fMessages->AddText(
"Exit buildTrack, status success");
805 t =
fMessages->AddText(
"Exit buildTrack, status fail");
806 t->SetBit(kCanDelete);
912 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::smoothTrack(): no track!\n";
945 <<
"KalmanFilterAlg::smoothTrack(): invalid direction\n";
954 while (dofit && it != itend) {
957 log <<
"Smooth Step " << step <<
"\n";
958 log <<
"Reverse fit track:\n";
968 log <<
"Forward track:\n";
978 std::shared_ptr<const Surface> psurf = trh.
getSurface();
1000 log <<
"Reverse fit track after propagation:\n";
1001 log <<
" Propagation distance = " << ds <<
"\n";
1034 log <<
"Combined track:\n";
1041 if (not hit.
predict(trf, prop, &ref)) {
1063 bool update_ok = trf.
isValid();
1076 log <<
"Reverse fit track after update:\n";
1082 TMarker* marker = marker_it->second;
1083 marker->SetMarkerColor(kOrange);
1109 if (result && trg1 != 0 && trg1->
isValid()) {
1130 log <<
"KalmanFilterAlg smooth track summary.\n" 1132 <<
"Track has " << trg.
numHits() <<
" hits.\n" 1134 <<
"Track chisquare = " << fchisq <<
"\n";
1163 TText*
t =
fMessages->AddText(
"Enter extendTrack");
1164 t->SetBit(kCanDelete);
1171 unsigned int nhits0 = trg.
numHits();
1249 hits.
sort(trf,
true, prop, dir);
1258 const std::list<KHitGroup>& groups = hits.
getSorted();
1259 for (
auto const& gr : groups) {
1263 const std::vector<std::shared_ptr<const KHitBase>>& phits = gr.getHits();
1264 for (
auto const& phit : phits) {
1267 if (pl >= 0 && pl <
int(
fPads.size())) {
1271 TMarker* marker = 0;
1276 hit_position(hit, z, x);
1277 marker =
new TMarker(z, x, 20);
1280 marker->SetBit(kCanDelete);
1281 marker->SetMarkerSize(0.5);
1285 marker = marker_it->second;
1286 marker->SetMarkerColor(kBlack);
1294 const std::list<KHitGroup>& ugroups = hits.
getUnsorted();
1295 for (
auto const& gr : ugroups) {
1299 const std::vector<std::shared_ptr<const KHitBase>>& phits = gr.getHits();
1300 for (
auto const& phit : phits) {
1303 if (pl >= 0 && pl <
int(
fPads.size())) {
1307 TMarker* marker = 0;
1312 hit_position(hit, z, x);
1313 marker =
new TMarker(z, x, 20);
1316 marker->SetBit(kCanDelete);
1317 marker->SetMarkerSize(0.5);
1321 marker = marker_it->second;
1322 marker->SetMarkerColor(kBlue);
1335 int last_plane = -1;
1339 log <<
"Extend Step " << step <<
"\n";
1340 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
1355 <<
"KalmanFilterAlg::extendTrack(): invalid direction\n";
1360 double path_est = gr.
getPath();
1361 log <<
"Next surface: " << *(gr.
getSurface()) <<
"\n";
1362 log <<
" Estimated path length of hit group = " << path_est <<
"\n";
1370 std::shared_ptr<const Surface> psurf = trf.
getSurface();
1373 <<
"KalmanFilterAlg::extendTrack(): negative plane?\n";
1396 log <<
"After propagation\n";
1397 log <<
" Incremental distance = " << ds <<
"\n";
1398 log <<
" Track path length = " << path <<
"\n";
1399 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
1405 const std::vector<std::shared_ptr<const KHitBase>>& hits = gr.
getHits();
1406 double best_chisq = 0.;
1407 std::shared_ptr<const KHitBase> best_hit;
1418 TMarker* marker = marker_it->second;
1419 marker->SetMarkerColor(kBlue);
1427 bool ok = hit.
predict(trf, prop);
1431 if (
abs(preddist) <
fMaxPredDist && (best_hit.get() == 0 || chisq < best_chisq)) {
1438 log <<
"Best hit incremental chisquare = " << best_chisq <<
"\n";
1439 if (best_hit.get() != 0) {
1440 log <<
"Hit after prediction\n";
1444 log <<
"No hit passed chisquare cut.\n";
1452 bool update_ok =
false;
1453 if (best_hit.get() != 0) {
1455 best_hit->update(trf);
1457 if (!update_ok) trf = trf0;
1460 ds += best_hit->getPredDistance();
1461 tchisq += best_chisq;
1472 if (
fTrace) log <<
"Quitting because pointing error got too large.\n";
1495 int pl = best_hit->getMeasPlane();
1496 if (pl >= 0 && pl <
int(
fPads.size())) {
1497 auto marker_it =
fMarkerMap.find(best_hit->getID());
1499 TMarker* marker = marker_it->second;
1500 marker->SetMarkerColor(kRed);
1517 log <<
"After update\n";
1518 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
1534 if (
fTrace) log <<
"Resorting measurements.\n";
1535 hits.
sort(trf,
true, prop, dir);
1562 <<
"KalmanFilterAlg::extendTrack(): invalid direction [II]\n";
1568 log <<
"KalmanFilterAlg extend track summary.\n" 1570 <<
"Track has " << trg.
numHits() <<
" hits.\n" 1571 <<
"Track length = " << path <<
"\n" 1572 <<
"Track chisquare = " << fchisq <<
"\n";
1578 result = (trg.
numHits() > nhits0);
1583 t =
fMessages->AddText(
"Exit extendTrack, status success");
1585 t =
fMessages->AddText(
"Exit extendTrack, status fail");
1586 t->SetBit(kCanDelete);
1611 if (!trg.
isValid())
return false;
1618 <<
"KalmanFilterAlg::fitMomentumRange(): invalid end track\n";
1669 const std::multimap<double, KHitTrack>& trackmap = trg.
getTrackMap();
1670 if (trackmap.size() < 2)
return false;
1672 itend[0] = trackmap.begin();
1673 itend[1] = trackmap.end();
1681 for (
int i = 0; result && i < 2; ++i) {
1682 const KHitTrack& trh = itend[i]->second;
1686 for (
int j = 0; j < 4; ++j) {
1687 if (
err(4, j) != 0.) result =
false;
1690 if (!result)
return result;
1706 double s_sample = itend[1]->first;
1707 const KETrack& tre = itend[1]->second;
1717 double invp0 = tre_noise.
getVector()(4);
1718 double var_invp0 = tre_noise.
getError()(4, 4);
1723 for (
auto it = trackmap.rbegin(); it != trackmap.rend(); ++it) {
1724 double s = it->first;
1739 std::shared_ptr<const Surface> psurf = trh.
getSurface();
1741 std::optional<double> dist_range =
1743 std::optional<double> dist_noise =
1749 bool momentum_updated =
false;
1750 if (dist_inf && dist_range && dist_noise) {
1754 double invp1 = tre_noise.
getVector()(4);
1755 double var_invp1 = tre_noise.
getError()(4, 4);
1760 double invp = 0.5 * (invp0 + invp1);
1761 double var_invp = 0.5 * (var_invp0 + var_invp1);
1762 double mass = tre_inf.
Mass();
1763 double beta = std::sqrt(1. + mass * mass * invp * invp);
1764 double invbp = invp /
beta;
1786 project(tre_noise.
getError(), ublas::range(2, 4), ublas::range(2, 4));
1792 double new_invp = invp;
1793 double new_var_invp = var_invp;
1794 update_momentum(defl, errc, errn, mass, new_invp, new_var_invp);
1799 double dp = 1. / new_invp - 1. / invp;
1800 invp0 = 1. / (1. / invp1 + dp);
1801 var_invp0 = new_var_invp;
1802 momentum_updated =
true;
1807 double invp_range = trk_range.
getVector()(4);
1808 if (invp0 > invp_range) invp0 = invp_range;
1813 if (momentum_updated) {
1818 double invp_range = trk_range.
getVector()(4);
1823 tre_noise.
getError()(4, 4) = var_invp0;
1832 const KHitTrack& trh0 = itend[0]->second;
1833 std::shared_ptr<const Surface> psurf = trh0.
getSurface();
1835 result = dist_noise.has_value();
1840 if (result) tremom = tre_noise;
1863 double invp_range = 0.;
1864 double invp_ms = 0.;
1879 if (invp_ms != 0.) p = 1. / invp_ms;
1880 double err_p = p * p * std::sqrt(var_invp);
1881 log <<
"Multiple scattering momentum estimate = " << p <<
"+-" << err_p <<
"\n";
1889 bool ok_range =
false;
1899 if (invp_range != 0.) p = 1. / invp_range;
1900 double err_p = p * p * std::sqrt(var_invp);
1901 log <<
"Range momentum estimate = " << p <<
"+-" << err_p <<
"\n";
1908 tremom = tremom_range;
1946 std::multimap<double, KHitTrack>& trackmap = trg.
getTrackMap();
1950 if (trackmap.size() == 0)
return false;
1958 std::optional<double> dist0 =
1963 std::optional<double> dist1 =
1968 bool forward =
true;
1981 it = trackmap.end();
1994 it = trackmap.end();
2014 <<
"KalmanFilterAlg::updateMomentum(): invalid track\n";
2044 done = (it == trackmap.end());
2047 done = (it == trackmap.begin());
2054 if (erase_it == trackmap.end())
2057 trackmap.erase(erase_it);
2060 return not
empty(trackmap);
2082 for (
int ismooth = 0; ok && ismooth < nsmooth - 1; ++ismooth) {
2109 std::multimap<double, KHitTrack>& trackmap = trg.
getTrackMap();
2119 int ntrack = trackmap.size();
2121 for (
auto const& trackmap_entry : trackmap) {
2122 const KHitTrack& trh = trackmap_entry.second;
2126 TMarker* marker = marker_it->second;
2127 marker->SetMarkerColor(kGreen);
2152 if ((plane1 >= 0 && plane2 >= 0 && plane1 == plane2) || chisq1 >
fMaxEndChisq ||
2156 TMarker* marker = marker_it->second;
2157 marker->SetMarkerColor(kGreen);
2159 trackmap.erase(trackmap.begin(), it);
2166 it = trackmap.end();
2177 if ((plane1 >= 0 && plane2 >= 0 && plane1 == plane2) || chisq1 >
fMaxEndChisq ||
2182 TMarker* marker = marker_it->second;
2183 marker->SetMarkerColor(kGreen);
2185 trackmap.erase(it, trackmap.end());
2199 bool found_noise =
false;
2200 for (; it != trackmap.end(); ++it, ++
nb, --ne) {
2201 if (jt == trackmap.end())
2202 jt = trackmap.begin();
2206 <<
"KalmanFilterAlg::cleanTrack(): nb not positive\n";
2209 <<
"KalmanFilterAlg::cleanTrack(): ne not positive\n";
2211 double disti = (*it).first;
2212 double distj = (*jt).first;
2213 double sep = disti - distj;
2216 <<
"KalmanFilterAlg::fitMomentumRange(): negative separation\n";
2227 for (
auto jt = trackmap.begin(); jt != it; ++jt) {
2232 TMarker* marker = marker_it->second;
2233 marker->SetMarkerColor(kGreen);
2236 trackmap.erase(trackmap.begin(), it);
2244 for (
auto jt = it; jt != trackmap.end(); ++jt) {
2249 TMarker* marker = marker_it->second;
2250 marker->SetMarkerColor(kGreen);
2253 trackmap.erase(it, trackmap.end());
2263 done = !found_noise;
bool fGTrace
Graphical trace flag.
ublas::symmetric_matrix< double, ublas::lower, ublas::row_major, ublas::bounded_array< double, N *(N+1)/2 > > type
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.
static constexpr double nb
double beta(double KE, const simb::MCParticle *part)
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
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
ublas::matrix< double, ublas::row_major, ublas::bounded_array< double, N *M > > type
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.
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.
art framework interface to geometry description
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.
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.
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).
void err(const char *fmt,...)
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.
const KVector< N >::type & getMeasVector() const
Measurement vector.
constexpr 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.
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.
double fMaxPErr
Maximum pointing error for free propagation.
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.
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