LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
recob::PCAxis Class Reference

#include "PCAxis.h"

Public Types

typedef std::vector< std::vector< double > > EigenVectors
 

Public Member Functions

 PCAxis ()
 
 PCAxis (bool ok, int nHits, const double *eigenValues, const EigenVectors &eigenVecs, const double *avePos, const double aveHitDoca=9999., size_t id=0)
 
bool getSvdOK () const
 
int getNumHitsUsed () const
 
const double * getEigenValues () const
 
const EigenVectorsgetEigenVectors () const
 
const double * getAvePosition () const
 
double getAveHitDoca () const
 
size_t getID () const
 

Private Attributes

bool fSvdOK
 SVD Decomposition was successful. More...
 
int fNumHitsUsed
 Number of hits in the decomposition. More...
 
double fEigenValues [3]
 Eigen values from SVD decomposition. More...
 
EigenVectors fEigenVectors
 The three principle axes. More...
 
double fAvePosition [3]
 Average position of hits fed to PCA. More...
 
double fAveHitDoca
 Average doca of hits used in PCA. More...
 
size_t fID
 axis ID More...
 

Friends

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

Detailed Description

Definition at line 24 of file PCAxis.h.

Member Typedef Documentation

typedef std::vector<std::vector<double> > recob::PCAxis::EigenVectors

Definition at line 26 of file PCAxis.h.

Constructor & Destructor Documentation

recob::PCAxis::PCAxis ( )

Definition at line 20 of file PCAxis.cxx.

20 {}
recob::PCAxis::PCAxis ( bool  ok,
int  nHits,
const double *  eigenValues,
const EigenVectors eigenVecs,
const double *  avePos,
const double  aveHitDoca = 9999.,
size_t  id = 0 
)

Definition at line 23 of file PCAxis.cxx.

References fAvePosition, and fEigenValues.

30  : fSvdOK(ok), fNumHitsUsed(nHits), fEigenVectors(eigenVecs), fAveHitDoca(aveHitDoca), fID(id)
31  {
32  fEigenValues[0] = eigenValues[0];
33  fEigenValues[1] = eigenValues[1];
34  fEigenValues[2] = eigenValues[2];
35  fAvePosition[0] = avePos[0];
36  fAvePosition[1] = avePos[1];
37  fAvePosition[2] = avePos[2];
38  }
bool fSvdOK
SVD Decomposition was successful.
Definition: PCAxis.h:31
double fEigenValues[3]
Eigen values from SVD decomposition.
Definition: PCAxis.h:33
size_t fID
axis ID
Definition: PCAxis.h:37
EigenVectors fEigenVectors
The three principle axes.
Definition: PCAxis.h:34
int fNumHitsUsed
Number of hits in the decomposition.
Definition: PCAxis.h:32
double fAveHitDoca
Average doca of hits used in PCA.
Definition: PCAxis.h:36
double fAvePosition[3]
Average position of hits fed to PCA.
Definition: PCAxis.h:35

Member Function Documentation

double recob::PCAxis::getAveHitDoca ( ) const
inline

Definition at line 82 of file PCAxis.h.

References fAveHitDoca.

Referenced by recob::dumper::DumpPCAxis().

83 {
84  return fAveHitDoca;
85 }
double fAveHitDoca
Average doca of hits used in PCA.
Definition: PCAxis.h:36
const double * recob::PCAxis::getAvePosition ( ) const
inline

Definition at line 78 of file PCAxis.h.

References fAvePosition.

Referenced by recob::dumper::DumpPCAxis(), and cosmic::CosmicPCAxisTagger::produce().

79 {
80  return fAvePosition;
81 }
double fAvePosition[3]
Average position of hits fed to PCA.
Definition: PCAxis.h:35
const double * recob::PCAxis::getEigenValues ( ) const
inline

Definition at line 70 of file PCAxis.h.

References fEigenValues.

Referenced by ShowerRecoTools::ShowerPCAEigenvalueLength::CalculateElement(), recob::dumper::DumpPCAxis(), and cosmic::CosmicPCAxisTagger::produce().

71 {
72  return fEigenValues;
73 }
double fEigenValues[3]
Eigen values from SVD decomposition.
Definition: PCAxis.h:33
const recob::PCAxis::EigenVectors & recob::PCAxis::getEigenVectors ( ) const
inline

Definition at line 74 of file PCAxis.h.

References fEigenVectors.

