27 std::vector<Point_t> positions;
28 positions.reserve(src.
size());
29 std::vector<Vector_t> momenta;
30 momenta.reserve(src.
size());
31 std::vector<recob::TrajectoryPointFlags> outFlags;
32 outFlags.reserve(src.
size());
34 for (
size_t i = 0,
h = 0; i < src.
size(); i++)
35 if (src[i]->IsEnabled()) {
36 auto const& point3d = src[i]->Point3D();
37 positions.emplace_back(point3d.X(), point3d.Y(), point3d.Z());
60 : fProjectionMatchingAlg(pmalgConfig), fPMAlgVertexing(pmvtxConfig)
62 unsigned int cryo, tpc, view;
63 for (
auto const&
h : allhitlist) {
64 cryo =
h->WireID().Cryostat;
65 tpc =
h->WireID().TPC;
66 view =
h->WireID().Plane;
68 fHitMap[cryo][tpc][view].push_back(
h);
84 for (
auto const&
t : tracks.
tracks()) {
85 auto&
trk = *(
t.Track());
87 unsigned int tpc =
trk.FrontTPC(), cryo =
trk.FrontCryo();
88 if ((tpc ==
trk.BackTPC()) && (cryo ==
trk.BackCryo())) {
104 const std::vector<recob::Cluster>& clusters,
105 const std::vector<recob::PFParticle>& pfparticles,
106 const art::FindManyP<recob::Hit>& hitsFromClusters,
107 const art::FindManyP<recob::Cluster>& clusFromPfps,
108 const art::FindManyP<recob::Vertex>& vtxFromPfps,
113 , fTrackingOnlyPdg(pmalgFitterConfig.TrackingOnlyPdg())
114 , fTrackingSkipPdg(pmalgFitterConfig.TrackingSkipPdg())
115 , fRunVertexing(pmalgFitterConfig.RunVertexing())
117 mf::LogVerbatim(
"PMAlgFitter") <<
"Found " << allhitlist.size() <<
"hits in the event.";
118 mf::LogVerbatim(
"PMAlgFitter") <<
"Sort hits by clusters assigned to PFParticles...";
121 for (
size_t i = 0; i < pfparticles.size(); ++i) {
124 auto cv = clusFromPfps.at(i);
125 for (
const auto&
c : cv) {
128 auto hv = hitsFromClusters.at(
c.key());
130 for (
auto const&
h : hv)
135 if (vtxFromPfps.isValid() && vtxFromPfps.at(i).size()) {
137 vtxFromPfps.at(i).front()->XYZ(xyz);
143 <<
fPfpClusters.size() <<
" pfparticles for 3D tracking.";
180 bool selectPdg =
true;
184 int pfPartIdx = pfpCluEntry.first;
191 mf::LogVerbatim(
"PMAlgFitter") <<
"Process clusters from PFP:" << pfPartIdx <<
", pdg:" <<
pdg;
193 std::vector<art::Ptr<recob::Hit>> allHits;
196 std::unordered_map<geo::View_t, size_t> clu_count;
197 for (
const auto&
c : pfpCluEntry.second) {
198 if (
c->NHits() == 0) {
continue; }
201 clu_count[
c->View()]++;
203 allHits.reserve(allHits.size() +
fCluHits.at(
c.key()).
size());
205 allHits.push_back(
h);
208 if (clu_count.size() > 1)
210 candidate.
SetKey(pfpCluEntry.first);
218 mf::LogError(
"PMAlgFitter") <<
"Trajectory fit lenght is nan.";
236 bool selectPdg =
true;
240 int pfPartIdx = pfpCluEntry.first;
243 if (pdg != 11)
continue;
247 mf::LogVerbatim(
"PMAlgFitter") <<
"Process clusters from PFP:" << pfPartIdx <<
", pdg:" <<
pdg;
249 std::vector<art::Ptr<recob::Hit>> allHits;
252 std::unordered_map<geo::View_t, size_t> clu_count;
253 for (
const auto&
c : pfpCluEntry.second) {
254 if (
c->NHits() == 0) {
continue; }
257 clu_count[
c->View()]++;
259 allHits.reserve(allHits.size() +
fCluHits.at(
c.key()).
size());
261 allHits.push_back(
h);
263 if (clu_count.size() > 1)
265 candidate.
SetKey(pfpCluEntry.first);
290 const std::vector<recob::Wire>& wires,
297 const std::vector<TH1F*>& hpassing,
298 const std::vector<TH1F*>& hrejected)
301 , fMinSeedSize1stPass(pmalgTrackerConfig.MinSeedSize1stPass())
302 , fMinSeedSize2ndPass(pmalgTrackerConfig.MinSeedSize2ndPass())
303 , fTrackLikeThreshold(pmalgTrackerConfig.TrackLikeThreshold())
304 , fMinTwoViewFraction(pmalgConfig.MinTwoViewFraction())
305 , fFlipToBeam(pmalgTrackerConfig.FlipToBeam())
306 , fFlipDownward(pmalgTrackerConfig.FlipDownward())
307 , fFlipToX(pmalgTrackerConfig.FlipToX())
308 , fAutoFlip_dQdx(pmalgTrackerConfig.AutoFlip_dQdx())
309 , fMergeWithinTPC(pmalgTrackerConfig.MergeWithinTPC())
310 , fMergeTransverseShift(pmalgTrackerConfig.MergeTransverseShift())
311 , fMergeAngle(pmalgTrackerConfig.MergeAngle())
312 , fCosmicTagger(pmtaggerConfig)
313 , fTagCosmicTracks(fCosmicTagger.tagAny())
314 , fStitchBetweenTPCs(pmalgTrackerConfig.StitchBetweenTPCs())
315 , fStitchDistToWall(pmalgTrackerConfig.StitchDistToWall())
316 , fStitchTransverseShift(pmalgTrackerConfig.StitchTransverseShift())
317 , fStitchAngle(pmalgTrackerConfig.StitchAngle())
318 , fMatchT0inAPACrossing(pmalgTrackerConfig.MatchT0inAPACrossing())
319 , fMatchT0inCPACrossing(pmalgTrackerConfig.MatchT0inCPACrossing())
320 , fStitcher(pmstitchConfig)
322 , fAdcInPassingPoints(hpassing)
323 , fAdcInRejectedPoints(hrejected)
324 , fGeom(&*(
art::ServiceHandle<
geo::Geometry
const>()))
331 mf::LogVerbatim(
"PMAlgTracker") <<
"Using views in the following order:";
341 for (
size_t p = 0;
p < nplanes; ++
p) {
346 else if (pmalgTrackerConfig.
Validation() ==
"adc") {
349 else if (pmalgTrackerConfig.
Validation() ==
"calib") {
358 <<
"Not enough planes to perform validation, switch mode to hits.";
364 mf::LogVerbatim(
"PMAlgTracker") <<
"Validation ADC thresholds per plane:";
377 fCluHits.reserve(hitsFromClusters.size());
380 for (
size_t i = 0; i < hitsFromClusters.size(); ++i) {
381 auto v = hitsFromClusters.at(i);
383 for (
auto const&
h : v)
393 const std::vector<float>& trackLike)
395 mf::LogVerbatim(
"PMAlgTracker") <<
"Filter track-like clusters using likelihood values...";
397 fCluHits.reserve(hitsFromClusters.size());
400 for (
size_t i = 0; i < hitsFromClusters.size(); ++i) {
401 auto v = hitsFromClusters.at(i);
403 for (
auto const&
h : v)
412 const art::FindManyP<recob::Hit>& hitsFromEmParts)
416 fCluHits.reserve(hitsFromClusters.size());
420 for (
size_t i = 0; i < hitsFromClusters.size(); ++i) {
421 auto v = hitsFromClusters.at(i);
423 for (
auto const&
h : v) {
425 for (
size_t j = 0; j < hitsFromEmParts.size(); ++j) {
426 auto u = hitsFromEmParts.at(j);
427 for (
auto const&
g : u)
429 if (
g.key() ==
h.key()) {
436 if (trkLike)
fCluHits.back().push_back(
h);
446 mf::LogVerbatim(
"PMAlgTracker") <<
"...done, " << n <<
" clusters for 3D tracking.";
453 unsigned int testView)
456 mf::LogVerbatim(
"PMAlgTracker") <<
"first or last node too far out of its initial TPC";
461 mf::LogVerbatim(
"PMAlgTracker") <<
"validation in plane: " << testView;
511 if ((hits.size() > 1) || (dist2 > 1.0))
515 size_t best_u = 0, n_max = 0;
516 for (
size_t u = 0; u < tracks.
size(); u++)
527 if (best_trk && (n_max >= hits.size() / 3))
539 tracks[best_u].SetTrack(ext);
546 size_t minSizeCompl = hits.
size() / 8;
547 if (minSizeCompl < 3) minSizeCompl = 3;
550 unsigned int tpc = hits.front()->WireID().TPC;
551 unsigned int cryo = hits.front()->WireID().Cryostat;
554 matchCluster(detProp, -1, hits, minSizeCompl, tpc, cryo, first_view);
558 <<
" Add new track, cut hits from source track." <<
std::endl;
567 else if ((hits.size() == 1) || (dist2 > 2.25))
582 while ((idx < trk.
size() - 1) && !(trk[idx]->IsEnabled())) {
583 hits.push_back(trk[idx++]->Hit2DPtr());
588 if ((idx < trk.
size() - 1) && (trk[idx]->View2D() == trk[idx - 1]->View2D())) {
591 if (dprev < dnext) { hits.push_back(trk[idx++]->Hit2DPtr()); }
602 size_t idx = trk.
size() - 1;
603 while ((idx > 0) && !(trk[idx]->IsEnabled())) {
604 hits.push_back(trk[idx--]->Hit2DPtr());
608 if (idx < trk.
size() - 1) {
609 if ((idx > 0) && (trk[idx]->View2D() == trk[idx + 1]->View2D())) {
612 if (dprev < dnext) { hits.push_back(trk[idx--]->Hit2DPtr()); }
624 for (
size_t t = 0;
t < tracks.
size();
t++) {
626 if (trk.
size() < 6)
continue;
630 std::vector<art::Ptr<recob::Hit>> hits;
658 double l2 = trk2->
Length();
665 double d = lmax * distThr;
666 if (d < distThrMin) d = distThrMin;
709 default:
mf::LogError(
"PMAlgTracker") <<
"Should never happen.";
714 reverseOrder =
false;
716 size_t nodeEndIdx = trk1->
Nodes().size() - 1;
719 TVector3 trk2front0 = trk2->
Nodes()[0]->Point3D();
720 TVector3 trk2front1 = trk2->
Nodes()[1]->Point3D();
722 double distProj1 = sqrt(
pma::Dist2(endpoint1, proj1));
725 TVector3 trk1back0 = trk1->
Nodes()[nodeEndIdx]->Point3D();
726 TVector3 trk1back1 = trk1->
Nodes()[nodeEndIdx - 1]->Point3D();
728 double distProj2 = sqrt(
pma::Dist2(endpoint2, proj2));
733 cos3d = dir1.Dot(dir2);
735 if ((cos3d > cosThr) && (distProj1 < distProjThr) && (distProj2 < distProjThr))
739 const double maxCosXZ = 0.996195;
742 dir1_xz *= 1.0 / dir1_xz.R();
745 dir2_xz *= 1.0 / dir2_xz.R();
747 if ((fabs(dir1_xz.Z()) > maxCosXZ) && (fabs(dir2_xz.Z()) > maxCosXZ)) {
752 distProj1 = sqrt(
pma::Dist2(endpoint1, proj1));
758 distProj2 = sqrt(
pma::Dist2(endpoint2, proj2));
760 double cosThrXZ = cos(0.5 * acos(cosThr));
761 double distProjThrXZ = 0.5 * distProjThr;
762 double cosXZ = dir1_xz.Dot(dir2_xz);
763 if ((cosXZ > cosThrXZ) && (distProj1 < distProjThrXZ) && (distProj2 < distProjThrXZ))
776 double distThr = 0.25;
777 double distThrMin = 0.5;
780 double cosThr = cos(TMath::Pi() *
fMergeAngle / 180.0);
782 bool foundMerge =
false;
787 double d, dmin,
c, cmax,
l, lbest;
789 while (t < tracks.
size()) {
798 for (u = t + 1; u < tracks.
size(); u++) {
799 trk2 = tracks[u].Track();
800 if (
areCoLinear(trk1, trk2, d, c, r, distThr, distThrMin, distProjThr, cosThr)) {
802 if (((c > cmax) && (d < dmin + 0.5 * lbest)) || ((d < dmin) && (l > 1.5 * lbest))) {
816 <<
"Merge track (" << trk1->
size() <<
") with track (" << trk2->
size() <<
")";
819 tracks[
t].SetTrack(trk2);
823 tracks[ubest].DeleteTrack();
840 for (
auto node :
trk.Track()->Nodes())
841 if (node->IsBranching()) node->SetFrozen(
true);
847 for (
auto node :
trk.Track()->Nodes())
848 node->SetFrozen(
false);
856 double distThr = 0.25;
857 double distThrMin = 2.5;
860 double cosThr = cos(TMath::Pi() *
fStitchAngle / 180.0);
863 double dfront1, dback1, dfront2, dback2;
865 for (
auto& tpc_entry1 : tracks) {
866 unsigned int tpc1 = tpc_entry1.first;
870 while (t < tracks1.
size()) {
872 double l, lbest = 0,
d, dmin = 1.0e12,
c, cmax = 0.0;
874 unsigned int best_tpc = 0;
878 dfront1 = trk1->
Nodes().front()->GetDistToWall();
879 dback1 = trk1->
Nodes().back()->GetDistToWall();
880 if ((dfront1 < wallDistThr) || (dback1 < wallDistThr)) {
881 for (
auto& tpc_entry2 : tracks) {
882 unsigned int tpc2 = tpc_entry2.first;
883 if (tpc2 == tpc1)
continue;
887 for (
size_t u = 0; u < tracks2.
size(); u++) {
889 dfront2 = trk2->
Nodes().front()->GetDistToWall();
890 dback2 = trk2->
Nodes().back()->GetDistToWall();
891 if ((dfront2 < wallDistThr) || (dback2 < wallDistThr)) {
892 if (
areCoLinear(trk1, trk2,
d,
c, r, distThr, distThrMin, distProjThr, cosThr)) {
894 if (((
c > cmax) && (
d < dmin + 0.5 * lbest)) || (0.75 * l < dmin)) {
911 <<
"Merge track (" << tpc1 <<
":" << tracks1.
size() <<
":" << trk1->
size()
912 <<
") with track (" << best_tpc <<
":" << tracks[best_tpc].size() <<
":" 913 << best_trk2->
size() <<
")";
914 auto const* geom = lar::providerFrom<geo::Geometry>();
916 geom->TPC(trk1->
Nodes().front()->TPC(), trk1->
Nodes().front()->Cryo());
918 geom->TPC(best_trk2->
Nodes().front()->TPC(), best_trk2->
Nodes().front()->Cryo());
926 tracks1[
t].SetTrack(best_trk2);
935 tracks[best_tpc][best_idx].DeleteTrack();
937 tracks[best_tpc].erase_at(best_idx);
954 for (
auto const&
t : tracks.
tracks()) {
956 if (n > max_hits) { max_hits =
n; }
976 mf::LogVerbatim(
"PMAlgTracker") <<
"Reconstruct tracks within Cryo:" << tpc_iter->Cryostat
977 <<
" / TPC:" << tpc_iter->TPC <<
".";
984 for (
size_t p = 0;
p < nplanes; ++
p) {
986 clockData, detProp,
fWires,
p, tpc_iter->TPC, tpc_iter->Cryostat);
1004 mf::LogVerbatim(
"PMAlgTracker") <<
"Found tracks: " << tracks[tpc_iter->TPC].size();
1005 if (tracks[tpc_iter->TPC].empty()) {
continue; }
1015 <<
"Merge co-linear tracks within TPC " << tpc_iter->TPC <<
".";
1016 while (
mergeCoLinear(clockData, detProp, tracks[tpc_iter->TPC])) {
1023 mf::LogVerbatim(
"PMAlgTracker") <<
"Stitch co-linear tracks between TPCs.";
1027 for (
auto& tpc_entry : tracks)
1028 for (
auto&
trk : tpc_entry.second.tracks()) {
1029 if (
trk.Track()->HasTwoViews() && (
trk.Track()->Nodes().size() > 1)) {
1043 mf::LogVerbatim(
"PMAlgTracker") <<
"Vertex finding / track-vertex reoptimization.";
1050 mf::LogVerbatim(
"PMAlgTracker") <<
"Find co-linear CPA-crossing tracks with any T0.";
1055 mf::LogVerbatim(
"PMAlgTracker") <<
"Find co-linear APA-crossing tracks with any T0.";
1060 mf::LogVerbatim(
"PMAlgTracker") <<
"Second pass cosmic tagging for stitched tracks";
1089 size_t minBuildSize,
1095 size_t minSizeCompl = minBuildSize / 8;
1096 if (minSizeCompl < 2) minSizeCompl = 2;
1098 int max_first_idx = 0;
1099 while (max_first_idx >= 0)
1104 if ((max_first_idx >= 0) && !
fCluHits[max_first_idx].
empty()) {
1108 matchCluster(detProp, max_first_idx, minSizeCompl, tpc, cryo, first_view);
1124 size_t minSizeCompl,
1135 if (first_clu_idx >= 0) {
1140 unsigned int nFirstHits = first_hits.size(), first_plane_idx = first_hits.front()->WireID().Plane;
1142 mf::LogVerbatim(
"PMAlgTracker") <<
"use view *** " << first_view <<
" *** plane idx " 1143 << first_plane_idx <<
" *** size: " << nFirstHits;
1145 float xmax = detProp.
ConvertTicksToX(first_hits.front()->PeakTime(), first_plane_idx, tpc, cryo);
1147 for (
size_t j = 1; j < first_hits.size(); ++j) {
1148 float x = detProp.
ConvertTicksToX(first_hits[j]->PeakTime(), first_plane_idx, tpc, cryo);
1149 if (x > xmax) { xmax =
x; }
1150 if (x < xmin) { xmin =
x; }
1157 bool try_build =
true;
1161 if (first_clu_idx >= 0) candidate.
Clusters().push_back((
size_t)first_clu_idx);
1164 int idx = -1, av_idx = -1;
1165 unsigned int nMaxHits = 0, nHits = 0;
1167 for (
auto av : fAvailableViews) {
1168 if (av == first_view)
continue;
1171 maxCluster(detProp, first_clu_idx, candidates, xmin, xmax, minSizeCompl, av, tpc, cryo);
1174 if ((nHits > nMaxHits) && (nHits >= minSizeCompl)) {
1183 for (
auto av : fAvailableViews) {
1184 if ((av != first_view) && (av != bestView)) {
1191 mf::LogVerbatim(
"PMAlgTracker") <<
"--> " << imatch++ <<
" match with:";
1193 <<
" cluster in view *** " << bestView <<
" *** size: " <<
nMaxHits;
1200 mf::LogVerbatim(
"PMAlgTracker") <<
" validation plane *** " << testView <<
" ***";
1203 double m0 = 0.0, v0 = 0.0;
1204 double mseThr = 0.15, validThr = 0.7;
1206 candidate.
Clusters().push_back(idx);
1219 if (candidate.
Track() && (m0 < mseThr) && (v0 > validThr))
1221 mf::LogVerbatim(
"PMAlgTracker") <<
" good track candidate, MSE = " << m0 <<
", v = " << v0;
1228 double fraction = 0.5;
1239 candidate.
Clusters().push_back(idx);
1246 mf::LogVerbatim(
"PMAlgTracker") <<
"merge clusters from the validation plane";
1250 bool extended =
false;
1251 while ((idx >= 0) &&
1260 candidate.
Clusters().push_back(idx);
1272 mf::LogVerbatim(
"PMAlgTracker") <<
"track REJECTED, MSE = " << m0 <<
"; v = " << v0;
1283 if (!candidates.
empty())
1286 double f, max_f = 0., min_mse = 10., max_v = 0.;
1287 for (
size_t t = 0;
t < candidates.
size();
t++)
1288 if (candidates[
t].IsGood() && (candidates[
t].Track()->Nodes().
size() > 1) &&
1289 candidates[
t].
Track()->HasTwoViews()) {
1292 if ((f > max_f) || ((f == max_f) && ((candidates[
t].
Validation() > max_v) ||
1293 (candidates[
t].Mse() < min_mse)))) {
1295 min_mse = candidates[
t].Mse();
1296 max_v = candidates[
t].Validation();
1302 candidates[best_trk].Track()->ShiftEndsToHits();
1304 for (
auto c : candidates[best_trk].Clusters())
1307 result = candidates[best_trk];
1310 for (
size_t t = 0;
t < candidates.
size();
t++) {
1311 if (
int(
t) != best_trk) candidates[
t].DeleteTrack();
1323 unsigned int testView,
1326 double m_max = 2.0 * candidate.
Mse();
1327 if (m_max < 0.05) m_max = 0.05;
1329 double v_min1 = 0.98 * candidate.
Validation();
1330 double v_min2 = 0.9 * candidate.
Validation();
1334 double m1 = copy->
GetMse();
1335 double v1 =
validate(detProp, *copy, testView);
1337 if (((m1 < candidate.
Mse()) && (v1 >= v_min2)) ||
1338 ((m1 < 0.5) && (m1 <= m_max) && (v1 >= v_min1))) {
1339 mf::LogVerbatim(
"PMAlgTracker") <<
" track EXTENDED, MSE = " << m1 <<
", v = " << v1;
1349 mf::LogVerbatim(
"PMAlgTracker") <<
" track NOT extended, MSE = " << m1 <<
", v = " << v1;
1361 unsigned int preferedView,
1362 unsigned int testView,
1364 unsigned int cryo)
const 1366 double f, fmax = 0.0;
1367 unsigned int n,
max = 0;
1369 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1372 unsigned int view =
fCluHits[i].front()->View();
1373 unsigned int nhits =
fCluHits[i].size();
1377 (view == testView) ||
1379 (view != preferedView)) ||
1384 f = n / (double)nhits;
1385 if ((f > fraction) && (n >
max)) {
1393 mf::LogVerbatim(
"PMAlgTracker") <<
"max matching hits: " << max <<
" (" << fmax <<
")";
1407 size_t min_clu_size,
1410 unsigned int cryo)
const 1413 size_t s_max = 0,
s;
1414 double fraction = 0.0;
1417 size_t first_idx = 0;
1418 bool has_first =
false;
1419 if (first_idx_tag >= 0) {
1420 first_idx = (size_t)first_idx_tag;
1424 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1429 bool pair_checked =
false;
1430 for (
auto const&
c : candidates.
tracks())
1431 if (has_first &&
has(
c.Clusters(), first_idx) &&
has(
c.Clusters(), i)) {
1432 pair_checked =
true;
1435 if (pair_checked)
continue;
1439 if ((v.front()->WireID().TPC == tpc) && (v.front()->WireID().Cryostat == cryo)) {
1441 for (
size_t j = 0; j < v.size(); ++j) {
1443 if ((x >= xmin) && (x <= xmax))
s++;
1449 fraction =
s / (double)v.
size();
1453 if (fraction > 0.4)
return idx;
1463 unsigned int cryo)
const 1468 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1476 if ((v.front()->WireID().TPC == tpc) && (v.front()->WireID().Cryostat == cryo)) {
1477 size_t s = v.
size();
1478 if ((s >= min_clu_size) && (s > s_max)) {
1493 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1496 <<
" tpc: " <<
fCluHits[i].front()->WireID().TPC
1497 <<
";\tview: " <<
fCluHits[i].front()->View() <<
";\tsize: " <<
fCluHits[i].size()
1502 mf::LogVerbatim(
"PMAlgTracker") <<
"--------- not matched clusters: ---------";
1503 size_t nsingles = 0;
1504 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1509 <<
" tpc: " <<
fCluHits[i].front()->WireID().TPC
1510 <<
";\tview: " <<
fCluHits[i].front()->View() <<
";\tsize: " <<
fCluHits[i].size()
1517 mf::LogVerbatim(
"PMAlgTracker") <<
"-----------------------------------------";
bool SelectHits(float fraction=1.0F)
pma::Track3D * buildTrack(const detinfo::DetectorPropertiesData &detProp, const std::vector< art::Ptr< recob::Hit >> &hits_1, const std::vector< art::Ptr< recob::Hit >> &hits_2={}) const
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
bool HasPlane(unsigned int iplane) const
Returns whether a plane with index iplane is present in this TPC.
pma::TrkCandidate matchCluster(detinfo::DetectorPropertiesData const &detProp, int first_clu_idx, const std::vector< art::Ptr< recob::Hit >> &first_hits, size_t minSizeCompl, unsigned int tpc, unsigned int cryo, geo::View_t first_view)
std::map< int, pma::Vector3D > fPfpVtx
void guideEndpoints(detinfo::DetectorPropertiesData const &detProp, pma::TrkCandidateColl &tracks)
bool areCoLinear(pma::Track3D *trk1, pma::Track3D *trk2, double &dist, double &cos3d, bool &reverseOrder, double distThr, double distThrMin, double distProjThr, double cosThr) const
double GetMse(unsigned int view=geo::kUnknown) const
MSE of hits weighted with hit amplidudes and wire plane coefficients.
size_t run(const detinfo::DetectorPropertiesData &detProp, pma::TrkCandidateColl &trk_input)
TPC_id_iterator begin_TPC_id() const
Returns an iterator pointing to the first TPC ID in the detector.
static constexpr double g
static constexpr Mask_t makeMask(Flags...flags)
Returns a bit mask with only the specified bit set.
void SetKey(int key)
Set key of an external object associated to this track candidate.
recob::Track convertFrom(const pma::Track3D &src, unsigned int tidx, int pdg=0)
geo::GeometryCore const * fGeom
size_t matchTrack(detinfo::DetectorPropertiesData const &detProp, const pma::TrkCandidateColl &tracks, const std::vector< art::Ptr< recob::Hit >> &hits) const
double Dist2(const TVector2 &v1, const TVector2 &v2)
void buildTracks(detinfo::DetectorPropertiesData const &detProp)
pma::Track3D * extendTrack(const detinfo::DetectorPropertiesData &clockData, const pma::Track3D &trk, const std::vector< art::Ptr< recob::Hit >> &hits, bool add_nodes) const
Add more hits to an existing track, reoptimize, optionally add more nodes.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
ROOT::Math::SMatrix< Double32_t, 5, 5, ROOT::Math::MatRepSym< Double32_t, 5 > > SMatrixSym55
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void ApplyDriftShiftInTree(const detinfo::DetectorClocksData &clockData, detinfo::DetectorPropertiesData const &detProp, double dx, bool skipFirst=false)
size_t fMinSeedSize2ndPass
double validate(detinfo::DetectorPropertiesData const &detProp, pma::Track3D &trk, unsigned int testView)
pma::Hit3D const * front() const
bool reassignHits_1(detinfo::DetectorPropertiesData const &detProp, const std::vector< art::Ptr< recob::Hit >> &hits, pma::TrkCandidateColl &tracks, size_t trk_idx, double dist2)
void erase_at(size_t pos)
std::set< geo::View_t > const & Views() const
Returns a list of possible views in the detector.
Implementation of the Projection Matching Algorithm.
::fhicl::TupleAs< Point(::geo::Length_t,::geo::Length_t,::geo::Length_t)> Point3D
Atom object for reading a 3D point or vector (centimeters).
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >> Point_t
Geometry information for a single TPC.
bool fMatchT0inAPACrossing
double fMinTwoViewFraction
bool reassignSingleViewEnds_1(detinfo::DetectorPropertiesData const &detProp, pma::TrkCandidateColl &tracks)
std::map< size_t, pma::TrkCandidateColl > tpc_track_map
fhicl::Atom< std::string > Validation
bool fMatchT0inCPACrossing
TVector3 const & Point3D() const
std::vector< size_t > fInitialClusters
PMAlgTracker(const std::vector< art::Ptr< recob::Hit >> &allhitlist, const std::vector< recob::Wire > &wires, const pma::ProjectionMatchingAlg::Config &pmalgConfig, const pma::PMAlgTracker::Config &pmalgTrackerConfig, const pma::PMAlgVertexing::Config &pmvtxConfig, const pma::PMAlgStitching::Config &pmstitchConfig, const pma::PMAlgCosmicTagger::Config &pmtaggerConfig, const std::vector< TH1F * > &hpassing, const std::vector< TH1F * > &hrejected)
pma::PMAlgCosmicTagger fCosmicTagger
void SetValidation(double v)
void SetTrack(pma::Track3D *trk)
std::map< int, std::vector< art::Ptr< recob::Cluster > > > fPfpClusters
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
double Validation() const
double fStitchTransverseShift
std::map< unsigned int, std::vector< size_t > > fTriedClusters
int maxCluster(detinfo::DetectorPropertiesData const &detProp, int first_idx_tag, const pma::TrkCandidateColl &candidates, float xmin, float xmax, size_t min_clu_size, geo::View_t view, unsigned int tpc, unsigned int cryo) const
recob::tracking::Vector_t Vector3D
pma::Vector3D GetDirection3D(size_t index) const
Get trajectory direction at given hit index.
void flipTreesToCoordinate(detinfo::DetectorPropertiesData const &detProp, size_t coordinate)
bool mergeCoLinear(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, pma::TrkCandidateColl &tracks) const
std::vector< double > fAdcValidationThr
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
std::vector< int > fTrackingOnlyPdg
int build(detinfo::DetectorPropertiesData const &detProp)
pma::PMAlgStitching fStitcher
double GetDistToWall() const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< Coord_t >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space. See recob::tracking::Coord_t for more details on the ...
fhicl::Sequence< double > AdcValidationThr
double collectSingleViewEnd(pma::Track3D &trk, std::vector< art::Ptr< recob::Hit >> &hits) const
unsigned int MaxPlanes() const
Returns the largest number of planes among all TPCs in this detector.
pma::Node3D * FirstElement() const
unsigned int testHits(detinfo::DetectorPropertiesData const &detProp, const pma::Track3D &trk, const std::vector< art::Ptr< recob::Hit >> &hits, double eps=1.0) const
Count the number of hits that are closer than eps * fHitTestingDist2D to the track 2D projection...
std::map< int, int > fPfpPdgCodes
pma::Node3D * LastElement() const
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
bool isContained(const pma::Track3D &trk, float margin=0.0F) const
TVector2 GetProjectionToSegment(const TVector2 &p, const TVector2 &p0, const TVector2 &p1)
A trajectory in space reconstructed from hits.
float fTrackLikeThreshold
void setParentDaughterConnections()
std::vector< int > fTrackingSkipPdg
std::vector< pma::Segment3D * > const & Segments() const noexcept
double validate_on_adc_test(const detinfo::DetectorPropertiesData &detProp, const lariov::ChannelStatusProvider &channelStatus, const pma::Track3D &trk, const img::DataProviderAlg &adcImage, const std::vector< art::Ptr< recob::Hit >> &hits, TH1F *histoPassing, TH1F *histoRejected) const
const std::vector< recob::Wire > & fWires
bool has(const std::vector< size_t > &v, size_t idx) const
pma::ProjectionMatchingAlg fProjectionMatchingAlg
double fMergeTransverseShift
PMAlgTrackingBase(const std::vector< art::Ptr< recob::Hit >> &allhitlist, const pma::ProjectionMatchingAlg::Config &pmalgConfig, const pma::PMAlgVertexing::Config &pmvtxConfig)
void RemoveHits(const std::vector< art::Ptr< recob::Hit >> &hits)
Remove hits; removes also hit->node/seg assignments.
void fromMaxCluster_tpc(detinfo::DetectorPropertiesData const &detProp, pma::TrkCandidateColl &result, size_t minBuildSize, unsigned int tpc, unsigned int cryo)
unsigned int FrontTPC() const
unsigned int FrontCryo() const
static int max(int a, int b)
unsigned int DisableSingleViewEnds()
std::vector< size_t > fUsedClusters
const pma::TrkCandidateColl & result()
PMAlgFitter(const std::vector< art::Ptr< recob::Hit >> &allhitlist, const std::vector< recob::Cluster > &clusters, const std::vector< recob::PFParticle > &pfparticles, const art::FindManyP< recob::Hit > &hitsFromClusters, const art::FindManyP< recob::Cluster > &clusFromPfps, const art::FindManyP< recob::Vertex > &vtxFromPfps, const pma::ProjectionMatchingAlg::Config &pmalgConfig, const pma::PMAlgFitter::Config &pmalgFitterConfig, const pma::PMAlgVertexing::Config &pmvtxConfig)
TPC_id_iterator end_TPC_id() const
Returns an iterator pointing after the last TPC ID in the detector.
void tag(detinfo::DetectorClocksData const &clockData, pma::TrkCandidateColl &tracks)
bool has(const std::vector< int > &v, int i) const
std::vector< std::vector< art::Ptr< recob::Hit > > > fCluHits
std::vector< std::vector< art::Ptr< recob::Hit > > > fCluHits
double ConvertTicksToX(double ticks, int p, int t, int c) const
std::vector< float > fCluWeights
fhicl::Table< img::DataProviderAlg::Config > AdcImageAlg
bool HasTwoViews(size_t nmin=1) const
recob::tracking::SMatrixSym55 SMatrixSym55
void CleanupTails()
Cut out tails with no hits assigned.
Implementation of the Projection Matching Algorithm.
double Length(size_t step=1) const
double validate(const detinfo::DetectorPropertiesData &detProp, const lariov::ChannelStatusProvider &channelStatus, const pma::Track3D &trk, const std::vector< art::Ptr< recob::Hit >> &hits) const
void freezeBranchingNodes(pma::TrkCandidateColl &tracks) const
Contains all timing reference information for the detector.
const std::vector< TH1F * > & fAdcInPassingPoints
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
void init(const art::FindManyP< recob::Hit > &hitsFromClusters)
pma::Track3D * buildShowerSeg(const detinfo::DetectorPropertiesData &detProp, const std::vector< art::Ptr< recob::Hit >> &hits, const pma::Vector3D &vtx) const
short int DetectDriftDirection() const
Returns the expected drift direction based on geometry.
void mergeTracks(const detinfo::DetectorPropertiesData &detProp, pma::Track3D &dst, pma::Track3D &src, bool reopt) const
static unsigned int reverse(QString &chars, unsigned char *level, unsigned int a, unsigned int b)
double collectSingleViewFront(pma::Track3D &trk, std::vector< art::Ptr< recob::Hit >> &hits) const
void StitchTracksAPA(const detinfo::DetectorClocksData &clockData, const detinfo::DetectorPropertiesData &detProp, pma::TrkCandidateColl &tracks)
const std::vector< size_t > & Clusters() const
const std::vector< TH1F * > & fAdcInRejectedPoints
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void guideEndpoints(const detinfo::DetectorPropertiesData &clockData, pma::Track3D &trk, const std::map< unsigned int, std::vector< art::Ptr< recob::Hit >>> &hits) const
pma::Hit3D const * back() const
double validate_on_adc(const detinfo::DetectorPropertiesData &detProp, const lariov::ChannelStatusProvider &channelStatus, const pma::Track3D &trk, const img::DataProviderAlg &adcImage, float thr) const
void listUsedClusters(detinfo::DetectorPropertiesData const &detProp) const
int build(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp)
std::vector< geo::View_t > fAvailableViews
void releaseAllNodes(pma::TrkCandidateColl &tracks) const
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
std::vector< pma::Node3D * > const & Nodes() const noexcept
size_t fMinSeedSize1stPass
pma::TrkCandidateColl fResult
bool extendTrack(detinfo::DetectorPropertiesData const &detProp, pma::TrkCandidate &candidate, const std::vector< art::Ptr< recob::Hit >> &hits, unsigned int testView, bool add_nodes)
bool Flip(const detinfo::DetectorPropertiesData &detProp, std::vector< pma::Track3D * > &allTracks)
Interface for experiment-specific service for channel quality info.
void StitchTracksCPA(const detinfo::DetectorClocksData &clockData, const detinfo::DetectorPropertiesData &detProp, pma::TrkCandidateColl &tracks)
EValidationMode fValidation
recob::tracking::Plane Plane
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< Coord_t >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space. See recob::tracking::Coord_t for more detai...
pma::Track3D * Track() const
LArSoft geometry interface.
double twoViewFraction(pma::Track3D &trk) const
recob::tracking::Vector_t Vector_t
void push_back(const TrkCandidate &trk)
pma::PMAlgVertexing fPMAlgVertexing
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
std::vector< TrkCandidate > const & tracks() const
cet::coded_exception< error, detail::translate > exception
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
pma::Track3D * buildMultiTPCTrack(const detinfo::DetectorPropertiesData &clockData, const std::vector< art::Ptr< recob::Hit >> &hits) const
pma::cryo_tpc_view_hitmap fHitMap
QTextStream & endl(QTextStream &s)
std::vector< img::DataProviderAlg > fAdcImages
void buildShowers(detinfo::DetectorPropertiesData const &detProp)