13 #include "larevt/CalibrationDBI/Interface/ChannelStatusService.h" 26 std::vector<Point_t> positions;
27 positions.reserve(src.
size());
28 std::vector<Vector_t> momenta;
29 momenta.reserve(src.
size());
30 std::vector<recob::TrajectoryPointFlags> outFlags;
31 outFlags.reserve(src.
size());
33 for (
size_t i = 0, h = 0; i < src.
size(); i++)
34 if (src[i]->IsEnabled()) {
35 auto const& point3d = src[i]->Point3D();
36 positions.emplace_back(point3d.X(), point3d.Y(), point3d.Z());
59 : fProjectionMatchingAlg(pmalgConfig), fPMAlgVertexing(pmvtxConfig)
61 unsigned int cryo, tpc, view;
62 for (
auto const& h : allhitlist) {
63 cryo = h->WireID().Cryostat;
64 tpc = h->WireID().TPC;
65 view = h->WireID().Plane;
67 fHitMap[cryo][tpc][view].push_back(h);
82 for (
auto const& t : tracks.
tracks()) {
83 auto&
trk = *(t.Track());
85 unsigned int tpc =
trk.FrontTPC(), cryo =
trk.FrontCryo();
86 if ((tpc ==
trk.BackTPC()) && (cryo ==
trk.BackCryo())) {
102 const std::vector<recob::Cluster>& clusters,
103 const std::vector<recob::PFParticle>& pfparticles,
111 , fTrackingOnlyPdg(pmalgFitterConfig.TrackingOnlyPdg())
112 , fTrackingSkipPdg(pmalgFitterConfig.TrackingSkipPdg())
113 , fRunVertexing(pmalgFitterConfig.RunVertexing())
115 mf::LogVerbatim(
"PMAlgFitter") <<
"Found " << allhitlist.size() <<
"hits in the event.";
116 mf::LogVerbatim(
"PMAlgFitter") <<
"Sort hits by clusters assigned to PFParticles...";
119 for (
size_t i = 0; i < pfparticles.size(); ++i) {
122 auto cv = clusFromPfps.at(i);
123 for (
const auto& c : cv) {
126 auto hv = hitsFromClusters.at(c.key());
127 fCluHits[c.key()].reserve(hv.size());
128 for (
auto const& h : hv)
133 if (vtxFromPfps.isValid() && vtxFromPfps.at(i).size()) {
135 vtxFromPfps.at(i).front()->XYZ(xyz);
141 <<
fPfpClusters.size() <<
" pfparticles for 3D tracking.";
176 bool selectPdg =
true;
180 int pfPartIdx = pfpCluEntry.first;
187 mf::LogVerbatim(
"PMAlgFitter") <<
"Process clusters from PFP:" << pfPartIdx <<
", pdg:" << pdg;
189 std::vector<art::Ptr<recob::Hit>> allHits;
192 std::unordered_map<geo::View_t, size_t> clu_count;
193 for (
const auto& c : pfpCluEntry.second) {
194 if (c->NHits() == 0) {
continue; }
196 candidate.
Clusters().push_back(c.key());
197 clu_count[c->View()]++;
199 allHits.reserve(allHits.size() +
fCluHits.at(c.key()).
size());
200 for (
const auto& h :
fCluHits.at(c.key())) {
201 allHits.push_back(h);
204 if (clu_count.size() > 1)
206 candidate.
SetKey(pfpCluEntry.first);
214 mf::LogError(
"PMAlgFitter") <<
"Trajectory fit lenght is nan.";
231 bool selectPdg =
true;
235 int pfPartIdx = pfpCluEntry.first;
238 if (pdg != 11)
continue;
242 mf::LogVerbatim(
"PMAlgFitter") <<
"Process clusters from PFP:" << pfPartIdx <<
", pdg:" << pdg;
244 std::vector<art::Ptr<recob::Hit>> allHits;
247 std::unordered_map<geo::View_t, size_t> clu_count;
248 for (
const auto& c : pfpCluEntry.second) {
249 if (c->NHits() == 0) {
continue; }
251 candidate.
Clusters().push_back(c.key());
252 clu_count[c->View()]++;
254 allHits.reserve(allHits.size() +
fCluHits.at(c.key()).
size());
255 for (
const auto& h :
fCluHits.at(c.key()))
256 allHits.push_back(h);
258 if (clu_count.size() > 1)
260 candidate.
SetKey(pfpCluEntry.first);
265 auto search =
fPfpVtx.find(pfPartIdx);
285 const std::vector<recob::Wire>& wires,
292 const std::vector<TH1F*>& hpassing,
293 const std::vector<TH1F*>& hrejected)
296 , fMinSeedSize1stPass(pmalgTrackerConfig.MinSeedSize1stPass())
297 , fMinSeedSize2ndPass(pmalgTrackerConfig.MinSeedSize2ndPass())
298 , fTrackLikeThreshold(pmalgTrackerConfig.TrackLikeThreshold())
299 , fMinTwoViewFraction(pmalgConfig.MinTwoViewFraction())
300 , fFlipToBeam(pmalgTrackerConfig.FlipToBeam())
301 , fFlipDownward(pmalgTrackerConfig.FlipDownward())
302 , fFlipToX(pmalgTrackerConfig.FlipToX())
303 , fAutoFlip_dQdx(pmalgTrackerConfig.AutoFlip_dQdx())
304 , fMergeWithinTPC(pmalgTrackerConfig.MergeWithinTPC())
305 , fMergeTransverseShift(pmalgTrackerConfig.MergeTransverseShift())
306 , fMergeAngle(pmalgTrackerConfig.MergeAngle())
307 , fCosmicTagger(pmtaggerConfig)
308 , fTagCosmicTracks(fCosmicTagger.tagAny())
309 , fStitchBetweenTPCs(pmalgTrackerConfig.StitchBetweenTPCs())
310 , fStitchDistToWall(pmalgTrackerConfig.StitchDistToWall())
311 , fStitchTransverseShift(pmalgTrackerConfig.StitchTransverseShift())
312 , fStitchAngle(pmalgTrackerConfig.StitchAngle())
313 , fMatchT0inAPACrossing(pmalgTrackerConfig.MatchT0inAPACrossing())
314 , fMatchT0inCPACrossing(pmalgTrackerConfig.MatchT0inCPACrossing())
315 , fStitcher(pmstitchConfig)
317 , fAdcInPassingPoints(hpassing)
318 , fAdcInRejectedPoints(hrejected)
319 , fGeom(&*(
art::ServiceHandle<
geo::Geometry const>()))
326 mf::LogVerbatim(
"PMAlgTracker") <<
"Using views in the following order:";
336 for (
size_t p = 0; p < nplanes; ++p) {
341 else if (pmalgTrackerConfig.
Validation() ==
"adc") {
344 else if (pmalgTrackerConfig.
Validation() ==
"calib") {
348 throw cet::exception(
"pma::PMAlgTracker") <<
"validation name not supported" << std::endl;
353 <<
"Not enough planes to perform validation, switch mode to hits.";
359 mf::LogVerbatim(
"PMAlgTracker") <<
"Validation ADC thresholds per plane:";
371 fCluHits.reserve(hitsFromClusters.size());
374 for (
size_t i = 0; i < hitsFromClusters.size(); ++i) {
375 auto v = hitsFromClusters.at(i);
377 for (
auto const& h : v)
386 const std::vector<float>& trackLike)
388 mf::LogVerbatim(
"PMAlgTracker") <<
"Filter track-like clusters using likelihood values...";
390 fCluHits.reserve(hitsFromClusters.size());
393 for (
size_t i = 0; i < hitsFromClusters.size(); ++i) {
394 auto v = hitsFromClusters.at(i);
396 for (
auto const& h : v)
408 fCluHits.reserve(hitsFromClusters.size());
412 for (
size_t i = 0; i < hitsFromClusters.size(); ++i) {
413 auto v = hitsFromClusters.at(i);
415 for (
auto const& h : v) {
417 for (
size_t j = 0; j < hitsFromEmParts.size(); ++j) {
418 auto u = hitsFromEmParts.at(j);
419 for (
auto const& g : u)
421 if (g.key() == h.key()) {
428 if (trkLike)
fCluHits.back().push_back(h);
438 mf::LogVerbatim(
"PMAlgTracker") <<
"...done, " << n <<
" clusters for 3D tracking.";
444 unsigned int testView)
447 mf::LogVerbatim(
"PMAlgTracker") <<
"first or last node too far out of its initial TPC";
452 mf::LogVerbatim(
"PMAlgTracker") <<
"validation in plane: " << testView;
485 throw cet::exception(
"pma::PMAlgTracker") <<
"validation mode not supported" << std::endl;
502 if ((
hits.size() > 1) || (dist2 > 1.0))
506 size_t best_u = 0, n_max = 0;
507 for (
size_t u = 0; u < tracks.
size(); u++)
518 if (best_trk && (n_max >=
hits.size() / 3))
520 mf::LogVerbatim(
"PMAlgTrackMaker") <<
" Reassign(v1) " << n_max <<
" hits." << std::endl;
530 tracks[best_u].SetTrack(ext);
537 size_t minSizeCompl =
hits.size() / 8;
538 if (minSizeCompl < 3) minSizeCompl = 3;
541 unsigned int tpc =
hits.front()->WireID().TPC;
542 unsigned int cryo =
hits.front()->WireID().Cryostat;
549 <<
" Add new track, cut hits from source track." << std::endl;
558 else if ((
hits.size() == 1) || (dist2 > 2.25))
560 mf::LogVerbatim(
"PMAlgTrackMaker") <<
" Cut single-view isolated hit." << std::endl;
572 while ((idx < trk.
size() - 1) && !(trk[idx]->IsEnabled())) {
573 hits.push_back(trk[idx++]->Hit2DPtr());
578 if ((idx < trk.
size() - 1) && (trk[idx]->View2D() == trk[idx - 1]->View2D())) {
581 if (dprev < dnext) {
hits.push_back(trk[idx++]->Hit2DPtr()); }
591 size_t idx = trk.
size() - 1;
592 while ((idx > 0) && !(trk[idx]->IsEnabled())) {
593 hits.push_back(trk[idx--]->Hit2DPtr());
597 if (idx < trk.
size() - 1) {
598 if ((idx > 0) && (trk[idx]->View2D() == trk[idx + 1]->View2D())) {
601 if (dprev < dnext) {
hits.push_back(trk[idx--]->Hit2DPtr()); }
612 for (
size_t t = 0; t < tracks.
size(); t++) {
614 if (trk.
size() < 6)
continue;
618 std::vector<art::Ptr<recob::Hit>>
hits;
644 double l1 = trk1->
Length();
645 double l2 = trk2->
Length();
652 double d = lmax * distThr;
653 if (d < distThrMin) d = distThrMin;
696 default:
mf::LogError(
"PMAlgTracker") <<
"Should never happen.";
701 reverseOrder =
false;
703 size_t nodeEndIdx = trk1->
Nodes().size() - 1;
706 TVector3 trk2front0 = trk2->
Nodes()[0]->Point3D();
707 TVector3 trk2front1 = trk2->
Nodes()[1]->Point3D();
709 double distProj1 = sqrt(
pma::Dist2(endpoint1, proj1));
712 TVector3 trk1back0 = trk1->
Nodes()[nodeEndIdx]->Point3D();
713 TVector3 trk1back1 = trk1->
Nodes()[nodeEndIdx - 1]->Point3D();
715 double distProj2 = sqrt(
pma::Dist2(endpoint2, proj2));
720 cos3d = dir1.Dot(dir2);
722 if ((cos3d > cosThr) && (distProj1 < distProjThr) && (distProj2 < distProjThr))
726 const double maxCosXZ = 0.996195;
729 dir1_xz *= 1.0 / dir1_xz.R();
732 dir2_xz *= 1.0 / dir2_xz.R();
734 if ((fabs(dir1_xz.Z()) > maxCosXZ) && (fabs(dir2_xz.Z()) > maxCosXZ)) {
739 distProj1 = sqrt(
pma::Dist2(endpoint1, proj1));
745 distProj2 = sqrt(
pma::Dist2(endpoint2, proj2));
747 double cosThrXZ = cos(0.5 * acos(cosThr));
748 double distProjThrXZ = 0.5 * distProjThr;
749 double cosXZ = dir1_xz.Dot(dir2_xz);
750 if ((cosXZ > cosThrXZ) && (distProj1 < distProjThrXZ) && (distProj2 < distProjThrXZ))
761 double distThr = 0.25;
762 double distThrMin = 0.5;
765 double cosThr = cos(TMath::Pi() *
fMergeAngle / 180.0);
767 bool foundMerge =
false;
772 double d, dmin, c, cmax, l, lbest;
774 while (t < tracks.
size()) {
783 for (u = t + 1; u < tracks.
size(); u++) {
784 trk2 = tracks[u].Track();
785 if (
areCoLinear(trk1, trk2, d, c, r, distThr, distThrMin, distProjThr, cosThr)) {
787 if (((c > cmax) && (d < dmin + 0.5 * lbest)) || ((d < dmin) && (l > 1.5 * lbest))) {
801 <<
"Merge track (" << trk1->
size() <<
") with track (" << trk2->
size() <<
")";
804 tracks[t].SetTrack(trk2);
808 tracks[ubest].DeleteTrack();
824 for (
auto node :
trk.Track()->Nodes())
825 if (node->IsBranching()) node->SetFrozen(
true);
830 for (
auto node :
trk.Track()->Nodes())
831 node->SetFrozen(
false);
838 double distThr = 0.25;
839 double distThrMin = 2.5;
842 double cosThr = cos(TMath::Pi() *
fStitchAngle / 180.0);
845 double dfront1, dback1, dfront2, dback2;
847 for (
auto& tpc_entry1 : tracks) {
848 unsigned int tpc1 = tpc_entry1.first;
852 while (t < tracks1.
size()) {
853 bool r, reverse =
false;
854 double l, lbest = 0,
d, dmin = 1.0e12, c, cmax = 0.0;
856 unsigned int best_tpc = 0;
860 dfront1 = trk1->
Nodes().front()->GetDistToWall();
861 dback1 = trk1->
Nodes().back()->GetDistToWall();
862 if ((dfront1 < wallDistThr) || (dback1 < wallDistThr)) {
863 for (
auto& tpc_entry2 : tracks) {
864 unsigned int tpc2 = tpc_entry2.first;
865 if (tpc2 == tpc1)
continue;
869 for (
size_t u = 0; u < tracks2.
size(); u++) {
871 dfront2 = trk2->
Nodes().front()->GetDistToWall();
872 dback2 = trk2->
Nodes().back()->GetDistToWall();
873 if ((dfront2 < wallDistThr) || (dback2 < wallDistThr)) {
874 if (
areCoLinear(trk1, trk2,
d, c, r, distThr, distThrMin, distProjThr, cosThr)) {
876 if (((c > cmax) && (
d < dmin + 0.5 * lbest)) || (0.75 * l < dmin)) {
893 <<
"Merge track (" << tpc1 <<
":" << tracks1.
size() <<
":" << trk1->
size()
894 <<
") with track (" << best_tpc <<
":" << tracks[best_tpc].size() <<
":" 895 << best_trk2->
size() <<
")";
896 auto const* geom = lar::providerFrom<geo::Geometry>();
897 auto const* first_node_trk1 = trk1->
Nodes().front();
899 geom->TPC(
geo::TPCID(first_node_trk1->Cryo(), first_node_trk1->TPC()));
900 auto const* first_node_trk2 = best_trk2->
Nodes().front();
902 geom->TPC(
geo::TPCID(first_node_trk2->Cryo(), first_node_trk2->TPC()));
910 tracks1[t].SetTrack(best_trk2);
919 tracks[best_tpc][best_idx].DeleteTrack();
921 tracks[best_tpc].erase_at(best_idx);
937 for (
auto const& t : tracks.
tracks()) {
939 if (n > max_hits) { max_hits =
n; }
959 <<
"Reconstruct tracks within Cryo:" << tpcid.Cryostat <<
" / TPC:" << tpcid.TPC <<
".";
966 for (
size_t p = 0; p < nplanes; ++p) {
968 fAdcImages[p].setWireDriftData(clockData, detProp,
fWires, p, tpcid.TPC, tpcid.Cryostat);
984 mf::LogVerbatim(
"PMAlgTracker") <<
"Found tracks: " << tracks[tpcid.TPC].size();
985 if (tracks[tpcid.TPC].empty()) {
continue; }
994 mf::LogVerbatim(
"PMAlgTracker") <<
"Merge co-linear tracks within TPC " << tpcid.TPC <<
".";
1002 mf::LogVerbatim(
"PMAlgTracker") <<
"Stitch co-linear tracks between TPCs.";
1006 for (
auto& tpc_entry : tracks)
1007 for (
auto&
trk : tpc_entry.second.tracks()) {
1008 if (
trk.Track()->HasTwoViews() && (
trk.Track()->Nodes().size() > 1)) {
1022 mf::LogVerbatim(
"PMAlgTracker") <<
"Vertex finding / track-vertex reoptimization.";
1029 mf::LogVerbatim(
"PMAlgTracker") <<
"Find co-linear CPA-crossing tracks with any T0.";
1034 mf::LogVerbatim(
"PMAlgTracker") <<
"Find co-linear APA-crossing tracks with any T0.";
1039 mf::LogVerbatim(
"PMAlgTracker") <<
"Second pass cosmic tagging for stitched tracks";
1067 size_t minBuildSize,
1073 size_t minSizeCompl = minBuildSize / 8;
1074 if (minSizeCompl < 2) minSizeCompl = 2;
1076 int max_first_idx = 0;
1077 while (max_first_idx >= 0)
1082 if ((max_first_idx >= 0) && !
fCluHits[max_first_idx].
empty()) {
1086 matchCluster(detProp, max_first_idx, minSizeCompl, tpc, cryo, first_view);
1102 size_t minSizeCompl,
1113 if (first_clu_idx >= 0) {
1118 unsigned int nFirstHits = first_hits.size(), first_plane_idx = first_hits.front()->WireID().Plane;
1119 mf::LogVerbatim(
"PMAlgTracker") << std::endl <<
"--- start new candidate ---";
1120 mf::LogVerbatim(
"PMAlgTracker") <<
"use view *** " << first_view <<
" *** plane idx " 1121 << first_plane_idx <<
" *** size: " << nFirstHits;
1123 float xmax = detProp.
ConvertTicksToX(first_hits.front()->PeakTime(), first_plane_idx, tpc, cryo);
1125 for (
size_t j = 1; j < first_hits.size(); ++j) {
1126 float x = detProp.
ConvertTicksToX(first_hits[j]->PeakTime(), first_plane_idx, tpc, cryo);
1127 if (x > xmax) { xmax =
x; }
1128 if (x < xmin) { xmin =
x; }
1135 bool try_build =
true;
1139 if (first_clu_idx >= 0) candidate.
Clusters().push_back((
size_t)first_clu_idx);
1142 int idx = -1, av_idx = -1;
1143 unsigned int nMaxHits = 0, nHits = 0;
1145 for (
auto av : fAvailableViews) {
1146 if (av == first_view)
continue;
1149 maxCluster(detProp, first_clu_idx, candidates, xmin, xmax, minSizeCompl, av, tpc, cryo);
1152 if ((nHits > nMaxHits) && (nHits >= minSizeCompl)) {
1161 for (
auto av : fAvailableViews) {
1162 if ((av != first_view) && (av != bestView)) {
1169 mf::LogVerbatim(
"PMAlgTracker") <<
"--> " << imatch++ <<
" match with:";
1171 <<
" cluster in view *** " << bestView <<
" *** size: " << nMaxHits;
1178 mf::LogVerbatim(
"PMAlgTracker") <<
" validation plane *** " << testView <<
" ***";
1181 double m0 = 0.0, v0 = 0.0;
1182 double mseThr = 0.15, validThr = 0.7;
1184 candidate.
Clusters().push_back(idx);
1197 if (candidate.
Track() && (m0 < mseThr) && (v0 > validThr))
1199 mf::LogVerbatim(
"PMAlgTracker") <<
" good track candidate, MSE = " << m0 <<
", v = " << v0;
1206 double fraction = 0.5;
1216 candidate.
Clusters().push_back(idx);
1223 mf::LogVerbatim(
"PMAlgTracker") <<
"merge clusters from the validation plane";
1227 bool extended =
false;
1228 while ((idx >= 0) &&
1236 candidate.
Clusters().push_back(idx);
1248 mf::LogVerbatim(
"PMAlgTracker") <<
"track REJECTED, MSE = " << m0 <<
"; v = " << v0;
1259 if (!candidates.
empty())
1262 double f, max_f = 0., min_mse = 10., max_v = 0.;
1263 for (
size_t t = 0; t < candidates.
size(); t++)
1264 if (candidates[t].IsGood() && (candidates[t].Track()->Nodes().
size() > 1) &&
1265 candidates[t].
Track()->HasTwoViews()) {
1268 if ((f > max_f) || ((f == max_f) && ((candidates[t].Validation() > max_v) ||
1269 (candidates[t].Mse() < min_mse)))) {
1271 min_mse = candidates[t].Mse();
1272 max_v = candidates[t].Validation();
1278 candidates[best_trk].Track()->ShiftEndsToHits();
1280 for (
auto c : candidates[best_trk].Clusters())
1283 result = candidates[best_trk];
1286 for (
size_t t = 0; t < candidates.
size(); t++) {
1287 if (
int(t) != best_trk) candidates[t].DeleteTrack();
1298 unsigned int testView,
1301 double m_max = 2.0 * candidate.
Mse();
1302 if (m_max < 0.05) m_max = 0.05;
1304 double v_min1 = 0.98 * candidate.
Validation();
1305 double v_min2 = 0.9 * candidate.
Validation();
1309 double m1 = copy->
GetMse();
1310 double v1 =
validate(detProp, *copy, testView);
1312 if (((m1 < candidate.
Mse()) && (v1 >= v_min2)) ||
1313 ((m1 < 0.5) && (m1 <= m_max) && (v1 >= v_min1))) {
1314 mf::LogVerbatim(
"PMAlgTracker") <<
" track EXTENDED, MSE = " << m1 <<
", v = " << v1;
1324 mf::LogVerbatim(
"PMAlgTracker") <<
" track NOT extended, MSE = " << m1 <<
", v = " << v1;
1335 unsigned int preferedView,
1336 unsigned int testView)
const 1338 double f, fmax = 0.0;
1339 unsigned int n, max = 0;
1341 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1344 unsigned int view =
fCluHits[i].front()->View();
1345 unsigned int nhits =
fCluHits[i].size();
1349 (view == testView) ||
1351 (view != preferedView)) ||
1356 f = n / (double)nhits;
1357 if ((f > fraction) && (n > max)) {
1365 mf::LogVerbatim(
"PMAlgTracker") <<
"max matching hits: " << max <<
" (" << fmax <<
")";
1378 size_t min_clu_size,
1381 unsigned int cryo)
const 1384 size_t s_max = 0, s;
1385 double fraction = 0.0;
1388 size_t first_idx = 0;
1389 bool has_first =
false;
1390 if (first_idx_tag >= 0) {
1391 first_idx = (size_t)first_idx_tag;
1395 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1400 bool pair_checked =
false;
1401 for (
auto const& c : candidates.
tracks())
1402 if (has_first &&
has(c.Clusters(), first_idx) &&
has(c.Clusters(), i)) {
1403 pair_checked =
true;
1406 if (pair_checked)
continue;
1410 if ((v.front()->WireID().TPC == tpc) && (v.front()->WireID().Cryostat == cryo)) {
1412 for (
size_t j = 0; j < v.size(); ++j) {
1414 if ((x >= xmin) && (x <= xmax)) s++;
1420 fraction = s / (double)v.size();
1424 if (fraction > 0.4)
return idx;
1433 unsigned int cryo)
const 1438 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1446 if ((v.front()->WireID().TPC == tpc) && (v.front()->WireID().Cryostat == cryo)) {
1447 size_t s = v.size();
1448 if ((s >= min_clu_size) && (s > s_max)) {
1461 mf::LogVerbatim(
"PMAlgTracker") << std::endl <<
"----------- matched clusters: -----------";
1462 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1465 <<
" tpc: " <<
fCluHits[i].front()->WireID().TPC
1466 <<
";\tview: " <<
fCluHits[i].front()->View() <<
";\tsize: " <<
fCluHits[i].size()
1471 mf::LogVerbatim(
"PMAlgTracker") <<
"--------- not matched clusters: ---------";
1472 size_t nsingles = 0;
1473 for (
size_t i = 0; i <
fCluHits.size(); ++i) {
1478 <<
" tpc: " <<
fCluHits[i].front()->WireID().TPC
1479 <<
";\tview: " <<
fCluHits[i].front()->View() <<
";\tsize: " <<
fCluHits[i].size()
1486 mf::LogVerbatim(
"PMAlgTracker") <<
"-----------------------------------------";
bool SelectHits(float fraction=1.0F)
details::range_type< T > Iterate() const
Initializes the specified ID with the ID of the first cryostat.
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)
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.
Geometry information for a single TPC.
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
fhicl::Atom< std::string > Validation
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
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)
recob::tracking::Point_t Point_t
TPCGeo const & TPC(TPCID const &tpcid=tpc_zero) const
Returns the specified TPC.
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
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
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
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
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::set< View_t > const & Views() const
Returns a list of possible views in the detector.
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)
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
Namespace collecting geometry-related classes utilities.
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)