12 #include "cetlib_except/exception.h" 14 #include "boost/numeric/ublas/vector_proxy.hpp" 15 #include "boost/numeric/ublas/matrix_proxy.hpp" 24 #include "TLegendEntry.h" 44 const std::shared_ptr<const trkf::Surface>& psurf = hit.
getMeasSurface();
48 if(
const trkf::SurfYZPlane* pyz = dynamic_cast<const trkf::SurfYZPlane*>(&*psurf)) {
61 double z0 = pyz->z0();
62 double y0 = pyz->y0();
63 double phi = pyz->phi();
67 z = z0 * std::cos(phi) + (ymax - y0) * std::sin(phi);
69 z = z0 * std::cos(phi) - (ymax + y0) * std::sin(phi);
80 else if(
const trkf::SurfYZLine* pyz = dynamic_cast<const trkf::SurfYZLine*>(&*psurf)) {
93 double z0 = pyz->z0();
94 double y0 = pyz->y0();
95 double phi = pyz->phi();
99 z = z0 * std::cos(phi) + (ymax - y0) * std::sin(phi);
101 z = z0 * std::cos(phi) - (ymax + y0) * std::sin(phi);
118 double mass,
double& invp,
double& var_invp)
145 double invp2 = invp*invp;
146 double invp3 = invp*invp2;
147 double invp4 = invp2*invp2;
148 double mass2 = mass*mass;
149 double k = std::sqrt(invp2 + mass2 * invp4);
150 double dkdinvp = (invp + 2.*mass2*invp3) / k;
151 double vark = var_invp * dkdinvp*dkdinvp;
180 prod(temp1, vtemp1, vtemp2);
182 double derivk1 = -0.5 *
trkf::trace(temp1) + 0.5 * inner_prod(defl, vtemp2);
183 double derivk2 = 0.5 *
trkf::trace(temp2) - inner_prod(defl, vtemp3);
190 double q = 1./std::sqrt(k);
191 double varq = vark / (4.*k*k*k);
192 double derivq1 = (-2.*k/q) * derivk1;
193 double derivq2 = 6.*k*k * derivk1 + 4.*k*k*k * derivk2;
199 double q1 = q - derivq1 / derivq2;
200 double varq1 = -1./derivq2;
205 double newvarq = 1. / (1./varq + 1./varq1);
206 double newq = newvarq * (q/varq + q1/varq1);
214 double c2 = 2. / (q4 + q2 * std::sqrt(q4 + 4.*mass2));
215 double c = std::sqrt(c2);
216 double dcdq = -2. * (c/q) * (1. + mass2*c2) / (1. + 2.*mass2*
c2);
217 double varc = varq * dcdq*dcdq;
234 fMaxSeedIncChisq(0.),
235 fMaxSmoothIncChisq(0.),
240 fMaxSeedPredDist(0.),
257 mf::LogInfo(
"KalmanFilterAlg") <<
"KalmanFilterAlg instantiated.";
332 throw cet::exception(
"KalmanFilterAlg") <<
"trkf::KalmanFilterAlg::buildTrack(): no propagator\n";
338 <<
"No direction for Kalman fit.\n";
348 std::ostringstream ostr;
349 ostr <<
"khit" << cnum;
350 fCanvases.emplace_back(
new TCanvas(ostr.str().c_str(), ostr.str().c_str(),
355 fCanvases.back()->Divide(2, nview/2 + 1);
359 for(
int iview=0; iview < nview; ++iview) {
361 std::ostringstream ostr;
362 ostr <<
"Plane " << iview;
369 TPad* p =
new TPad(ostr.str().c_str(), ostr.str().c_str(), zmin, xmin, zmax, xmax);
370 p->SetBit(kCanDelete);
372 p->SetFillStyle(4000);
378 TText* t =
new TText(zmax-0.02, xmax-0.03, ostr.str().c_str());
379 t->SetBit(kCanDelete);
382 t->SetTextSize(0.04);
387 TGaxis* pz1 =
new TGaxis(zmin, xmin, zmax, xmin,
389 pz1->SetBit(kCanDelete);
392 TGaxis* px1 =
new TGaxis(zmin, xmin, zmin, xmax,
394 px1->SetBit(kCanDelete);
397 TGaxis* pz2 =
new TGaxis(zmin, xmax, zmax, xmax,
399 pz2->SetBit(kCanDelete);
402 TGaxis* px2 =
new TGaxis(zmax, xmin, zmax, xmax,
404 px2->SetBit(kCanDelete);
413 TLegend*
leg =
new TLegend(0.6, 0.5, 0.99, 0.99);
414 leg->SetBit(kCanDelete);
416 TLegendEntry* entry = 0;
419 m =
new TMarker(0., 0., 20);
420 m->SetBit(kCanDelete);
421 m->SetMarkerSize(1.2);
422 m->SetMarkerColor(kRed);
423 entry = leg->AddEntry(m,
"Hits on Track",
"P");
424 entry->SetBit(kCanDelete);
426 m =
new TMarker(0., 0., 20);
427 m->SetBit(kCanDelete);
428 m->SetMarkerSize(1.2);
429 m->SetMarkerColor(kOrange);
430 entry = leg->AddEntry(m,
"Smoothed Hits on Track",
"P");
431 entry->SetBit(kCanDelete);
433 m =
new TMarker(0., 0., 20);
434 m->SetBit(kCanDelete);
435 m->SetMarkerSize(1.2);
436 m->SetMarkerColor(kBlack);
437 entry = leg->AddEntry(m,
"Available Hits",
"P");
438 entry->SetBit(kCanDelete);
440 m =
new TMarker(0., 0., 20);
441 m->SetBit(kCanDelete);
442 m->SetMarkerSize(1.2);
443 m->SetMarkerColor(kBlue);
444 entry = leg->AddEntry(m,
"Rejected Hits",
"P");
445 entry->SetBit(kCanDelete);
447 m =
new TMarker(0., 0., 20);
448 m->SetBit(kCanDelete);
449 m->SetMarkerSize(1.2);
450 m->SetMarkerColor(kGreen);
451 entry = leg->AddEntry(m,
"Removed Hits",
"P");
452 entry->SetBit(kCanDelete);
454 m =
new TMarker(0., 0., 20);
455 m->SetBit(kCanDelete);
456 m->SetMarkerSize(1.2);
457 m->SetMarkerColor(kMagenta);
458 entry = leg->AddEntry(m,
"Seed Hits",
"P");
459 entry->SetBit(kCanDelete);
461 m =
new TMarker(0., 0., 20);
462 m->SetBit(kCanDelete);
463 m->SetMarkerSize(1.2);
464 m->SetMarkerColor(kCyan);
465 entry = leg->AddEntry(m,
"Unreachable Seed Hits",
"P");
466 entry->SetBit(kCanDelete);
472 fMessages =
new TPaveText(0.01, 0.01, 0.55, 0.99,
"");
478 TText* t =
fMessages->AddText(
"Enter buildTrack");
479 t->SetBit(kCanDelete);
495 const std::list<KHitGroup>& groups = hits.
getSorted();
496 for(
auto const& gr : groups) {
500 const std::vector<std::shared_ptr<const KHitBase> >& phits = gr.getHits();
501 for(
auto const& phit : phits) {
504 if(pl >= 0 && pl <
int(
fPads.size())) {
507 hit_position(hit, z, x);
508 TMarker* marker =
new TMarker(z, x, 20);
511 marker->SetBit(kCanDelete);
512 marker->SetMarkerSize(0.5);
513 marker->SetMarkerColor(kMagenta);
523 const std::list<KHitGroup>& ugroups = hits.
getUnsorted();
524 for(
auto const& gr : ugroups) {
528 const std::vector<std::shared_ptr<const KHitBase> >& phits = gr.getHits();
529 for(
auto const& phit : phits) {
532 if(pl >= 0 && pl <
int(
fPads.size())) {
535 hit_position(hit, z, x);
536 TMarker* marker =
new TMarker(z, x, 20);
539 marker->SetBit(kCanDelete);
540 marker->SetMarkerSize(0.5);
541 marker->SetMarkerColor(kCyan);
556 bool has_pref_plane =
false;
580 log <<
"Build Step " << step <<
"\n";
581 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
597 double path_est = gr.
getPath();
598 log <<
"Next surface: " << *(gr.
getSurface()) <<
"\n";
599 log <<
" Estimated path length of hit group = " << path_est <<
"\n";
607 std::shared_ptr<const Surface> psurf = trf.
getSurface();
617 dist = boost::optional<double>(
false, 0.);
634 log <<
"After propagation\n";
635 log <<
" Incremental propagation distance = " << ds <<
"\n";
636 log <<
" Path length of prediction surface = " << path <<
"\n";
637 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
643 const std::vector<std::shared_ptr<const KHitBase> >& hits = gr.
getHits();
644 double best_chisq = 0.;
645 std::shared_ptr<const KHitBase> best_hit;
647 ihit != hits.end(); ++ihit) {
655 TMarker* marker = marker_it->second;
656 marker->SetMarkerColor(kBlue);
664 bool ok = hit.
predict(trf, prop);
669 log <<
"Trying Hit.\n" 671 <<
"\nchisq = " << chisq <<
"\n" 672 <<
"prediction distance = " << preddist <<
"\n";
675 (best_hit.get() == 0 || chisq < best_chisq) ) {
683 log <<
"Best hit incremental chisquare = " << best_chisq <<
"\n";
684 if(best_hit.get() != 0) {
685 log <<
"Hit after prediction\n";
689 log <<
"No hit passed chisquare cut.\n";
698 bool update_ok =
false;
699 if(best_hit.get() != 0) {
701 best_hit->update(trf);
707 ds += best_hit->getPredDistance();
708 tchisq += best_chisq;
721 log <<
"Quitting because pointing error got too large.\n";
744 int pl = best_hit->getMeasPlane();
745 if(pl >= 0 && pl <
int(
fPads.size())) {
746 auto marker_it =
fMarkerMap.find(best_hit->getID());
748 TMarker* marker = marker_it->second;
749 marker->SetMarkerColor(kRed);
765 has_pref_plane =
true;
773 log <<
"Killing reference track.\n";
777 log <<
"After update\n";
778 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
792 if(pref == 0 && !!dist &&
796 log <<
"Resorting measurements.\n";
797 hits.
sort(trf,
true, prop, dir);
824 log <<
"KalmanFilterAlg build track summary.\n" 826 <<
"Track has " << trg.
numHits() <<
" hits.\n" 827 <<
"Track length = " << path <<
"\n" 828 <<
"Track chisquare = " << fchisq <<
"\n";
838 t =
fMessages->AddText(
"Exit buildTrack, status success");
840 t =
fMessages->AddText(
"Exit buildTrack, status fail");
841 t->SetBit(kCanDelete);
887 throw cet::exception(
"KalmanFilterAlg") <<
"trkf::KalmanFilterAlg::smoothTrack(): no propagator\n";
960 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::smoothTrack(): no track!\n";
992 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::smoothTrack(): invalid direction\n";
1001 while(dofit && it != itend) {
1004 log <<
"Smooth Step " << step <<
"\n";
1005 log <<
"Reverse fit track:\n";
1016 log <<
"Forward track:\n";
1026 std::shared_ptr<const Surface> psurf = trh.
getSurface();
1049 log <<
"Reverse fit track after propagation:\n";
1050 log <<
" Propagation distance = " << ds <<
"\n";
1083 log <<
"Combined track:\n";
1090 bool ok = hit.
predict(trf, prop, &ref);
1114 bool update_ok = trf.
isValid();
1127 log <<
"Reverse fit track after update:\n";
1133 TMarker* marker = marker_it->second;
1134 marker->SetMarkerColor(kOrange);
1162 if(result && trg1 != 0 && trg1->
isValid()) {
1183 log <<
"KalmanFilterAlg smooth track summary.\n" 1185 <<
"Track has " << trg.
numHits() <<
" hits.\n" 1187 <<
"Track chisquare = " << fchisq <<
"\n";
1228 throw cet::exception(
"KalmanFilterAlg") <<
"trkf::KalmanFilterAlg::extendTrack(): no propagator\n";
1232 bool result =
false;
1235 TText* t =
fMessages->AddText(
"Enter extendTrack");
1236 t->SetBit(kCanDelete);
1243 unsigned int nhits0 = trg.
numHits();
1321 hits.
sort(trf,
true, prop, dir);
1330 const std::list<KHitGroup>& groups = hits.
getSorted();
1331 for(
auto const& gr : groups) {
1335 const std::vector<std::shared_ptr<const KHitBase> >& phits = gr.getHits();
1336 for(
auto const& phit : phits) {
1339 if(pl >= 0 && pl <
int(
fPads.size())) {
1343 TMarker* marker = 0;
1348 hit_position(hit, z, x);
1349 marker =
new TMarker(z, x, 20);
1352 marker->SetBit(kCanDelete);
1353 marker->SetMarkerSize(0.5);
1357 marker = marker_it->second;
1358 marker->SetMarkerColor(kBlack);
1366 const std::list<KHitGroup>& ugroups = hits.
getUnsorted();
1367 for(
auto const& gr : ugroups) {
1371 const std::vector<std::shared_ptr<const KHitBase> >& phits = gr.getHits();
1372 for(
auto const& phit : phits) {
1375 if(pl >= 0 && pl <
int(
fPads.size())) {
1379 TMarker* marker = 0;
1384 hit_position(hit, z, x);
1385 marker =
new TMarker(z, x, 20);
1388 marker->SetBit(kCanDelete);
1389 marker->SetMarkerSize(0.5);
1393 marker = marker_it->second;
1394 marker->SetMarkerColor(kBlue);
1407 int last_plane = -1;
1411 log <<
"Extend Step " << step <<
"\n";
1412 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
1428 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::extendTrack(): invalid direction\n";
1433 double path_est = gr.
getPath();
1434 log <<
"Next surface: " << *(gr.
getSurface()) <<
"\n";
1435 log <<
" Estimated path length of hit group = " << path_est <<
"\n";
1443 std::shared_ptr<const Surface> psurf = trf.
getSurface();
1445 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::extendTrack(): negative plane?\n";
1453 dist = boost::optional<double>(
false, 0.);
1470 log <<
"After propagation\n";
1471 log <<
" Incremental distance = " << ds <<
"\n";
1472 log <<
" Track path length = " << path <<
"\n";
1473 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
1479 const std::vector<std::shared_ptr<const KHitBase> >& hits = gr.
getHits();
1480 double best_chisq = 0.;
1481 std::shared_ptr<const KHitBase> best_hit;
1483 ihit != hits.end(); ++ihit) {
1491 TMarker* marker = marker_it->second;
1492 marker->SetMarkerColor(kBlue);
1500 bool ok = hit.
predict(trf, prop);
1505 (best_hit.get() == 0 || chisq < best_chisq)) {
1513 log <<
"Best hit incremental chisquare = " << best_chisq <<
"\n";
1514 if(best_hit.get() != 0) {
1515 log <<
"Hit after prediction\n";
1519 log <<
"No hit passed chisquare cut.\n";
1528 bool update_ok =
false;
1529 if(best_hit.get() != 0) {
1531 best_hit->update(trf);
1537 ds += best_hit->getPredDistance();
1538 tchisq += best_chisq;
1550 log <<
"Quitting because pointing error got too large.\n";
1573 int pl = best_hit->getMeasPlane();
1574 if(pl >= 0 && pl <
int(
fPads.size())) {
1575 auto marker_it =
fMarkerMap.find(best_hit->getID());
1577 TMarker* marker = marker_it->second;
1578 marker->SetMarkerColor(kRed);
1595 log <<
"After update\n";
1596 log <<
"KGTrack has " << trg.
numHits() <<
" hits.\n";
1614 log <<
"Resorting measurements.\n";
1615 hits.
sort(trf,
true, prop, dir);
1641 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::extendTrack(): invalid direction [II]\n";
1647 log <<
"KalmanFilterAlg extend track summary.\n" 1649 <<
"Track has " << trg.
numHits() <<
" hits.\n" 1650 <<
"Track length = " << path <<
"\n" 1651 <<
"Track chisquare = " << fchisq <<
"\n";
1657 result = (trg.
numHits() > nhits0);
1662 t =
fMessages->AddText(
"Exit extendTrack, status success");
1664 t =
fMessages->AddText(
"Exit extendTrack, status fail");
1665 t->SetBit(kCanDelete);
1698 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::fitMomentumRange(): invalid end track\n";
1748 const std::multimap<double, KHitTrack>& trackmap = trg.
getTrackMap();
1749 if(trackmap.size() < 2)
1752 itend[0] = trackmap.begin();
1753 itend[1] = trackmap.end();
1761 for(
int i=0; result && i<2; ++i) {
1762 const KHitTrack& trh = itend[i]->second;
1767 for(
int j=0; j<4; ++j) {
1789 double s_sample = itend[1]->first;
1790 const KETrack& tre = itend[1]->second;
1800 double invp0 = tre_noise.
getVector()(4);
1801 double var_invp0 = tre_noise.
getError()(4,4);
1806 for(std::multimap<double, KHitTrack>::const_reverse_iterator it = trackmap.rbegin();
1807 it != trackmap.rend(); ++it) {
1808 double s = it->first;
1824 std::shared_ptr<const Surface> psurf = trh.
getSurface();
1825 boost::optional<double> dist_inf = prop->
err_prop(tre_inf, psurf,
1827 boost::optional<double> dist_range = prop->
vec_prop(trk_range, psurf,
1829 boost::optional<double> dist_noise = prop->
noise_prop(tre_noise, psurf,
1835 bool momentum_updated =
false;
1836 if(!!dist_inf && !!dist_range && !!dist_noise) {
1840 double invp1 = tre_noise.
getVector()(4);
1841 double var_invp1 = tre_noise.
getError()(4,4);
1846 double invp = 0.5 * (invp0 + invp1);
1847 double var_invp = 0.5 * (var_invp0 + var_invp1);
1848 double mass = tre_inf.
Mass();
1849 double beta = std::sqrt(1. + mass*mass*invp*invp);
1850 double invbp = invp /
beta;
1868 project(tre_inf.
getError(), ublas::range(2, 4), ublas::range(2, 4));
1870 project(trh.
getError(), ublas::range(2, 4), ublas::range(2, 4));
1873 project(tre_noise.
getError(), ublas::range(2, 4), ublas::range(2, 4));
1879 double new_invp = invp;
1880 double new_var_invp = var_invp;
1881 update_momentum(defl, errc, errn, mass, new_invp, new_var_invp);
1886 double dp = 1./new_invp - 1./invp;
1887 invp0 = 1./(1./invp1 + dp);
1888 var_invp0 = new_var_invp;
1889 momentum_updated =
true;
1894 double invp_range = trk_range.
getVector()(4);
1895 if(invp0 > invp_range)
1901 if(momentum_updated) {
1906 double invp_range = trk_range.
getVector()(4);
1911 tre_noise.
getError()(4,4) = var_invp0;
1920 const KHitTrack& trh0 = itend[0]->second;
1921 std::shared_ptr<const Surface> psurf = trh0.
getSurface();
1922 boost::optional<double> dist_noise = prop->
noise_prop(tre_noise, psurf,
1924 result = !!dist_noise;
1952 double invp_range = 0.;
1953 double invp_ms = 0.;
1970 double err_p = p*p * std::sqrt(var_invp);
1971 log <<
"Multiple scattering momentum estimate = " << p <<
"+-" << err_p <<
"\n";
1979 bool ok_range =
false;
1989 if(invp_range != 0.)
1991 double err_p = p*p * std::sqrt(var_invp);
1992 log <<
"Range momentum estimate = " << p <<
"+-" << err_p <<
"\n";
1997 bool result =
false;
1999 tremom = tremom_range;
2036 std::multimap<double, KHitTrack>& trackmap = trg.
getTrackMap();
2040 if(trackmap.size() == 0)
2049 boost::optional<double> dist0 = prop->
vec_prop(tre0, trackmap.begin()->second.getSurface(),
2054 boost::optional<double> dist1 = prop->
vec_prop(tre1, trackmap.rbegin()->second.getSurface(),
2059 bool forward =
true;
2071 if(std::abs(*dist0) > std::abs(*dist1)) {
2072 it = trackmap.end();
2085 it = trackmap.end();
2104 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::updateMomentum(): invalid track\n";
2135 done = (it == trackmap.end());
2138 done = (it == trackmap.begin());
2146 if(erase_it == trackmap.end())
2149 trackmap.erase(erase_it);
2152 bool result = (trackmap.size() > 0);
2190 for(
int ismooth = 0; ok && ismooth < nsmooth-1; ++ismooth) {
2218 std::multimap<double, KHitTrack>& trackmap = trg.
getTrackMap();
2228 int ntrack = trackmap.size();
2230 for(
auto const& trackmap_entry : trackmap) {
2231 const KHitTrack& trh = trackmap_entry.second;
2235 TMarker* marker = marker_it->second;
2236 marker->SetMarkerColor(kGreen);
2261 if((plane1 >= 0 && plane2 >= 0 && plane1 == plane2) ||
2265 TMarker* marker = marker_it->second;
2266 marker->SetMarkerColor(kGreen);
2268 trackmap.erase(trackmap.begin(), it);
2275 it = trackmap.end();
2286 if((plane1 >= 0 && plane2 >= 0 && plane1 == plane2) ||
2291 TMarker* marker = marker_it->second;
2292 marker->SetMarkerColor(kGreen);
2294 trackmap.erase(it, trackmap.end());
2308 bool found_noise =
false;
2309 for(; it != trackmap.end(); ++it, ++nb, --ne) {
2310 if(jt == trackmap.end())
2311 jt = trackmap.begin();
2314 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::cleanTrack(): nb not positive\n";
2316 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::cleanTrack(): ne not positive\n";
2318 double disti = (*it).first;
2319 double distj = (*jt).first;
2320 double sep = disti - distj;
2322 throw cet::exception(
"KalmanFilterAlg") <<
"KalmanFilterAlg::fitMomentumRange(): negative separation\n";
2333 for(
auto jt = trackmap.begin(); jt != it; ++jt) {
2338 TMarker* marker = marker_it->second;
2339 marker->SetMarkerColor(kGreen);
2342 trackmap.erase(trackmap.begin(), it);
2350 for(
auto jt = it; jt != trackmap.end(); ++jt) {
2355 TMarker* marker = marker_it->second;
2356 marker->SetMarkerColor(kGreen);
2359 trackmap.erase(it, trackmap.end());
2369 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.
bool fitMomentumRange(const KGTrack &trg, const Propagator *prop, KETrack &tremom) const
Estimate track momentum using range.
double fMaxPropDist
Maximum propagation distance to candidate surface.
double fGapDist
Minimum gap distance.
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.
void sort(const KTrack &trk, bool addUnsorted, const Propagator *prop, Propagator::PropDirection dir=Propagator::UNKNOWN)
(Re)sort objects in unsorted and sorted lists.
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
Unused list.
ublas::matrix< double, ublas::row_major, ublas::bounded_array< double, N *M > > type
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.
bool smoothTrack(KGTrack &trg, KGTrack *trg1, const Propagator *prop) const
Smooth track.
KalmanFilterAlg(const fhicl::ParameterSet &pset)
Constructor.
bool extendTrack(KGTrack &trg, const Propagator *prop, KHitContainer &hits) const
Add hits to existing track.
void cleanTrack(KGTrack &trg) const
Clean track by removing noise hits near endpoints.
void addTrack(const KHitTrack &trh)
Add track.
~KalmanFilterAlg()
Destructor.
double getPath() const
Estimated path distance.
bool fitMomentum(const KGTrack &trg, const Propagator *prop, KETrack &tremom) const
Estimate track momentum using either range or multiple scattering.
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.
boost::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.
double fMaxLDist
Maximum distance for linearized propagation.
boost::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.
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)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
void setChisq(double chisq)
Set chisquare.
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
void reconfigure(const fhicl::ParameterSet &pset)
Reconfigure method.
std::vector< std::unique_ptr< TCanvas > > fCanvases
Graphical trace canvases.
const std::list< KHitGroup > & getUnsorted() const
Unsorted list.
bool updateMomentum(const KETrack &tremom, const Propagator *prop, KGTrack &trg) const
Set track momentum at each track surface.
double fGTraceXMin
Graphical trace minimum x.
double fGoodPErr
Pointing error threshold for switching to free propagation.
TPaveText * fMessages
Message box.
bool smoothTrackIter(int niter, KGTrack &trg, const Propagator *prop) const
Iteratively smooth a track.
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.
boost::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 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.
bool fitMomentumMS(const KGTrack &trg, const Propagator *prop, KETrack &tremom) const
Estimate track momentum using multiple scattering.
double fGTraceXMax
Graphical trace maximum x.
std::vector< TVirtualPad * > fPads
View pads in current canvas.
size_t numHits() const
Number of measurements in track.
double fGTraceWW
Window width.
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.
bool buildTrack(const KTrack &trk, KGTrack &trg, const Propagator *prop, const Propagator::PropDirection dir, KHitContainer &hits, bool linear) const
Make a new track.
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 isValid() const
Validity flag.
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.
virtual bool predict(const KETrack &tre, const Propagator *prop=0, const KTrack *ref=0) const =0
Prediction method (return false if fail).
int fMinLHits
Minimum number of hits to turn off linearized propagation.
cet::coded_exception< error, detail::translate > exception
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
Sorted list.