Referenced by recob::dumper::DumpPCAxis(), ShowerRecoTools::ShowerPCADirection::GetPCAxisVector(), and cosmic::CosmicPCAxisTagger::produce().

75 {
76  return fEigenVectors;
77 }
EigenVectors fEigenVectors
The three principle axes.
Definition: PCAxis.h:34
size_t recob::PCAxis::getID ( ) const
inline

Definition at line 86 of file PCAxis.h.

References fID.

Referenced by recob::dumper::DumpPCAxis(), and recob::operator<().

87 {
88  return fID;
89 }
size_t fID
axis ID
Definition: PCAxis.h:37
int recob::PCAxis::getNumHitsUsed ( ) const
inline

Definition at line 66 of file PCAxis.h.

References fNumHitsUsed.

Referenced by recob::dumper::DumpPCAxis().

67 {
68  return fNumHitsUsed;
69 }
int fNumHitsUsed
Number of hits in the decomposition.
Definition: PCAxis.h:32
bool recob::PCAxis::getSvdOK ( ) const
inline

Definition at line 62 of file PCAxis.h.

References fSvdOK.

Referenced by recob::dumper::DumpPCAxis().

63 {
64  return fSvdOK;
65 }
bool fSvdOK
SVD Decomposition was successful.
Definition: PCAxis.h:31

Friends And Related Function Documentation

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

Definition at line 69 of file PCAxis.cxx.

70  {
71  if (a.getID() != b.getID()) return a.getID() < b.getID();
72 
73  return false; //They are equal
74  }
std::ostream& operator<< ( std::ostream &  o,
const PCAxis a 
)
friend

Definition at line 43 of file PCAxis.cxx.

44  {
45  if (a.fSvdOK) {
46  o << std::setiosflags(std::ios::fixed) << std::setprecision(2);
47  o << " PCAxis ID " << a.fID << " run with " << a.fNumHitsUsed << " space points" << std::endl;
48  o << " - center position: " << std::setw(6) << a.fAvePosition[0] << ", "
49  << a.fAvePosition[1] << ", " << a.fAvePosition[2] << std::endl;
50  o << " - eigen values: " << std::setw(8) << std::right << a.fEigenValues[0] << ", "
51  << a.fEigenValues[1] << ", " << a.fEigenValues[2] << std::endl;
52  o << " - average doca: " << a.fAveHitDoca << std::endl;
53  o << " - Principle axis: " << std::setw(7) << std::setprecision(4) << a.fEigenVectors[0][0]
54  << ", " << a.fEigenVectors[0][1] << ", " << a.fEigenVectors[0][2] << std::endl;
55  o << " - second axis: " << std::setw(7) << std::setprecision(4) << a.fEigenVectors[1][0]
56  << ", " << a.fEigenVectors[1][1] << ", " << a.fEigenVectors[1][2] << std::endl;
57  o << " - third axis: " << std::setw(7) << std::setprecision(4) << a.fEigenVectors[2][0]
58  << ", " << a.fEigenVectors[2][1] << ", " << a.fEigenVectors[2][2] << std::endl;
59  }
60  else
61  o << " Principal Components Axis is not valid" << std::endl;
62 
63  return o;
64  }
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 recob::PCAxis::fAveHitDoca
private

Average doca of hits used in PCA.

Definition at line 36 of file PCAxis.h.

Referenced by getAveHitDoca(), and recob::operator<<().

double recob::PCAxis::fAvePosition[3]
private

Average position of hits fed to PCA.

Definition at line 35 of file PCAxis.h.

Referenced by getAvePosition(), recob::operator<<(), and PCAxis().

double recob::PCAxis::fEigenValues[3]
private

Eigen values from SVD decomposition.

Definition at line 33 of file PCAxis.h.

Referenced by getEigenValues(), recob::operator<<(), and PCAxis().

EigenVectors recob::PCAxis::fEigenVectors
private

The three principle axes.

Definition at line 34 of file PCAxis.h.

Referenced by getEigenVectors(), and recob::operator<<().

size_t recob::PCAxis::fID
private

axis ID

Definition at line 37 of file PCAxis.h.

Referenced by getID(), and recob::operator<<().

int recob::PCAxis::fNumHitsUsed
private

Number of hits in the decomposition.

Definition at line 32 of file PCAxis.h.

Referenced by getNumHitsUsed(), and recob::operator<<().

bool recob::PCAxis::fSvdOK
private

SVD Decomposition was successful.

Definition at line 31 of file PCAxis.h.

Referenced by getSvdOK(), and recob::operator<<().


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