LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
reco::PrincipalComponents Class Reference

#include "Cluster3D.h"

Public Types

typedef std::vector< std::vector< float > > EigenVectors
 

Public Member Functions

 PrincipalComponents ()
 
 PrincipalComponents (bool ok, int nHits, const float *eigenValues, const EigenVectors &eigenVecs, const float *avePos, const float aveHitDoca=9999.)
 
bool getSvdOK () const
 
int getNumHitsUsed () const
 
const float * getEigenValues () const
 
const EigenVectorsgetEigenVectors () const
 
const float * getAvePosition () const
 
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...
 
float m_eigenValues [3]
 Eigen values from SVD decomposition. More...
 
EigenVectors m_eigenVectors
 The three principle axes. More...
 
float m_avePosition [3]
 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 205 of file Cluster3D.h.

Member Typedef Documentation

typedef std::vector<std::vector<float> > reco::PrincipalComponents::EigenVectors

Definition at line 209 of file Cluster3D.h.

Constructor & Destructor Documentation

reco::PrincipalComponents::PrincipalComponents ( )

Definition at line 173 of file Cluster3D.cxx.

173  :
174  m_svdOK(false),
175  m_numHitsUsed(0),
176  m_eigenValues{0.,0.,0.},
177  m_avePosition{0.,0.,0.},
178  m_aveHitDoca(9999.)
179 {}
bool m_svdOK
SVD Decomposition was successful.
Definition: Cluster3D.h:215
double m_aveHitDoca
Average doca of hits used in PCA.
Definition: Cluster3D.h:220
float m_eigenValues[3]
Eigen values from SVD decomposition.
Definition: Cluster3D.h:217
float m_avePosition[3]
Average position of hits fed to PCA.
Definition: Cluster3D.h:219
int m_numHitsUsed
Number of hits in the decomposition.
Definition: Cluster3D.h:216
reco::PrincipalComponents::PrincipalComponents ( bool  ok,
int  nHits,
const float *  eigenValues,
const EigenVectors eigenVecs,
const float *  avePos,
const float  aveHitDoca = 9999. 
)

Definition at line 181 of file Cluster3D.cxx.

References m_avePosition, and m_eigenValues.

181  :
182  m_svdOK(ok),
183  m_numHitsUsed(nHits),
184  m_eigenVectors(eigenVecs),
185  m_aveHitDoca(aveHitDoca)
186 {
187  m_eigenValues[0] = eigenValues[0];
188  m_eigenValues[1] = eigenValues[1];
189  m_eigenValues[2] = eigenValues[2];
190  m_avePosition[0] = avePos[0];
191  m_avePosition[1] = avePos[1];
192  m_avePosition[2] = avePos[2];
193 }
bool m_svdOK
SVD Decomposition was successful.
Definition: Cluster3D.h:215
double m_aveHitDoca
Average doca of hits used in PCA.
Definition: Cluster3D.h:220
float m_eigenValues[3]
Eigen values from SVD decomposition.
Definition: Cluster3D.h:217
EigenVectors m_eigenVectors
The three principle axes.
Definition: Cluster3D.h:218
float m_avePosition[3]
Average position of hits fed to PCA.
Definition: Cluster3D.h:219
int m_numHitsUsed
Number of hits in the decomposition.
Definition: Cluster3D.h:216

Member Function Documentation

void reco::PrincipalComponents::flipAxis ( size_t  axis)

Definition at line 195 of file Cluster3D.cxx.

References m_eigenVectors.

Referenced by lar_cluster3d::PCASeedFinderAlg::findTrackSeeds(), lar_cluster3d::ParallelHitsSeedFinderAlg::findTrackSeeds(), and lar_cluster3d::PCASeedFinderAlg::getHitsAtEnd().

196 {
197  std::vector<float>& axis = m_eigenVectors.at(axisDir);
198 
199  for(auto& val : axis) val *= -1.;
200 
201  return;
202 }
EigenVectors m_eigenVectors
The three principle axes.
Definition: Cluster3D.h:218
const float* reco::PrincipalComponents::getEigenValues ( ) const
inline

Definition at line 228 of file Cluster3D.h.

