LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
reco::PrincipalComponents Class Reference

#include "Cluster3D.h"

Public Types

using EigenValues = Eigen::Vector3f
 
using EigenVectors = Eigen::Matrix3f
 

Public Member Functions

 PrincipalComponents ()
 
 PrincipalComponents (bool ok, int nHits, const EigenValues &eigenValues, const EigenVectors &eigenVecs, const Eigen::Vector3f &avePos, const float aveHitDoca=9999.)
 
bool getSvdOK () const
 
int getNumHitsUsed () const
 
const EigenValuesgetEigenValues () const
 
const EigenVectorsgetEigenVectors () const
 
const Eigen::Vector3f & getAvePosition () const
 
float getAveHitDoca () const
 
void flipAxis (size_t axis)
 
void setAveHitDoca (double doca) const
 

Private Attributes

bool m_svdOK
 SVD Decomposition was successful. More...
 
int m_numHitsUsed
 Number of hits in the decomposition. More...
 
EigenValues m_eigenValues
 Eigen values from SVD decomposition. More...
 
EigenVectors m_eigenVectors
 The three principle axes. More...
 
Eigen::Vector3f m_avePosition
 Average position of hits fed to PCA. More...
 
double m_aveHitDoca
 Average doca of hits used in PCA. More...
 

Friends

std::ostream & operator<< (std::ostream &o, const PrincipalComponents &a)
 
bool operator< (const PrincipalComponents &a, const PrincipalComponents &b)
 

Detailed Description

Definition at line 217 of file Cluster3D.h.

Member Typedef Documentation

using reco::PrincipalComponents::EigenValues = Eigen::Vector3f

Definition at line 219 of file Cluster3D.h.

using reco::PrincipalComponents::EigenVectors = Eigen::Matrix3f

Definition at line 220 of file Cluster3D.h.

Constructor & Destructor Documentation

reco::PrincipalComponents::PrincipalComponents ( )

Definition at line 209 of file Cluster3D.cxx.

210  : m_svdOK(false)
211  , m_numHitsUsed(0)
212  , m_eigenValues(EigenValues::Zero())
213  , m_eigenVectors(EigenVectors::Zero())
214  , m_avePosition(Eigen::Vector3f::Zero())
215  , m_aveHitDoca(9999.)
216  {}
bool m_svdOK
SVD Decomposition was successful.
Definition: Cluster3D.h:225
double m_aveHitDoca
Average doca of hits used in PCA.
Definition: Cluster3D.h:230
EigenValues m_eigenValues
Eigen values from SVD decomposition.
Definition: Cluster3D.h:227
Eigen::Vector3f m_avePosition
Average position of hits fed to PCA.
Definition: Cluster3D.h:229
EigenVectors m_eigenVectors
The three principle axes.
Definition: Cluster3D.h:228
int m_numHitsUsed
Number of hits in the decomposition.
Definition: Cluster3D.h:226
reco::PrincipalComponents::PrincipalComponents ( bool  ok,
int  nHits,
const EigenValues eigenValues,
const EigenVectors eigenVecs,
const Eigen::Vector3f &  avePos,
const float  aveHitDoca = 9999. 
)

Definition at line 218 of file Cluster3D.cxx.

224  : m_svdOK(ok)
225  , m_numHitsUsed(nHits)
226  , m_eigenValues(eigenValues)
227  , m_eigenVectors(eigenVecs)
228  , m_avePosition(avePos)
229  , m_aveHitDoca(aveHitDoca)
230  {}
bool m_svdOK
SVD Decomposition was successful.
Definition: Cluster3D.h:225
double m_aveHitDoca
Average doca of hits used in PCA.
Definition: Cluster3D.h:230
EigenValues m_eigenValues
Eigen values from SVD decomposition.
Definition: Cluster3D.h:227
Eigen::Vector3f m_avePosition
Average position of hits fed to PCA.
Definition: Cluster3D.h:229
EigenVectors m_eigenVectors
The three principle axes.
Definition: Cluster3D.h:228
int m_numHitsUsed
Number of hits in the decomposition.
Definition: Cluster3D.h:226

Member Function Documentation

const EigenVectors& reco::PrincipalComponents::getEigenVectors ( ) const
inline

Definition at line 243 of file Cluster3D.h.

