14 #include "larevt/CalibrationDBI/Interface/ChannelStatusService.h" 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);
83 for (
auto const& t : tracks.
tracks()) {
84 auto&
trk = *(t.Track());
86 unsigned int tpc =
trk.FrontTPC(), cryo =
trk.FrontCryo();
87 if ((tpc ==
trk.BackTPC()) && (cryo ==
trk.BackCryo())) {
101 const std::vector<recob::Cluster>& clusters,
102 const std::vector<recob::PFParticle>& pfparticles,
110 , fTrackingOnlyPdg(pmalgFitterConfig.TrackingOnlyPdg())
111 , fTrackingSkipPdg(pmalgFitterConfig.TrackingSkipPdg())
112 , fRunVertexing(pmalgFitterConfig.RunVertexing())
114 mf::LogVerbatim(
"PMAlgFitter") <<
"Found " << allhitlist.size() <<
"hits in the event.";
115 mf::LogVerbatim(
"PMAlgFitter") <<
"Sort hits by clusters assigned to PFParticles...";
118 for (
size_t i = 0; i < pfparticles.size(); ++i) {
121 auto cv = clusFromPfps.at(i);
122 for (
const auto& c : cv) {
125 auto hv = hitsFromClusters.at(c.key());
126 fCluHits[c.key()].reserve(hv.size());
127 for (
auto const& h : hv)
132 if (vtxFromPfps.isValid() && vtxFromPfps.at(i).size()) {
134 vtxFromPfps.at(i).front()->XYZ(xyz);
140 <<
fPfpClusters.size() <<
" pfparticles for 3D tracking.";
172 bool selectPdg =
true;
176 int pfPartIdx = pfpCluEntry.first;
183 mf::LogVerbatim(
"PMAlgFitter") <<
"Process clusters from PFP:" << pfPartIdx <<
", pdg:" << pdg;
185 std::vector<art::Ptr<recob::Hit>> allHits;
188 std::unordered_map<geo::View_t, size_t> clu_count;
189 for (
const auto& c : pfpCluEntry.second) {
190 if (c->NHits() == 0) {
continue; }
192 candidate.
Clusters().push_back(c.key());
193 clu_count[c->View()]++;
195 allHits.reserve(allHits.size() +
fCluHits.at(c.key()).
size());
196 for (
const auto& h :
fCluHits.at(c.key())) {
197 allHits.push_back(h);
200 if (clu_count.size() > 1)
202 candidate.
SetKey(pfpCluEntry.first);
210 mf::LogError(
"PMAlgFitter") <<
"Trajectory fit lenght is nan.";
227 bool selectPdg =
true;
231 int pfPartIdx = pfpCluEntry.first;
234 if (pdg != 11)
continue;
238 mf::LogVerbatim(
"PMAlgFitter") <<
"Process clusters from PFP:" << pfPartIdx <<
", pdg:" << pdg;
240 std::vector<art::Ptr<recob::Hit>> allHits;
243 std::unordered_map<geo::View_t, size_t> clu_count;
244 for (
const auto& c : pfpCluEntry.second) {
245 if (c->NHits() == 0) {
continue; }
247 candidate.
Clusters().push_back(c.key());
248 clu_count[c->View()]++;
250 allHits.reserve(allHits.size() +
fCluHits.at(c.key()).
size());
251 for (
const auto& h :
fCluHits.at(c.key()))
252 allHits.push_back(h);
254 if (clu_count.size() > 1)
256 candidate.
SetKey(pfpCluEntry.first);
261 auto search =
fPfpVtx.find(pfPartIdx);
279 const std::vector<recob::Wire>& wires,
286 const std::vector<TH1F*>& hpassing,
287 const std::vector<TH1F*>& hrejected)
290 , fMinSeedSize1stPass(pmalgTrackerConfig.MinSeedSize1stPass())
291 , fMinSeedSize2ndPass(pmalgTrackerConfig.MinSeedSize2ndPass())
292 , fTrackLikeThreshold(pmalgTrackerConfig.TrackLikeThreshold())
293 , fMinTwoViewFraction(pmalgConfig.MinTwoViewFraction())
294 , fFlipToBeam(pmalgTrackerConfig.FlipToBeam())
295 , fFlipDownward(pmalgTrackerConfig.FlipDownward())
296 , fFlipToX(pmalgTrackerConfig.FlipToX())
297 , fAutoFlip_dQdx(pmalgTrackerConfig.AutoFlip_dQdx())
298 , fMergeWithinTPC(pmalgTrackerConfig.MergeWithinTPC())
299 , fMergeTransverseShift(pmalgTrackerConfig.MergeTransverseShift())
300 , fMergeAngle(pmalgTrackerConfig.MergeAngle())
301 , fCosmicTagger(pmtaggerConfig)
302 , fTagCosmicTracks(fCosmicTagger.tagAny())
303 , fStitchBetweenTPCs(pmalgTrackerConfig.StitchBetweenTPCs())
304 , fStitchDistToWall(pmalgTrackerConfig.StitchDistToWall())
305 , fStitchTransverseShift(pmalgTrackerConfig.StitchTransverseShift())
306 , fStitchAngle(pmalgTrackerConfig.StitchAngle())
307 , fMatchT0inAPACrossing(pmalgTrackerConfig.MatchT0inAPACrossing())
308 , fMatchT0inCPACrossing(pmalgTrackerConfig.MatchT0inCPACrossing())
309 , fStitcher(pmstitchConfig)
311 , fAdcInPassingPoints(hpassing)
312 , fAdcInRejectedPoints(hrejected)
313 , fGeom(
art::ServiceHandle<
geo::Geometry const>().
get())
321 mf::LogVerbatim(
"PMAlgTracker") <<
"Using views in the following order:";
328 << pmalgTrackerConfig.Validation();
331 for (
size_t p = 0; p < nplanes; ++p) {
332 fAdcImages.emplace_back(pmalgTrackerConfig.AdcImageAlg());
336 else if (pmalgTrackerConfig.Validation() ==
"adc") {
339 else if (pmalgTrackerConfig.Validation() ==
"calib") {
343 throw cet::exception(
"pma::PMAlgTracker") <<
"validation name not supported" << std::endl;
348 <<
"Not enough planes to perform validation, switch mode to hits.";
354 mf::LogVerbatim(
"PMAlgTracker") <<
"Validation ADC thresholds per plane:";
366 fCluHits.reserve(hitsFromClusters.size());
369 for (
size_t i = 0; i < hitsFromClusters.size(); ++i) {
370 auto v = hitsFromClusters.at(i);
372 for (
auto const& h : v)
381 const std::vector<float>& trackLike)
383 mf::LogVerbatim(
"PMAlgTracker") <<
"Filter track-like clusters using likelihood values...";
385 fCluHits.reserve(hitsFromClusters.size());
388 for (
size_t i = 0; i < hitsFromClusters.size(); ++i) {
389 auto v = hitsFromClusters.at(i);
391 for (
auto const& h : v)
403 fCluHits.reserve(hitsFromClusters.size());
407 for (
size_t i = 0; i < hitsFromClusters.size(); ++i) {
408 auto v = hitsFromClusters.at(i);
410 for (
auto const& h : v) {
412 for (
size_t j = 0; j < hitsFromEmParts.size(); ++j) {
413 auto u = hitsFromEmParts.at(j);
414 for (
auto const& g : u)
416 if (g.key() == h.key()) {
423 if (trkLike)
fCluHits.back().push_back(h);
433 mf::LogVerbatim(
"PMAlgTracker") <<
"...done, " << n <<
" clusters for 3D tracking.";
439 unsigned int testView)
442 mf::LogVerbatim(
"PMAlgTracker") <<
"first or last node too far out of its initial TPC";
447 mf::LogVerbatim(
"PMAlgTracker") <<
"validation in plane: " << testView;
480 throw cet::exception(
"pma::PMAlgTracker") <<
"validation mode not supported" << std::endl;
496 if ((
hits.size() > 1) || (dist2 > 1.0))
500 size_t best_u = 0, n_max = 0;
501 for (
size_t u = 0; u < tracks.
size(); u++)
512 if (best_trk && (n_max >=
hits.size() / 3))
514 mf::LogVerbatim(
"PMAlgTrackMaker") <<
" Reassign(v1) " << n_max <<
" hits." << std::endl;
524 tracks[best_u].SetTrack(ext);
531 size_t minSizeCompl =
hits.size() / 8;
532 if (minSizeCompl < 3) minSizeCompl = 3;
535 unsigned int tpc =
hits.front()->WireID().TPC;
536 unsigned int cryo =
hits.front()->WireID().Cryostat;
543 <<
" Add new track, cut hits from source track." << std::endl;
552 else if ((
hits.size() == 1) || (dist2 > 2.25))
554 mf::LogVerbatim(
"PMAlgTrackMaker") <<
" Cut single-view isolated hit." << std::endl;
567 while ((idx < trk.
size() - 1) && !(trk[idx]->IsEnabled())) {
568 hits.push_back(trk[idx++]->Hit2DPtr());
573 if ((idx < trk.
size() - 1) && (trk[idx]->View2D() == trk[idx - 1]->View2D())) {
576 if (dprev < dnext) {
hits.push_back(trk[idx++]->Hit2DPtr()); }
587 size_t idx = trk.
size() - 1;
588 while ((idx > 0) && !(trk[idx]->IsEnabled())) {
589 hits.push_back(trk[idx--]->Hit2DPtr());
593 if (idx < trk.
size() - 1) {
594 if ((idx > 0) && (trk[idx]->View2D() == trk[idx + 1]->View2D())) {
597 if (dprev < dnext) {
hits.push_back(trk[idx--]->Hit2DPtr()); }
609 for (
size_t t = 0; t < tracks.
size(); t++) {
611 if (trk.
size() < 6)
continue;
615 std::vector<art::Ptr<recob::Hit>>
hits;
642 double l1 = trk1->
Length();
643 double l2 = trk2->
Length();
650 double d = lmax * distThr;
651 if (d < distThrMin) d = distThrMin;
682 case 0: trk1->
Flip();
break;
689 case 3: trk2->
Flip();
break;
690 default:
mf::LogError(
"PMAlgTracker") <<
"Should never happen.";
695 reverseOrder =
false;
697 size_t nodeEndIdx = trk1->
Nodes().size() - 1;
700 TVector3 trk2front0 = trk2->
Nodes()[0]->Point3D();
701 TVector3 trk2front1 = trk2->
Nodes()[1]->Point3D();
703 double distProj1 = sqrt(
pma::Dist2(endpoint1, proj1));
706 TVector3 trk1back0 = trk1->
Nodes()[nodeEndIdx]->Point3D();
707 TVector3 trk1back1 = trk1->
Nodes()[nodeEndIdx - 1]->Point3D();
709 double distProj2 = sqrt(
pma::Dist2(endpoint2, proj2));
714 cos3d = dir1.Dot(dir2);
716 if ((cos3d > cosThr) && (distProj1 < distProjThr) && (distProj2 < distProjThr))
720 const double maxCosXZ = 0.996195;
723 dir1_xz *= 1.0 / dir1_xz.R();
726 dir2_xz *= 1.0 / dir2_xz.R();
728 if ((fabs(dir1_xz.Z()) > maxCosXZ) && (fabs(dir2_xz.Z()) > maxCosXZ)) {
733 distProj1 = sqrt(
pma::Dist2(endpoint1, proj1));
739 distProj2 = sqrt(
pma::Dist2(endpoint2, proj2));
741 double cosThrXZ = cos(0.5 * acos(cosThr));
742 double distProjThrXZ = 0.5 * distProjThr;
743 double cosXZ = dir1_xz.Dot(dir2_xz);
744 if ((cosXZ > cosThrXZ) && (distProj1 < distProjThrXZ) && (distProj2 < distProjThrXZ))
755 double distThr = 0.25;
756 double distThrMin = 0.5;
759 double cosThr = cos(TMath::Pi() *
fMergeAngle / 180.0);
761 bool foundMerge =
false;
766 double d, dmin, c, cmax, l, lbest;
768 while (t < tracks.
size()) {
777 for (u = t + 1; u < tracks.
size(); u++) {
778 trk2 = tracks[u].Track();
779 if (
areCoLinear(trk1, trk2, d, c, r, distThr, distThrMin, distProjThr, cosThr)) {
781 if (((c > cmax) && (d < dmin + 0.5 * lbest)) || ((d < dmin) && (l > 1.5 * lbest))) {
795 <<
"Merge track (" << trk1->
size() <<
") with track (" << trk2->
size() <<
")";
798 tracks[t].SetTrack(trk2);
802 tracks[ubest].DeleteTrack();
818 for (
auto node :
trk.Track()->Nodes())
819 if (node->IsBranching()) node->SetFrozen(
true);
826 for (
auto node :
trk.Track()->Nodes())
827 node->SetFrozen(
false);
835 double distThr = 0.25;
836 double distThrMin = 2.5;
839 double cosThr = cos(TMath::Pi() *
fStitchAngle / 180.0);
842 double dfront1, dback1, dfront2, dback2;
844 for (
auto& tpc_entry1 : tracks) {
845 unsigned int tpc1 = tpc_entry1.first;
849 while (t < tracks1.
size()) {
850 bool r, reverse =
false;
851 double l, lbest = 0,
d, dmin = 1.0e12, c, cmax = 0.0;
853 unsigned int best_tpc = 0;
857 dfront1 = trk1->
Nodes().front()->GetDistToWall();
858 dback1 = trk1->
Nodes().back()->GetDistToWall();
859 if ((dfront1 < wallDistThr) || (dback1 < wallDistThr)) {
860 for (
auto& tpc_entry2 : tracks) {
861 unsigned int tpc2 = tpc_entry2.first;
862 if (tpc2 == tpc1)
continue;
866 for (
size_t u = 0; u < tracks2.
size(); u++) {
868 dfront2 = trk2->
Nodes().front()->GetDistToWall();
869 dback2 = trk2->
Nodes().back()->GetDistToWall();
870 if ((dfront2 < wallDistThr) || (dback2 < wallDistThr)) {
871 if (
areCoLinear(trk1, trk2,
d, c, r, distThr, distThrMin, distProjThr, cosThr)) {
873 if (((c > cmax) && (
d < dmin + 0.5 * lbest)) || (0.75 * l < dmin)) {
890 <<
"Merge track (" << tpc1 <<
":" << tracks1.
size() <<
":" << trk1->
size()
891 <<
") with track (" << best_tpc <<
":" << tracks[best_tpc].size() <<
":" 892 << best_trk2->
size() <<
")";
893 auto const* first_node_trk1 = trk1->
Nodes().front();
894 auto const* first_node_trk2 = best_trk2->
Nodes().front();
895 geo::TPCID const tpc1ID(first_node_trk1->Cryo(), first_node_trk1->TPC());
896 geo::TPCID const tpc2ID(first_node_trk2->Cryo(), first_node_trk2->TPC());
904 tracks1[t].SetTrack(best_trk2);
911 tracks[best_tpc][best_idx].DeleteTrack();
913 tracks[best_tpc].erase_at(best_idx);
927 for (
auto const& t : tracks.
tracks()) {
929 if (n > max_hits) { max_hits =
n; }
948 <<
"Reconstruct tracks within Cryo:" << tpcid.Cryostat <<
" / TPC:" << tpcid.TPC <<
".";
955 for (
size_t p = 0; p < nplanes; ++p) {
957 fAdcImages[p].setWireDriftData(clockData, detProp,
fWires, p, tpcid.TPC, tpcid.Cryostat);
973 mf::LogVerbatim(
"PMAlgTracker") <<
"Found tracks: " << tracks[tpcid.TPC].size();
974 if (tracks[tpcid.TPC].empty()) {
continue; }
982 mf::LogVerbatim(
"PMAlgTracker") <<
"Merge co-linear tracks within TPC " << tpcid.TPC <<
".";
990 mf::LogVerbatim(
"PMAlgTracker") <<
"Stitch co-linear tracks between TPCs.";
994 for (
auto& tpc_entry : tracks)
995 for (
auto&
trk : tpc_entry.second.tracks()) {
996 if (
trk.Track()->HasTwoViews() && (
trk.Track()->Nodes().size() > 1)) {
1010 mf::LogVerbatim(
"PMAlgTracker") <<
"Vertex finding / track-vertex reoptimization.";
1017 mf::LogVerbatim(
"PMAlgTracker") <<
"Find co-linear CPA-crossing tracks with any T0.";
1022 mf::LogVerbatim(
"PMAlgTracker") <<
"Find co-linear APA-crossing tracks with any T0.";
1027 mf::LogVerbatim(
"PMAlgTracker") <<
"Second pass cosmic tagging for stitched tracks";
1054 size_t minBuildSize,
1060 size_t minSizeCompl = minBuildSize / 8;
1061 if (minSizeCompl < 2) minSizeCompl = 2;
1063 int max_first_idx = 0;
1064 while (max_first_idx >= 0)
1069 if ((max_first_idx >= 0) && !
fCluHits[max_first_idx].
empty()) {
1073 matchCluster(detProp, max_first_idx, minSizeCompl, tpc, cryo, first_view);
1089 size_t minSizeCompl,
1100 if (first_clu_idx >= 0) {
1105 unsigned int nFirstHits = first_hits.size(), first_plane_idx = first_hits.front()->WireID().Plane;
1106 mf::LogVerbatim(
"PMAlgTracker") << std::endl <<
"--- start new candidate ---";
1107 mf::LogVerbatim(
"PMAlgTracker") <<
"use view *** " << first_view <<
" *** plane idx " 1108 << first_plane_idx <<
" *** size: " << nFirstHits;
1110 float xmax = detProp.
ConvertTicksToX(first_hits.front()->PeakTime(), first_plane_idx, tpc, cryo);
1112 for (
size_t j = 1; j < first_hits.size(); ++j) {
1113 float x = detProp.
ConvertTicksToX(first_hits[j]->PeakTime(), first_plane_idx, tpc, cryo);
1114 if (x > xmax) { xmax =
x; }
1115 if (x < xmin) { xmin =
x; }
1122 bool try_build =
true;
1126 if (first_clu_idx >= 0) candidate.
Clusters().push_back((
size_t)first_clu_idx);
1129 int idx = -1, av_idx = -1;
1130 unsigned int nMaxHits = 0, nHits = 0;
1132 for (
auto av : fAvailableViews) {
1133 if (av == first_view)
continue;
1136 maxCluster(detProp, first_clu_idx, candidates, xmin, xmax, minSizeCompl, av, tpc, cryo);
1139 if ((nHits > nMaxHits) && (nHits >= minSizeCompl)) {
1148 for (
auto av : fAvailableViews) {
1149 if ((av != first_view) && (av != bestView)) {
1156 mf::LogVerbatim(
"PMAlgTracker") <<
"--> " << imatch++ <<
" match with:";
1158 <<
" cluster in view *** " << bestView <<
" *** size: " << nMaxHits;
1165 mf::LogVerbatim(
"PMAlgTracker") <<
" validation plane *** " << testView <<
" ***";
1168 double m0 = 0.0, v0 = 0.0;
1169 double mseThr = 0.15, validThr = 0.7;
1171 candidate.
Clusters().push_back(idx);
1185 if (candidate.
Track() && (m0 < mseThr) && (v0 > validThr))
1187 mf::LogVerbatim(
"PMAlgTracker") <<
" good track candidate, MSE = " << m0 <<
", v = " << v0;
1194 double fraction = 0.5;
1203 candidate.
Clusters().push_back(idx);
1210 mf::LogVerbatim(
"PMAlgTracker") <<
"merge clusters from the validation plane";
1214 bool extended =
false;
1215 while ((idx >= 0) &&
1223 candidate.
Clusters().push_back(idx);
1234 mf::LogVerbatim(
"PMAlgTracker") <<
"track REJECTED, MSE = " << m0 <<
"; v = " << v0;
1245 if (!candidates.
empty())
1248 double f, max_f = 0., min_mse = 10., max_v = 0.;
1249 for (
size_t t = 0; t < candidates.
size(); t++)
1250 if (candidates[t].IsGood() && (candidates[t].Track()->Nodes().
size() > 1) &&
1251 candidates[t].
Track()->HasTwoViews()) {
1254 if ((f > max_f) || ((f == max_f) && ((candidates[t].Validation() > max_v) ||
1255 (candidates[t].Mse() < min_mse)))) {
1257 min_mse = candidates[t].Mse();
1258 max_v = candidates[t].Validation();
1264 candidates[best_trk].Track()->ShiftEndsToHits();
1266 for (
auto c : candidates[best_trk].Clusters())
1269 result = candidates[best_trk];
1272 for (
size_t t = 0; t < candidates.
size(); t++) {
1273 if (
int(t) != best_trk) candidates[t].DeleteTrack();
1284 unsigned int testView,
1287 double m_max = 2.0 * candidate.
Mse();
1288 if (m_max < 0.05) m_max = 0.05;
1290 double v_min1 = 0.98 * candidate.
Validation();
1291 double v_min2 = 0.9 * candidate.
Validation();
1295 double m1 = copy->
GetMse();
1296 double v1 =
validate(detProp, *copy, testView);
1298 if (((m1 < candidate.
Mse()) && (v1 >= v_min2)) ||
1299 ((m1 < 0.5) && (m1 <= m_max) && (v1 >= v_min1))) {
1300 mf::LogVerbatim(
"PMAlgTracker") <<
" track EXTENDED, MSE = " << m1 <<
", v = " << v1;
1310 mf::LogVerbatim(
"PMAlgTracker") <<
" track NOT extended, MSE = " << m1 <<
", v = " << v1;
1321 unsigned int preferedView,
1322 unsigned int testView)
const 1324 double f, fmax = 0.0;
1325 unsigned int n, max = 0;
1327 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1330 unsigned int view =
fCluHits[i].front()->View();
1331 unsigned int nhits =
fCluHits[i].size();
1335 (view == testView) ||
1337 (view != preferedView)) ||
1342 f = n / (double)nhits;
1343 if ((f > fraction) && (n > max)) {
1351 mf::LogVerbatim(
"PMAlgTracker") <<
"max matching hits: " << max <<
" (" << fmax <<
")";
1364 size_t min_clu_size,
1367 unsigned int cryo)
const 1370 size_t s_max = 0, s;
1371 double fraction = 0.0;
1374 size_t first_idx = 0;
1375 bool has_first =
false;
1376 if (first_idx_tag >= 0) {
1377 first_idx = (size_t)first_idx_tag;
1381 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1386 bool pair_checked =
false;
1387 for (
auto const& c : candidates.
tracks())
1388 if (has_first &&
has(c.Clusters(), first_idx) &&
has(c.Clusters(), i)) {
1389 pair_checked =
true;
1392 if (pair_checked)
continue;
1396 if ((v.front()->WireID().TPC == tpc) && (v.front()->WireID().Cryostat == cryo)) {
1398 for (
size_t j = 0; j < v.size(); ++j) {
1400 if ((x >= xmin) && (x <= xmax)) s++;
1406 fraction = s / (double)v.size();
1410 if (fraction > 0.4)
return idx;
1419 unsigned int cryo)
const 1424 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1432 if ((v.front()->WireID().TPC == tpc) && (v.front()->WireID().Cryostat == cryo)) {
1433 size_t s = v.size();
1434 if ((s >= min_clu_size) && (s > s_max)) {
1446 mf::LogVerbatim(
"PMAlgTracker") << std::endl <<
"----------- matched clusters: -----------";
1447 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1450 <<
" tpc: " <<
fCluHits[i].front()->WireID().TPC
1451 <<
";\tview: " <<
fCluHits[i].front()->View() <<
";\tsize: " <<
fCluHits[i].size()
1456 mf::LogVerbatim(
"PMAlgTracker") <<
"--------- not matched clusters: ---------";
1457 size_t nsingles = 0;
1458 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1463 <<
" tpc: " <<
fCluHits[i].front()->WireID().TPC
1464 <<
";\tview: " <<
fCluHits[i].front()->View() <<
";\tsize: " <<
fCluHits[i].size()
1471 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
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)
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.
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)
Implementation of the Projection Matching Algorithm.
The data type to uniquely identify a Plane.
bool fMatchT0inAPACrossing
double fMinTwoViewFraction
bool reassignSingleViewEnds_1(detinfo::DetectorPropertiesData const &detProp, pma::TrkCandidateColl &tracks)
::fhicl::TupleAs< Point(::geo::Length_t,::geo::Length_t,::geo::Length_t)> Point3D
Atom object for reading a 3D point or vector (centimeters).
std::map< size_t, pma::TrkCandidateColl > tpc_track_map
bool fMatchT0inCPACrossing
TVector3 const & Point3D() const
std::vector< size_t > fInitialClusters
ROOT::Math::SMatrix< Double32_t, 5, 5, ROOT::Math::MatRepSym< Double32_t, 5 >> SMatrixSym55
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
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
DriftAxis DriftAxisWithSign() const
Returns the expected drift direction based on geometry.
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
bool HasPlane(PlaneID const &planeid) const
Returns whether we have the specified plane.
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)
recob::tracking::Point_t Point_t
std::vector< double > fAdcValidationThr
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
std::vector< int > fTrackingOnlyPdg
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
int build(detinfo::DetectorPropertiesData const &detProp)
pma::PMAlgStitching fStitcher
double GetDistToWall() const
unsigned int MaxPlanes() const
Returns the largest number of planes among all TPCs in this detector.
double collectSingleViewEnd(pma::Track3D &trk, std::vector< art::Ptr< recob::Hit >> &hits) const
std::set< View_t > const & Views() const
Returns a list of possible views in the 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...
geo::WireReadoutGeom const * fWireReadoutGeom
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
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 ...
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)
bool mergeCoLinear(detinfo::DetectorPropertiesData const &detProp, pma::TrkCandidateColl &tracks) const
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
The data type to uniquely identify a TPC.
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)
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
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.
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
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
double dist(const TReal *x, const TReal *y, const unsigned int dimension)
void freezeBranchingNodes(pma::TrkCandidateColl &tracks) const
Contains all timing reference information for the detector.
const std::vector< TH1F * > & fAdcInPassingPoints
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
void mergeTracks(const detinfo::DetectorPropertiesData &detProp, pma::Track3D &dst, pma::Track3D &src, bool reopt) const
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
range_type< T > Iterate() const
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.
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)
TPCGeo const & TPC(TPCID const &tpcid=details::tpc_zero) const
Returns the specified TPC.
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
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
std::vector< img::DataProviderAlg > fAdcImages
void buildShowers(detinfo::DetectorPropertiesData const &detProp)