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" 55 const std::shared_ptr<const trkf::Surface>& psurf = hit.
getMeasSurface();
59 if (
const trkf::SurfYZPlane* pyz = dynamic_cast<const trkf::SurfYZPlane*>(&*psurf)) {
72 double z0 = pyz->z0();
73 double y0 = pyz->y0();
74 double phi = pyz->phi();
78 z = z0 * std::cos(phi) + (ymax - y0) * std::sin(phi);
80 z = z0 * std::cos(phi) - (ymax + y0) * std::sin(phi);
82 else if (
const trkf::SurfYZLine* pyz = dynamic_cast<const trkf::SurfYZLine*>(&*psurf)) {
95 double z0 = pyz->z0();
96 double y0 = pyz->y0();
97 double phi = pyz->phi();
101 z = z0 * std::cos(phi) + (ymax - y0) * std::sin(phi);
103 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;
176 double derivk1 = -0.5 *
trkf::trace(temp1) + 0.5 * inner_prod(defl, vtemp2);
177 double derivk2 = 0.5 *
trkf::trace(temp2) - inner_prod(defl, vtemp3);
184 double q = 1. / std::sqrt(k);
185 double varq = vark / (4. * k * k * k);
186 double derivq1 = (-2. * k / q) * derivk1;
187 double derivq2 = 6. * k * k * derivk1 + 4. * k * k * k * derivk2;
193 double q1 = q - derivq1 / derivq2;
194 double varq1 = -1. / derivq2;
199 double newvarq = 1. / (1. / varq + 1. / varq1);
200 double newq = newvarq * (q / varq + q1 / varq1);
208 double c2 = 2. / (q4 + q2 * std::sqrt(q4 + 4. * mass2));
209 double c = std::sqrt(c2);
210 double dcdq = -2. * (c / q) * (1. + mass2 * c2) / (1. + 2. * mass2 *
c2);
211 double varc = varq * dcdq * dcdq;
228 , fMaxSeedIncChisq(0.)
229 , fMaxSmoothIncChisq(0.)
234 , fMaxSeedPredDist(0.)
242 , fFitMomRange(false)
251 mf::LogInfo(
"KalmanFilterAlg") <<
"KalmanFilterAlg instantiated.";
316 throw cet::exception(
"KalmanFilterAlg") <<
"No direction for Kalman fit.\n";
326 std::ostringstream ostr;
327 ostr <<
"khit" << cnum;
333 fCanvases.back()->Divide(2, nview / 2 + 1);
337 for (
int iview = 0; iview < nview; ++iview) {
339 std::ostringstream ostr;
340 ostr <<
"Plane " << iview;
347 TPad* p =
new TPad(ostr.str().c_str(), ostr.str().c_str(), zmin, xmin, zmax, xmax);
348 p->SetBit(kCanDelete);
350 p->SetFillStyle(4000);
356 TText* t =
new TText(zmax - 0.02, xmax - 0.03, ostr.str().c_str());
357 t->SetBit(kCanDelete);
360 t->SetTextSize(0.04);
367 pz1->SetBit(kCanDelete);
371 px1->SetBit(kCanDelete);
376 pz2->SetBit(kCanDelete);
380 px2->SetBit(kCanDelete);
388 TLegend*
leg =
new TLegend(0.6, 0.5, 0.99, 0.99);
389 leg->SetBit(kCanDelete);
391 TLegendEntry* entry = 0;
394 m =
new TMarker(0., 0., 20);
395 m->SetBit(kCanDelete);
396 m->SetMarkerSize(1.2);
397 m->SetMarkerColor(kRed);
398 entry = leg->AddEntry(m,
"Hits on Track",
"P");
399 entry->SetBit(kCanDelete);
401 m =
new TMarker(0., 0., 20);
402 m->SetBit(kCanDelete);
403 m->SetMarkerSize(1.2);
404 m->SetMarkerColor(kOrange);
405 entry = leg->AddEntry(m,
"Smoothed Hits on Track",
"P");
406 entry->SetBit(kCanDelete);
408 m =
new TMarker(0., 0., 20);
409 m->SetBit(kCanDelete);
410 m->SetMarkerSize(1.2);
411 m->SetMarkerColor(kBlack);
412 entry = leg->AddEntry(m,
"Available Hits",
"P");
413 entry->SetBit(kCanDelete);
415 m =
new TMarker(0., 0., 20);
416 m->SetBit(kCanDelete);
417 m->SetMarkerSize(1.2);
418 m->SetMarkerColor(kBlue);
419 entry = leg->AddEntry(m,
"Rejected Hits",
"P");
420 entry->SetBit(kCanDelete);
422 m =
new TMarker(0., 0., 20);
423 m->SetBit(kCanDelete);
424 m->SetMarkerSize(1.2);
425 m->SetMarkerColor(kGreen);
426 entry = leg->AddEntry(m,
"Removed Hits",
"P");
427 entry->SetBit(kCanDelete);
429 m =
new TMarker(0., 0., 20);
430 m->SetBit(kCanDelete);
431 m->SetMarkerSize(1.2);
432 m->SetMarkerColor(kMagenta);
433 entry = leg->AddEntry(m,
"Seed Hits",
"P");
434 entry->SetBit(kCanDelete);
436 m =
new TMarker(0., 0., 20);
437 m->SetBit(kCanDelete);
438 m->SetMarkerSize(1.2);
439 m->SetMarkerColor(kCyan);
440 entry = leg->AddEntry(m,
"Unreachable Seed Hits",
"P");
441 entry->SetBit(kCanDelete);
447 fMessages =
new TPaveText(0.01, 0.01, 0.55, 0.99,
"");
453 TText* t =
fMessages->AddText(
"Enter buildTrack");
454 t->SetBit(kCanDelete);
470 const std::list<KHitGroup>& groups = hits.
getSorted();
471 for (
auto const& gr : groups) {
475 const std::vector<std::shared_ptr<const KHitBase>>& phits = gr.getHits();
476 for (
auto const& phit : phits) {
479 if (pl >= 0 && pl <
int(
fPads.size())) {
482 hit_position(hit, z, x);
483 TMarker* marker =
new TMarker(z, x, 20);
486 marker->SetBit(kCanDelete);
487 marker->SetMarkerSize(0.5);
488 marker->SetMarkerColor(kMagenta);
498 const std::list<KHitGroup>& ugroups = hits.
getUnsorted();
499 for (
auto const& gr : ugroups) {
503 const std::vector<std::shared_ptr<const KHitBase>>& phits = gr.getHits();
504 for (
auto const& phit : phits) {
507 if (pl >= 0 && pl <
int(
fPads.size())) {
510 hit_position(hit, z, x);
511 TMarker* marker =
new TMarker(z, x, 20);
514 marker->SetBit(kCanDelete);
515 marker->SetMarkerSize(0.5);
516 marker->SetMarkerColor(kCyan);
531 bool has_pref_plane =
false;
555 log <<
"Build Step " << step <<
"\n";
556 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
572 double path_est = gr.
getPath();
573 log <<
"Next surface: " << *(gr.
getSurface()) <<
"\n";
574 log <<
" Estimated path length of hit group = " << path_est <<
"\n";
582 std::shared_ptr<const Surface> psurf = trf.
getSurface();
606 log <<
"After propagation\n";
607 log <<
" Incremental propagation distance = " << ds <<
"\n";
608 log <<
" Path length of prediction surface = " << path <<
"\n";
609 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
615 const std::vector<std::shared_ptr<const KHitBase>>& hits = gr.
getHits();
616 double best_chisq = 0.;
617 std::shared_ptr<const KHitBase> best_hit;
628 TMarker* marker = marker_it->second;
629 marker->SetMarkerColor(kBlue);
641 log <<
"Trying Hit.\n" 642 << hit <<
"\nchisq = " << chisq <<
"\n" 643 <<
"prediction distance = " << preddist <<
"\n";
646 (best_hit.get() == 0 || chisq < best_chisq)) {
653 log <<
"Best hit incremental chisquare = " << best_chisq <<
"\n";
654 if (best_hit.get() != 0) {
655 log <<
"Hit after prediction\n";
659 log <<
"No hit passed chisquare cut.\n";
667 bool update_ok =
false;
668 if (best_hit.get() != 0) {
670 best_hit->update(trf);
672 if (!update_ok) trf = trf0;
675 ds += best_hit->getPredDistance();
676 tchisq += best_chisq;
688 if (
fTrace) log <<
"Quitting because pointing error got too large.\n";
711 int pl = best_hit->getMeasPlane();
712 if (pl >= 0 && pl <
int(
fPads.size())) {
713 auto marker_it =
fMarkerMap.find(best_hit->getID());
715 TMarker* marker = marker_it->second;
716 marker->SetMarkerColor(kRed);
738 if (
fTrace) log <<
"Killing reference track.\n";
742 log <<
"After update\n";
743 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
757 if (pref == 0 && dist &&
760 if (
fTrace) log <<
"Resorting measurements.\n";
761 hits.
sort(trf,
true, prop, dir);
788 log <<
"KalmanFilterAlg build track summary.\n" 790 <<
"Track has " << trg.
numHits() <<
" hits.\n" 791 <<
"Track length = " << path <<
"\n" 792 <<
"Track chisquare = " << fchisq <<
"\n";
801 t =
fMessages->AddText(
"Exit buildTrack, status success");
803 t =
fMessages->AddText(
"Exit buildTrack, status fail");
804 t->SetBit(kCanDelete);
909 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::smoothTrack(): no track!\n";
942 <<
"KalmanFilterAlg::smoothTrack(): invalid direction\n";
951 while (dofit && it != itend) {
954 log <<
"Smooth Step " << step <<
"\n";
955 log <<
"Reverse fit track:\n";
965 log <<
"Forward track:\n";
975 std::shared_ptr<const Surface> psurf = trh.
getSurface();
997 log <<
"Reverse fit track after propagation:\n";
998 log <<
" Propagation distance = " << ds <<
"\n";
1031 log <<
"Combined track:\n";
1038 if (not hit.
predict(trf, prop, &ref)) {
1060 bool update_ok = trf.
isValid();
1073 log <<
"Reverse fit track after update:\n";
1079 TMarker* marker = marker_it->second;
1080 marker->SetMarkerColor(kOrange);
1106 if (result && trg1 != 0 && trg1->
isValid()) {
1127 log <<
"KalmanFilterAlg smooth track summary.\n" 1129 <<
"Track has " << trg.
numHits() <<
" hits.\n" 1131 <<
"Track chisquare = " << fchisq <<
"\n";
1158 bool result =
false;
1161 TText* t =
fMessages->AddText(
"Enter extendTrack");
1162 t->SetBit(kCanDelete);
1169 unsigned int nhits0 = trg.
numHits();
1247 hits.
sort(trf,
true, prop, dir);
1256 const std::list<KHitGroup>& groups = hits.
getSorted();
1257 for (
auto const& gr : groups) {
1261 const std::vector<std::shared_ptr<const KHitBase>>& phits = gr.getHits();
1262 for (
auto const& phit : phits) {
1265 if (pl >= 0 && pl <
int(
fPads.size())) {
1269 TMarker* marker = 0;
1274 hit_position(hit, z, x);
1275 marker =
new TMarker(z, x, 20);
1278 marker->SetBit(kCanDelete);
1279 marker->SetMarkerSize(0.5);
1283 marker = marker_it->second;
1284 marker->SetMarkerColor(kBlack);
1292 const std::list<KHitGroup>& ugroups = hits.
getUnsorted();
1293 for (
auto const& gr : ugroups) {
1297 const std::vector<std::shared_ptr<const KHitBase>>& phits = gr.getHits();
1298 for (
auto const& phit : phits) {
1301 if (pl >= 0 && pl <
int(
fPads.size())) {
1305 TMarker* marker = 0;
1310 hit_position(hit, z, x);
1311 marker =
new TMarker(z, x, 20);
1314 marker->SetBit(kCanDelete);
1315 marker->SetMarkerSize(0.5);
1319 marker = marker_it->second;
1320 marker->SetMarkerColor(kBlue);
1333 int last_plane = -1;
1337 log <<
"Extend Step " << step <<
"\n";
1338 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
1353 <<
"KalmanFilterAlg::extendTrack(): invalid direction\n";
1358 double path_est = gr.
getPath();
1359 log <<
"Next surface: " << *(gr.
getSurface()) <<
"\n";
1360 log <<
" Estimated path length of hit group = " << path_est <<
"\n";
1368 std::shared_ptr<const Surface> psurf = trf.
getSurface();
1371 <<
"KalmanFilterAlg::extendTrack(): negative plane?\n";
1394 log <<
"After propagation\n";
1395 log <<
" Incremental distance = " << ds <<
"\n";
1396 log <<
" Track path length = " << path <<
"\n";
1397 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
1403 const std::vector<std::shared_ptr<const KHitBase>>& hits = gr.
getHits();
1404 double best_chisq = 0.;
1405 std::shared_ptr<const KHitBase> best_hit;
1416 TMarker* marker = marker_it->second;
1417 marker->SetMarkerColor(kBlue);
1425 bool ok = hit.
predict(trf, prop);
1429 if (
abs(preddist) <
fMaxPredDist && (best_hit.get() == 0 || chisq < best_chisq)) {
1436 log <<
"Best hit incremental chisquare = " << best_chisq <<
"\n";
1437 if (best_hit.get() != 0) {
1438 log <<
"Hit after prediction\n";
1442 log <<
"No hit passed chisquare cut.\n";
1450 bool update_ok =
false;
1451 if (best_hit.get() != 0) {
1453 best_hit->update(trf);
1455 if (!update_ok) trf = trf0;
1458 ds += best_hit->getPredDistance();
1459 tchisq += best_chisq;
1470 if (
fTrace) log <<
"Quitting because pointing error got too large.\n";
1493 int pl = best_hit->getMeasPlane();
1494 if (pl >= 0 && pl <
int(
fPads.size())) {
1495 auto marker_it =
fMarkerMap.find(best_hit->getID());
1497 TMarker* marker = marker_it->second;
1498 marker->SetMarkerColor(kRed);
1515 log <<
"After update\n";
1516 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
1532 if (
fTrace) log <<
"Resorting measurements.\n";
1533 hits.
sort(trf,
true, prop, dir);
1560 <<
"KalmanFilterAlg::extendTrack(): invalid direction [II]\n";
1566 log <<
"KalmanFilterAlg extend track summary.\n" 1568 <<
"Track has " << trg.
numHits() <<
" hits.\n" 1569 <<
"Track length = " << path <<
"\n" 1570 <<
"Track chisquare = " << fchisq <<
"\n";
1576 result = (trg.
numHits() > nhits0);
1581 t =
fMessages->AddText(
"Exit extendTrack, status success");
1583 t =
fMessages->AddText(
"Exit extendTrack, status fail");
1584 t->SetBit(kCanDelete);
1608 if (!trg.
isValid())
return false;
1615 <<
"KalmanFilterAlg::fitMomentumRange(): invalid end track\n";
1665 const std::multimap<double, KHitTrack>& trackmap = trg.
getTrackMap();
1666 if (trackmap.size() < 2)
return false;
1668 itend[0] = trackmap.begin();
1669 itend[1] = trackmap.end();
1677 for (
int i = 0; result && i < 2; ++i) {
1678 const KHitTrack& trh = itend[i]->second;
1682 for (
int j = 0; j < 4; ++j) {
1683 if (err(4, j) != 0.) result =
false;
1686 if (!result)
return result;
1702 double s_sample = itend[1]->first;
1703 const KETrack& tre = itend[1]->second;
1713 double invp0 = tre_noise.
getVector()(4);
1714 double var_invp0 = tre_noise.
getError()(4, 4);
1719 for (
auto it = trackmap.rbegin(); it != trackmap.rend(); ++it) {
1720 double s = it->first;
1735 std::shared_ptr<const Surface> psurf = trh.
getSurface();
1737 std::optional<double> dist_range =
1739 std::optional<double> dist_noise =
1745 bool momentum_updated =
false;
1746 if (dist_inf && dist_range && dist_noise) {
1750 double invp1 = tre_noise.
getVector()(4);
1751 double var_invp1 = tre_noise.
getError()(4, 4);
1756 double invp = 0.5 * (invp0 + invp1);
1757 double var_invp = 0.5 * (var_invp0 + var_invp1);
1758 double mass = tre_inf.
Mass();
1759 double beta = std::sqrt(1. + mass * mass * invp * invp);
1760 double invbp = invp / beta;
1778 project(tre_inf.
getError(), ublas::range(2, 4), ublas::range(2, 4));
1782 project(tre_noise.
getError(), ublas::range(2, 4), ublas::range(2, 4));
1788 double new_invp = invp;
1789 double new_var_invp = var_invp;
1790 update_momentum(defl, errc, errn, mass, new_invp, new_var_invp);
1795 double dp = 1. / new_invp - 1. / invp;
1796 invp0 = 1. / (1. / invp1 + dp);
1797 var_invp0 = new_var_invp;
1798 momentum_updated =
true;
1803 double invp_range = trk_range.
getVector()(4);
1804 if (invp0 > invp_range) invp0 = invp_range;
1809 if (momentum_updated) {
1814 double invp_range = trk_range.
getVector()(4);
1819 tre_noise.
getError()(4, 4) = var_invp0;
1828 const KHitTrack& trh0 = itend[0]->second;
1829 std::shared_ptr<const Surface> psurf = trh0.
getSurface();
1831 result = dist_noise.has_value();
1836 if (result) tremom = tre_noise;
1858 double invp_range = 0.;
1859 double invp_ms = 0.;
1874 if (invp_ms != 0.) p = 1. / invp_ms;
1875 double err_p = p * p * std::sqrt(var_invp);
1876 log <<
"Multiple scattering momentum estimate = " << p <<
"+-" << err_p <<
"\n";
1884 bool ok_range =
false;
1894 if (invp_range != 0.) p = 1. / invp_range;
1895 double err_p = p * p * std::sqrt(var_invp);
1896 log <<
"Range momentum estimate = " << p <<
"+-" << err_p <<
"\n";
1901 bool result =
false;
1903 tremom = tremom_range;
1940 std::multimap<double, KHitTrack>& trackmap = trg.
getTrackMap();
1944 if (trackmap.size() == 0)
return false;
1952 std::optional<double> dist0 =
1957 std::optional<double> dist1 =
1962 bool forward =
true;
1975 it = trackmap.end();
1988 it = trackmap.end();
2008 <<
"KalmanFilterAlg::updateMomentum(): invalid track\n";
2038 done = (it == trackmap.end());
2041 done = (it == trackmap.begin());
2048 if (erase_it == trackmap.end())
2051 trackmap.erase(erase_it);
2054 return not
empty(trackmap);
2075 for (
int ismooth = 0; ok && ismooth < nsmooth - 1; ++ismooth) {
2101 std::multimap<double, KHitTrack>& trackmap = trg.
getTrackMap();
2111 int ntrack = trackmap.size();
2113 for (
auto const& trackmap_entry : trackmap) {
2114 const KHitTrack& trh = trackmap_entry.second;
2118 TMarker* marker = marker_it->second;
2119 marker->SetMarkerColor(kGreen);
2144 if ((plane1 >= 0 && plane2 >= 0 && plane1 == plane2) || chisq1 >
fMaxEndChisq ||
2148 TMarker* marker = marker_it->second;
2149 marker->SetMarkerColor(kGreen);
2151 trackmap.erase(trackmap.begin(), it);
2158 it = trackmap.end();
2169 if ((plane1 >= 0 && plane2 >= 0 && plane1 == plane2) || chisq1 >
fMaxEndChisq ||
2174 TMarker* marker = marker_it->second;
2175 marker->SetMarkerColor(kGreen);
2177 trackmap.erase(it, trackmap.end());
2191 bool found_noise =
false;
2192 for (; it != trackmap.end(); ++it, ++nb, --ne) {
2193 if (jt == trackmap.end())
2194 jt = trackmap.begin();
2198 <<
"KalmanFilterAlg::cleanTrack(): nb not positive\n";
2201 <<
"KalmanFilterAlg::cleanTrack(): ne not positive\n";
2203 double disti = (*it).first;
2204 double distj = (*jt).first;
2205 double sep = disti - distj;
2208 <<
"KalmanFilterAlg::fitMomentumRange(): negative separation\n";
2219 for (
auto jt = trackmap.begin(); jt != it; ++jt) {
2224 TMarker* marker = marker_it->second;
2225 marker->SetMarkerColor(kGreen);
2228 trackmap.erase(trackmap.begin(), it);
2236 for (
auto jt = it; jt != trackmap.end(); ++jt) {
2241 TMarker* marker = marker_it->second;
2242 marker->SetMarkerColor(kGreen);
2245 trackmap.erase(it, trackmap.end());
2255 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.
Length_t DetHalfWidth(TPCID const &tpcid=tpc_zero) const
Returns the half width of the active volume of the specified TPC.
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.
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.
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.
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
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