Referenced by lar_cluster3d::Cluster3D::aParallelHitsCluster(), lar_cluster3d::ClusterPathFinder::breakIntoTinyBits(), lar_cluster3d::VoronoiPathFinder::breakIntoTinyBits(), lar_cluster3d::ClusterPathFinder::buildConvexHull(), lar_cluster3d::VoronoiPathFinder::buildConvexHull(), lar_cluster3d::ConvexHullPathFinder::buildConvexHull(), lar_cluster3d::MSTPathFinder::buildConvexHull(), lar_cluster3d::HoughSeedFinderAlg::buildSeed(), lar_cluster3d::ClusterPathFinder::buildVoronoiDiagram(), lar_cluster3d::VoronoiPathFinder::buildVoronoiDiagram(), lar_cluster3d::MinSpanTreeAlg::CheckHitSorting(), lar_cluster3d::ConvexHullPathFinder::completeCandidateCluster(), lar_cluster3d::Cluster3D::ConvertToArtOutput(), lar_cluster3d::MinSpanTreeAlg::FindBestPathInCluster(), lar_cluster3d::MSTPathFinder::FindBestPathInCluster(), lar_cluster3d::HoughSeedFinderAlg::findHoughClusters(), lar_cluster3d::ParallelHitsSeedFinderAlg::findTrackSeeds(), lar_cluster3d::PCASeedFinderAlg::findTrackSeeds(), lar_cluster3d::PCASeedFinderAlg::getHitsAtEnd(), lar_cluster3d::ClusterMergeAlg::linearClusters(), lar_cluster3d::Cluster3D::MakeAndSavePCAPoints(), lar_cluster3d::ConvexHullPathFinder::makeCandidateCluster(), lar_cluster3d::VoronoiPathFinder::makeCandidateCluster(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis_2D(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis_calc2DDocas(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis_calc3DDocas(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis_reject3DOutliers(), lar_cluster3d::Cluster3D::ProduceArtClusters(), lar_cluster3d::ConvexHullPathFinder::subDivideCluster(), and lar_cluster3d::VoronoiPathFinder::subDivideCluster().

243 { return m_eigenVectors; }
EigenVectors m_eigenVectors
The three principle axes.
Definition: Cluster3D.h:228
int reco::PrincipalComponents::getNumHitsUsed ( ) const
inline

Definition at line 241 of file Cluster3D.h.

Referenced by lar_cluster3d::Cluster3D::ConvertToArtOutput(), and lar_cluster3d::Cluster3D::ProduceArtClusters().

241 { return m_numHitsUsed; }
int m_numHitsUsed
Number of hits in the decomposition.
Definition: Cluster3D.h:226
void reco::PrincipalComponents::setAveHitDoca ( double  doca) const
inline

Friends And Related Function Documentation

bool operator< ( const PrincipalComponents a,
const PrincipalComponents b 
)
friend

Definition at line 262 of file Cluster3D.cxx.

263  {
264  if (a.m_svdOK && b.m_svdOK) return a.m_eigenValues(0) > b.m_eigenValues(0);
265 
266  return false; //They are equal
267  }
std::ostream& operator<< ( std::ostream &  o,
const PrincipalComponents a 
)
friend

Definition at line 239 of file Cluster3D.cxx.

240  {
241  if (a.m_svdOK) {
242  o << std::setiosflags(std::ios::fixed) << std::setprecision(2);
243  o << " PCAxis ID run with " << a.m_numHitsUsed << " space points" << std::endl;
244  o << " - center position: " << std::setw(6) << a.m_avePosition(0) << ", "
245  << a.m_avePosition(1) << ", " << a.m_avePosition(2) << std::endl;
246  o << " - eigen values: " << std::setw(8) << std::right << a.m_eigenValues(0) << ", "
247  << a.m_eigenValues(1) << ", " << a.m_eigenValues(1) << std::endl;
248  o << " - average doca: " << a.m_aveHitDoca << std::endl;
249  o << " - Principle axis: " << std::setw(7) << std::setprecision(4) << a.m_eigenVectors(0, 0)
250  << ", " << a.m_eigenVectors(0, 1) << ", " << a.m_eigenVectors(0, 2) << std::endl;
251  o << " - second axis: " << std::setw(7) << std::setprecision(4) << a.m_eigenVectors(1, 0)
252  << ", " << a.m_eigenVectors(1, 1) << ", " << a.m_eigenVectors(1, 2) << std::endl;
253  o << " - third axis: " << std::setw(7) << std::setprecision(4) << a.m_eigenVectors(2, 0)
254  << ", " << a.m_eigenVectors(2, 1) << ", " << a.m_eigenVectors(2, 2) << std::endl;
255  }
256  else
257  o << " Principal Components Axis is not valid" << std::endl;
258 
259  return o;
260  }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102

Member Data Documentation

double reco::PrincipalComponents::m_aveHitDoca
mutableprivate

Average doca of hits used in PCA.

Definition at line 230 of file Cluster3D.h.

Referenced by reco::operator<<().

Eigen::Vector3f reco::PrincipalComponents::m_avePosition
private

Average position of hits fed to PCA.

Definition at line 229 of file Cluster3D.h.

Referenced by reco::operator<<().

EigenValues reco::PrincipalComponents::m_eigenValues
private

Eigen values from SVD decomposition.

Definition at line 227 of file Cluster3D.h.

Referenced by reco::operator<(), and reco::operator<<().

EigenVectors reco::PrincipalComponents::m_eigenVectors
private

The three principle axes.

Definition at line 228 of file Cluster3D.h.

Referenced by flipAxis(), and reco::operator<<().

int reco::PrincipalComponents::m_numHitsUsed
private

Number of hits in the decomposition.

Definition at line 226 of file Cluster3D.h.

Referenced by reco::operator<<().

bool reco::PrincipalComponents::m_svdOK
private

SVD Decomposition was successful.

Definition at line 225 of file Cluster3D.h.

Referenced by reco::operator<(), and reco::operator<<().


The documentation for this class was generated from the following files: