Public Types | Public Member Functions | Private Attributes | Friends | List of all members
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
 
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 222 of file Cluster3D.h.

Member Typedef Documentation

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

Definition at line 226 of file Cluster3D.h.

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

Definition at line 227 of file Cluster3D.h.

Constructor & Destructor Documentation

reco::PrincipalComponents::PrincipalComponents ( )

Definition at line 190 of file Cluster3D.cxx.

190  :
191  m_svdOK(false),
192  m_numHitsUsed(0),
193  m_eigenValues(EigenValues::Zero()),
194  m_eigenVectors(EigenVectors::Zero()),
195  m_avePosition(Eigen::Vector3f::Zero()),
196  m_aveHitDoca(9999.)
197 {}
bool m_svdOK
SVD Decomposition was successful.
Definition: Cluster3D.h:233
double m_aveHitDoca
Average doca of hits used in PCA.
Definition: Cluster3D.h:238
EigenValues m_eigenValues
Eigen values from SVD decomposition.
Definition: Cluster3D.h:235
Eigen::Vector3f m_avePosition
Average position of hits fed to PCA.
Definition: Cluster3D.h:237
EigenVectors m_eigenVectors
The three principle axes.
Definition: Cluster3D.h:236
int m_numHitsUsed
Number of hits in the decomposition.
Definition: Cluster3D.h:234
reco::PrincipalComponents::PrincipalComponents ( bool  ok,
int  nHits,
const EigenValues eigenValues,
const EigenVectors eigenVecs,
const Eigen::Vector3f &  avePos,
const float  aveHitDoca = 9999. 
)

Definition at line 199 of file Cluster3D.cxx.

199  :
200  m_svdOK(ok),
201  m_numHitsUsed(nHits),
202  m_eigenValues(eigenValues),
203  m_eigenVectors(eigenVecs),
204  m_avePosition(avePos),
205  m_aveHitDoca(aveHitDoca)
206 {}
bool m_svdOK
SVD Decomposition was successful.
Definition: Cluster3D.h:233
double m_aveHitDoca
Average doca of hits used in PCA.
Definition: Cluster3D.h:238
EigenValues m_eigenValues
Eigen values from SVD decomposition.
Definition: Cluster3D.h:235
Eigen::Vector3f m_avePosition
Average position of hits fed to PCA.
Definition: Cluster3D.h:237
EigenVectors m_eigenVectors
The three principle axes.
Definition: Cluster3D.h:236
int m_numHitsUsed
Number of hits in the decomposition.
Definition: Cluster3D.h:234

Member Function Documentation

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

Definition at line 208 of file Cluster3D.cxx.

209 {
210  m_eigenVectors.row(axisDir) = -m_eigenVectors.row(axisDir);
211 
212  return;
213 }
EigenVectors m_eigenVectors
The three principle axes.
Definition: Cluster3D.h:236
const float reco::PrincipalComponents::getAveHitDoca ( ) const
inline

Definition at line 249 of file Cluster3D.h.

249 {return m_aveHitDoca;}
double m_aveHitDoca
Average doca of hits used in PCA.
Definition: Cluster3D.h:238
const Eigen::Vector3f& reco::PrincipalComponents::getAvePosition ( ) const
inline

Definition at line 248 of file Cluster3D.h.

248 {return m_avePosition;}
Eigen::Vector3f m_avePosition
Average position of hits fed to PCA.
Definition: Cluster3D.h:237
const EigenValues& reco::PrincipalComponents::getEigenValues ( ) const
inline

Definition at line 246 of file Cluster3D.h.

246 {return m_eigenValues;}
EigenValues m_eigenValues
Eigen values from SVD decomposition.
Definition: Cluster3D.h:235
const EigenVectors& reco::PrincipalComponents::getEigenVectors ( ) const
inline

Definition at line 247 of file Cluster3D.h.

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

Definition at line 245 of file Cluster3D.h.

245 {return m_numHitsUsed;}
int m_numHitsUsed
Number of hits in the decomposition.
Definition: Cluster3D.h:234
bool reco::PrincipalComponents::getSvdOK ( ) const
inline

Definition at line 244 of file Cluster3D.h.

244 {return m_svdOK;}
bool m_svdOK
SVD Decomposition was successful.
Definition: Cluster3D.h:233
void reco::PrincipalComponents::setAveHitDoca ( double  doca) const
inline

Definition at line 252 of file Cluster3D.h.

252 {m_aveHitDoca = doca;}
double m_aveHitDoca
Average doca of hits used in PCA.
Definition: Cluster3D.h:238

Friends And Related Function Documentation

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

Definition at line 235 of file Cluster3D.cxx.

236 {
237  if (a.m_svdOK && b.m_svdOK)
238  return a.m_eigenValues(0) > b.m_eigenValues(0);
239 
240  return false; //They are equal
241 }
const double a
static bool * b
Definition: config.cpp:1043
std::ostream& operator<< ( std::ostream &  o,
const PrincipalComponents a 
)
friend

Definition at line 215 of file Cluster3D.cxx.

216 {
217  if (a.m_svdOK)
218  {
219  o << std::setiosflags(std::ios::fixed) << std::setprecision(2);
220  o << " PCAxis ID run with " << a.m_numHitsUsed << " space points" << std::endl;
221  o << " - center position: " << std::setw(6) << a.m_avePosition(0) << ", " << a.m_avePosition(1) << ", " << a.m_avePosition(2) << std::endl;
222  o << " - eigen values: " << std::setw(8) << std::right << a.m_eigenValues(0) << ", "
223  << a.m_eigenValues(1) << ", " << a.m_eigenValues(1) << std::endl;
224  o << " - average doca: " << a.m_aveHitDoca << std::endl;
225  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;
226  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;
227  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;
228  }
229  else
230  o << " Principal Components Axis is not valid" << std::endl;
231 
232  return o;
233 }
Q_EXPORT QTSManip setprecision(int p)
Definition: qtextstream.h:343
const double a
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
QTextStream & endl(QTextStream &s)

Member Data Documentation

double reco::PrincipalComponents::m_aveHitDoca
mutableprivate

Average doca of hits used in PCA.

Definition at line 238 of file Cluster3D.h.

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

Average position of hits fed to PCA.

Definition at line 237 of file Cluster3D.h.

EigenValues reco::PrincipalComponents::m_eigenValues
private

Eigen values from SVD decomposition.

Definition at line 235 of file Cluster3D.h.

EigenVectors reco::PrincipalComponents::m_eigenVectors
private

The three principle axes.

Definition at line 236 of file Cluster3D.h.

int reco::PrincipalComponents::m_numHitsUsed
private

Number of hits in the decomposition.

Definition at line 234 of file Cluster3D.h.

bool reco::PrincipalComponents::m_svdOK
private

SVD Decomposition was successful.

Definition at line 233 of file Cluster3D.h.


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