28 : m_maxNumEdgeHits(1000)
31 , m_pcaAlg(pset.
get<
fhicl::ParameterSet>(
"PrincipalComponentsAlg"))
43 bool foundGoodSeeds(
false);
64 std::set<const reco::ClusterHit2D*> hit2DSet;
67 double lastArcLen = inputHitPairListPtr.front()->getArclenToPoca();
69 for (
const auto& hit3D : inputHitPairListPtr) {
70 double arcLen = hit3D->getArclenToPoca();
73 seedHit3DList.clear();
77 seedHit3DList.push_back(hit3D);
79 for (
const auto& hit2D : hit3D->getHits()) {
80 hit2DSet.insert(hit2D);
91 size_t num3DHitsToKeep = std::min(2 * seedHit3DList.size(), inputHitPairListPtr.size());
92 size_t numEdgeHits = std::min(
size_t(num3DHitsToKeep / 2),
m_maxNumEdgeHits);
97 std::advance(edgeHitItr, numEdgeHits);
102 hit3DList.resize(2 * numEdgeHits);
106 std::copy(inputHitPairListPtr.begin(), edgeHitItr, hit3DList.begin());
109 seedHit3DList.clear();
110 seedHit3DList.resize(numEdgeHits);
112 std::copy(inputHitPairListPtr.begin(), edgeHitItr, seedHit3DList.begin());
115 std::advance(edgeHitItr, inputHitPairListPtr.size() - 2 * numEdgeHits);
117 std::copy(edgeHitItr, inputHitPairListPtr.end(), nextHit3DItr);
125 if (seedPCA.getSvdOK()) {
127 if (seedPCA.getEigenVectors().row(2)(1) > 0.) seedPCA.flipAxis(0);
137 double seedDir[3] = {seedPCA.getEigenVectors().row(2)(0),
138 seedPCA.getEigenVectors().row(2)(1),
139 seedPCA.getEigenVectors().row(2)(2)};
140 double seedStart[3] = {seedHit3DList.front()->getX(),
141 seedHit3DList.front()->getY(),
142 seedHit3DList.front()->getZ()};
145 double halfArcLen = 0.5 * fabs(seedHit3DList.back()->getArclenToPoca() -
146 seedHit3DList.front()->getArclenToPoca());
148 seedStart[0] += halfArcLen * seedDir[0];
149 seedStart[1] += halfArcLen * seedDir[1];
150 seedStart[2] += halfArcLen * seedDir[2];
152 for (
const auto& hit3D : seedHit3DList)
153 hit3D->setStatusBit(0x40000000);
155 seedHitPairVec.emplace_back(std::pair<recob::Seed, reco::HitPairListPtr>(
160 foundGoodSeeds =
true;
165 return foundGoodSeeds;
Define a comparator which will sort hits by arc length along a PCA axis.
void PCAAnalysis_calc3DDocas(const reco::HitPairListPtr &hitPairVector, const reco::PrincipalComponents &pca) const
void PCAAnalysis_3D(const reco::HitPairListPtr &hitPairList, reco::PrincipalComponents &pca, bool skeletonOnly=false) const
double m_gapDistance
Maximum allowed distance between hits.
void flipAxis(size_t axis)
size_t m_maxNumEdgeHits
Maximum number hits each end of PCA axis.
PrincipalComponentsAlg m_pcaAlg
This is an algorithm for finding recob::Seed objects in 3D clusters.
bool findTrackSeeds(reco::HitPairListPtr &hitPairListPtr, reco::PrincipalComponents &inputPCA, SeedHitPairListPairVec &seedHitMap) const override
Given the list of hits this will search for candidate Seed objects and return them.
ParallelHitsSeedFinderAlg(fhicl::ParameterSet const &pset)
Constructor.
T get(std::string const &key) const
std::list< const reco::ClusterHit3D * > HitPairListPtr
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
std::vector< SeedHitPairListPair > SeedHitPairListPairVec
size_t m_numSeed2DHits
Number 2D seed hits desired.
const EigenVectors & getEigenVectors() const