949 for (
const auto& hit3D : hitPairListPtr) {
950 Eigen::Vector3f pcaToHitVec(hit3D->getPosition()[0] - pcaCenter(0),
951 hit3D->getPosition()[1] - pcaCenter(1),
952 hit3D->getPosition()[2] - pcaCenter(2));
955 pointList.emplace_back(pcaToHit(1), pcaToHit(2), hit3D);
959 pointList.sort([](
const auto&
left,
const auto&
right) {
961 std::numeric_limits<float>::epsilon()) ?
967 std::vector<ConvexHull> convexHullVec;
968 std::vector<reco::ProjectedPointList> rejectedListVec;
969 bool increaseDepth(pointList.size() > 3);
972 while (increaseDepth) {
977 const ConvexHull& convexHull = convexHullVec.back();
981 increaseDepth =
false;
983 if (convexHull.getConvexHullArea() > 0.) {
984 if (convexHullVec.size() < 2 || convexHull.getConvexHullArea() < 0.8 * lastArea) {
985 for (
auto& point : convexHullPoints) {
986 pointList.remove(point);
987 rejectedList.emplace_back(point);
989 lastArea = convexHull.getConvexHullArea();
996 while (!convexHullVec.empty() && convexHullVec.back().getConvexHullArea() < 0.5) {
997 convexHullVec.pop_back();
998 rejectedListVec.pop_back();
1002 if (!convexHullVec.empty()) {
1003 size_t nRejectedTotal(0);
1006 for (
const auto& rejectedList : rejectedListVec) {
1007 nRejectedTotal += rejectedList.size();
1009 for (
const auto& rejectedPoint : rejectedList) {
1010 if (convexHullVec.back().findNearestDistance(rejectedPoint) > 0.5)
1011 locHitPairListPtr.remove(std::get<2>(rejectedPoint));
1022 for (
auto& curPoint : convexHullVec.back().getConvexHull()) {
1023 if (curPoint == lastPoint)
continue;
1028 float distBetweenPoints = (curPoint3D->getPosition()[0] - lastPoint3D->
getPosition()[0]) *
1029 (curPoint3D->getPosition()[0] - lastPoint3D->
getPosition()[0]) +
1030 (curPoint3D->getPosition()[1] - lastPoint3D->
getPosition()[1]) *
1031 (curPoint3D->getPosition()[1] - lastPoint3D->
getPosition()[1]) +
1032 (curPoint3D->getPosition()[2] - lastPoint3D->
getPosition()[2]) *
1033 (curPoint3D->getPosition()[2] - lastPoint3D->
getPosition()[2]);
1035 distBetweenPoints = std::sqrt(distBetweenPoints);
1039 convexHullPointList.push_back(curPoint);
1040 edgeMap[lastPoint3D].push_back(edge);
1041 edgeMap[curPoint3D].push_back(edge);
1042 edgeList.emplace_back(edge);
1044 lastPoint = curPoint;
1051 for (
const auto& point : extremePoints)
1052 extremePointList.push_back(point);
1058 for (
const auto& kink : kinkPoints)
1059 kinkPointList.push_back(kink);
const Eigen::Vector3f getPosition() const
std::list< ProjectedPoint > ProjectedPointList
std::list< Point > PointList
The list of the projected points.
float fConvexHullMinSep
Min hit separation to conisder in convex hull.
std::list< EdgeTuple > EdgeList
reco::PrincipalComponents & getFullPCA()
Define a container for working with the convex hull.
const Eigen::Vector3f & getAvePosition() const
std::list< ConvexHullKinkTuple > ConvexHullKinkTupleList
std::tuple< const reco::ClusterHit3D *, const reco::ClusterHit3D *, double > EdgeTuple
std::list< const reco::ClusterHit3D * > HitPairListPtr
static int max(int a, int b)
float fConvexHullKinkAngle
Angle to declare a kink in convex hull calc.
reco::ConvexHull & getConvexHull()
std::unordered_map< const reco::ClusterHit3D *, reco::EdgeList > Hit3DToEdgeMap
reco::ProjectedPointList & getProjectedPointList()
std::tuple< float, float, const reco::ClusterHit3D * > ProjectedPoint
Projected coordinates and pointer to hit.
const EigenVectors & getEigenVectors() const