Referenced by lar_cluster3d::Cluster3D::aParallelHitsCluster(), lar_cluster3d::ClusterPathFinder::breakIntoTinyBits(), lar_cluster3d::VoronoiPathFinder::breakIntoTinyBits(), lar_cluster3d::ConvexHullPathFinder::completeCandidateCluster(), lar_cluster3d::ClusterMergeAlg::consistentClusters(), lar_cluster3d::Cluster3D::ConvertToArtOutput(), lar_cluster3d::MinSpanTreeAlg::FindBestPathInCluster(), lar_cluster3d::HoughSeedFinderAlg::findHoughClusters(), lar_cluster3d::HoughSeedFinderAlg::findTrackHits(), lar_cluster3d::HoughSeedFinderAlg::findTrackSeeds(), lar_cluster3d::PCASeedFinderAlg::findTrackSeeds(), lar_cluster3d::Cluster3D::findTrackSeeds(), lar_cluster3d::ConvexHullPathFinder::makeCandidateCluster(), lar_cluster3d::VoronoiPathFinder::makeCandidateCluster(), lar_cluster3d::ClusterMergeAlg::mergeClusters(), lar_cluster3d::ClusterMergeAlg::ModifyClusters(), lar_cluster3d::ConvexHullPathFinder::ModifyClusters(), lar_cluster3d::VoronoiPathFinder::ModifyClusters(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis_calc2DDocas(), lar_cluster3d::Cluster3D::ProduceArtClusters(), lar_cluster3d::Cluster3D::splitClustersWithMST(), lar_cluster3d::ConvexHullPathFinder::subDivideCluster(), and lar_cluster3d::VoronoiPathFinder::subDivideCluster().

228 {return m_eigenValues;}
float m_eigenValues[3]
Eigen values from SVD decomposition.
Definition: Cluster3D.h:217
const EigenVectors& reco::PrincipalComponents::getEigenVectors ( ) const
inline

Definition at line 229 of file Cluster3D.h.

Referenced by lar_cluster3d::Cluster3D::aParallelHitsCluster(), lar_cluster3d::ClusterPathFinder::breakIntoTinyBits(), lar_cluster3d::VoronoiPathFinder::breakIntoTinyBits(), lar_cluster3d::ClusterPathFinder::buildConvexHull(), lar_cluster3d::ConvexHullPathFinder::buildConvexHull(), lar_cluster3d::VoronoiPathFinder::buildConvexHull(), lar_cluster3d::HoughSeedFinderAlg::buildSeed(), lar_cluster3d::ClusterPathFinder::buildVoronoiDiagram(), lar_cluster3d::VoronoiPathFinder::buildVoronoiDiagram(), lar_cluster3d::MinSpanTreeAlg::CheckHitSorting(), lar_cluster3d::ConvexHullPathFinder::completeCandidateCluster(), lar_cluster3d::ClusterMergeAlg::consistentClusters(), lar_cluster3d::Cluster3D::ConvertToArtOutput(), lar_cluster3d::MinSpanTreeAlg::FindBestPathInCluster(), lar_cluster3d::HoughSeedFinderAlg::findHoughClusters(), lar_cluster3d::PCASeedFinderAlg::findTrackSeeds(), lar_cluster3d::ParallelHitsSeedFinderAlg::findTrackSeeds(), lar_cluster3d::PCASeedFinderAlg::getHitsAtEnd(), lar_cluster3d::Cluster3D::MakeAndSavePCAPoints(), lar_cluster3d::ConvexHullPathFinder::makeCandidateCluster(), lar_cluster3d::VoronoiPathFinder::makeCandidateCluster(), lar_cluster3d::ClusterMergeAlg::mergeClusters(), 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().

229 {return m_eigenVectors;}
EigenVectors m_eigenVectors
The three principle axes.
Definition: Cluster3D.h:218
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 224 of file Cluster3D.cxx.

225 {
226  if (a.m_svdOK && b.m_svdOK)
227  return a.m_eigenValues[0] > b.m_eigenValues[0];
228 
229  return false; //They are equal
230 }
std::ostream& operator<< ( std::ostream &  o,
const PrincipalComponents a 
)
friend

Definition at line 204 of file Cluster3D.cxx.

205 {
206  if (a.m_svdOK)
207  {
208  o << std::setiosflags(std::ios::fixed) << std::setprecision(2);
209  o << " PCAxis ID run with " << a.m_numHitsUsed << " space points" << std::endl;
210  o << " - center position: " << std::setw(6) << a.m_avePosition[0] << ", " << a.m_avePosition[1] << ", " << a.m_avePosition[2] << std::endl;
211  o << " - eigen values: " << std::setw(8) << std::right << a.m_eigenValues[0] << ", "
212  << a.m_eigenValues[1] << ", " << a.m_eigenValues[2] << std::endl;
213  o << " - average doca: " << a.m_aveHitDoca << std::endl;
214  o << " - Principle axis: " << std::setw(7) << std::setprecision(4) << a.m_eigenVectors[0][0] << ", " << a.m_eigenVectors[0][1] << ", " << a.m_eigenVectors[0][2] << std::endl;
215  o << " - second axis: " << std::setw(7) << std::setprecision(4) << a.m_eigenVectors[1][0] << ", " << a.m_eigenVectors[1][1] << ", " << a.m_eigenVectors[1][2] << std::endl;
216  o << " - third axis: " << std::setw(7) << std::setprecision(4) << a.m_eigenVectors[2][0] << ", " << a.m_eigenVectors[2][1] << ", " << a.m_eigenVectors[2][2] << std::endl;
217  }
218  else
219  o << " Principal Components Axis is not valid" << std::endl;
220 
221  return o;
222 }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112

Member Data Documentation

double reco::PrincipalComponents::m_aveHitDoca
mutableprivate

Average doca of hits used in PCA.

Definition at line 220 of file Cluster3D.h.

Referenced by reco::operator<<().

float reco::PrincipalComponents::m_avePosition[3]
private

Average position of hits fed to PCA.

Definition at line 219 of file Cluster3D.h.

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

float reco::PrincipalComponents::m_eigenValues[3]
private

Eigen values from SVD decomposition.

Definition at line 217 of file Cluster3D.h.

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

EigenVectors reco::PrincipalComponents::m_eigenVectors
private

The three principle axes.

Definition at line 218 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 216 of file Cluster3D.h.

Referenced by reco::operator<<().

bool reco::PrincipalComponents::m_svdOK
private

SVD Decomposition was successful.

Definition at line 215 of file Cluster3D.h.

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


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