Use PCA to try to find path in cluster.
586 std::vector<double> eigenValVec = {3. * std::sqrt(fullPCA.
getEigenValues()[0]),
601 Eigen::Vector3f edgeVec(secondEdgeHit->getPosition()[0] - firstEdgeHit->
getPosition()[0],
602 secondEdgeHit->getPosition()[1] - firstEdgeHit->
getPosition()[1],
603 secondEdgeHit->getPosition()[2] - firstEdgeHit->
getPosition()[2]);
604 double edgeLen = edgeVec.norm();
617 clusHitPairVector.sort([](
const auto&
left,
const auto&
right){
return left->getArclenToPoca() <
right->getArclenToPoca();});
620 using DistEdgeTuple = std::tuple<float, const reco::EdgeTuple*>;
621 using DistEdgeTupleVec = std::vector<DistEdgeTuple>;
623 DistEdgeTupleVec distEdgeTupleVec;
626 for(
const auto& edge : clusterToBreak.getBestEdgeList())
636 float hitProjection = hitToEdgeVec.dot(edgeVec);
639 if (hitProjection > 0. && hitProjection < edgeLen)
641 Eigen::Vector3f distToHitVec = hitToEdgeVec - hitProjection * edgeVec;
642 float distToHit = distToHitVec.norm();
644 distEdgeTupleVec.emplace_back(distToHit,&edge);
648 std::sort(distEdgeTupleVec.begin(),distEdgeTupleVec.end(),[](
const auto&
left,
const auto&
right){
return std::get<0>(
left) > std::get<0>(
right);});
652 float usedDefectDist(0.);
654 for(
const auto& distEdgeTuple : distEdgeTupleVec)
659 usedDefectDist = std::get<0>(distEdgeTuple);
681 tempClusterParametersList.clear();
685 if (tempClusterParametersList.empty())
687 std::cout <<
indent <<
"===> no cluster cands, edgeLen: " << edgeLen <<
", # hits: " << clusHitPairVector.size() <<
", max defect: " << std::get<0>(distEdgeTupleVec.front()) <<
std::endl;
695 std::advance(vertexItr, clusHitPairVector.size()/2);
708 tempClusterParametersList.clear();
714 for(
auto& clusterParams : tempClusterParametersList)
716 size_t curOutputClusterListSize = outputClusterList.size();
720 std::cout <<
indent <<
"Output cluster list prev: " << curOutputClusterListSize <<
", now: " << outputClusterList.size() <<
std::endl;
724 if (curOutputClusterListSize < outputClusterList.size())
continue;
729 std::set<const reco::ClusterHit2D*> hitSet;
732 for(
const auto& hit3D : clusterParams.getHitPairListPtr())
734 for(
const auto& hit2D : hit3D->getHits())
736 if (hit2D) hitSet.insert(hit2D);
741 for(
const auto& hit2D : hitSet)
744 clusterParams.UpdateParameters(hit2D);
747 std::cout <<
indent <<
"*********>>> storing new subcluster of size " << clusterParams.getHitPairListPtr().size() <<
std::endl;
749 positionItr = outputClusterList.insert(positionItr,clusterParams);
760 int num3DHits = clusterParams.getHitPairListPtr().size();
761 int numEdges = clusterParams.getBestEdgeList().size();
762 float cosToLast = newPrimaryVec.dot(lastPrimaryVec);
763 double eigen2To1Ratio = eigenValVec[0] / eigenValVec[1];
764 double eigen1To0Ratio = eigenValVec[1] / eigenValVec[2];
765 double eigen2To0Ratio = eigenValVec[2] / eigenValVec[2];
775 fSubMaxDefect->Fill(std::get<0>(distEdgeTupleVec.front()), 1.);
void PCAAnalysis_calc3DDocas(const reco::HitPairListPtr &hitPairVector, const reco::PrincipalComponents &pca) const
const Eigen::Vector3f getPosition() const
const EigenValues & getEigenValues() const
PrincipalComponentsAlg fPCAAlg
reco::ClusterParametersList::iterator subDivideCluster(reco::ClusterParameters &cluster, reco::PrincipalComponents &lastPCA, reco::ClusterParametersList::iterator positionItr, reco::ClusterParametersList &outputClusterList, int level=0) const
Use PCA to try to find path in cluster.
std::tuple< const reco::ClusterHit3D *, const reco::ClusterHit3D *, double > EdgeTuple
std::list< const reco::ClusterHit3D * > HitPairListPtr
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
bool makeCandidateCluster(Eigen::Vector3f &, reco::ClusterParameters &, reco::HitPairListPtr::iterator, reco::HitPairListPtr::iterator, int) const
size_t fMinTinyClusterSize
Minimum size for a "tiny" cluster.
bool fFillHistograms
Histogram definitions.
std::list< ClusterParameters > ClusterParametersList
const EigenVectors & getEigenVectors() const
QTextStream & endl(QTextStream &s)