1135 if (first_clu_idx >= 0) {
1140 unsigned int nFirstHits = first_hits.size(), first_plane_idx = first_hits.front()->WireID().Plane;
1141 mf::LogVerbatim(
"PMAlgTracker") << std::endl <<
"--- start new candidate ---";
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:";
1192 mf::LogVerbatim(
"PMAlgTracker")
1193 <<
" cluster in view *** " << bestView <<
" *** size: " << nMaxHits;
1196 mf::LogVerbatim(
"PMAlgTracker") <<
" no validation plane *** ";
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;
1279 mf::LogVerbatim(
"PMAlgTracker") <<
"no matching clusters";
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();
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
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)
double GetMse(unsigned int view=geo::kUnknown) const
MSE of hits weighted with hit amplidudes and wire plane coefficients.
process_name opflash particleana ie x
geo::GeometryCore const * fGeom
double validate(detinfo::DetectorPropertiesData const &detProp, pma::Track3D &trk, unsigned int testView)
double fMinTwoViewFraction
std::vector< size_t > fInitialClusters
void SetValidation(double v)
void SetTrack(pma::Track3D *trk)
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
process_name pandoraGausCryo1 vertexChargeCryo1 vertexStubCryo1 xmin
bool isContained(const pma::Track3D &trk, float margin=0.0F) const
pma::ProjectionMatchingAlg fProjectionMatchingAlg
std::vector< size_t > fUsedClusters
const pma::TrkCandidateColl & result()
std::vector< std::vector< art::Ptr< recob::Hit > > > fCluHits
const std::vector< size_t > & Clusters() const
std::vector< geo::View_t > fAvailableViews
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.
bool extendTrack(detinfo::DetectorPropertiesData const &detProp, pma::TrkCandidate &candidate, const std::vector< art::Ptr< recob::Hit >> &hits, unsigned int testView, bool add_nodes)
pma::Track3D * Track() const
double twoViewFraction(pma::Track3D &trk) const
void push_back(const TrkCandidate &trk)