Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
lardataobj
lardataobj
RecoBase
PCAxis.cxx
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////////
2
//
3
// \file PCAxis.cxx
4
// \brief Definition of Principal Components Axis object for LArSoft
5
//
6
// \author usher@slac.stanford.edu
7
//
8
// \see PCAxis.h
9
//
10
////////////////////////////////////////////////////////////////////////////
11
12
#include "
lardataobj/RecoBase/PCAxis.h
"
13
14
#include <iomanip>
15
#include <ostream>
16
17
namespace
recob
18
{
19
20
//----------------------------------------------------------------------
21
PCAxis::PCAxis
()
22
{
23
}
24
25
//----------------------------------------------------------------------
26
PCAxis::PCAxis
(
bool
ok,
27
int
nHits,
28
const
double
* eigenValues,
29
const
recob::PCAxis::EigenVectors
& eigenVecs,
30
const
double
* avePos,
31
const
double
aveHitDoca,
32
size_t
id
) :
33
fSvdOK
(ok),
34
fNumHitsUsed
(nHits),
35
fEigenVectors
(eigenVecs),
36
fAveHitDoca
(aveHitDoca),
37
fID
(id)
38
{
39
fEigenValues
[0] = eigenValues[0];
40
fEigenValues
[1] = eigenValues[1];
41
fEigenValues
[2] = eigenValues[2];
42
fAvePosition
[0] = avePos[0];
43
fAvePosition
[1] = avePos[1];
44
fAvePosition
[2] = avePos[2];
45
}
46
47
//----------------------------------------------------------------------
48
// ostream operator.
49
//
50
std::ostream&
operator<<
(std::ostream & o,
const
PCAxis
&
a
)
51
{
52
if
(a.
fSvdOK
)
53
{
54
o << std::setiosflags(std::ios::fixed) <<
std::setprecision
(2);
55
o <<
" PCAxis ID "
<< a.
fID
<<
" run with "
<< a.
fNumHitsUsed
<<
" space points"
<<
std::endl
;
56
o <<
" - center position: "
<<
std::setw
(6) << a.
fAvePosition
[0] <<
", "
<< a.
fAvePosition
[1] <<
", "
<< a.
fAvePosition
[2] <<
std::endl
;
57
o <<
" - eigen values: "
<<
std::setw
(8) <<
std::right
<< a.
fEigenValues
[0] <<
", "
58
<< a.
fEigenValues
[1] <<
", "
<< a.
fEigenValues
[2] <<
std::endl
;
59
o <<
" - average doca: "
<< a.
fAveHitDoca
<<
std::endl
;
60
o <<
" - Principle axis: "
<<
std::setw
(7) <<
std::setprecision
(4) << a.
fEigenVectors
[0][0] <<
", "
<< a.
fEigenVectors
[0][1] <<
", "
<< a.
fEigenVectors
[0][2] <<
std::endl
;
61
o <<
" - second axis: "
<<
std::setw
(7) <<
std::setprecision
(4) << a.
fEigenVectors
[1][0] <<
", "
<< a.
fEigenVectors
[1][1] <<
", "
<< a.
fEigenVectors
[1][2] <<
std::endl
;
62
o <<
" - third axis: "
<<
std::setw
(7) <<
std::setprecision
(4) << a.
fEigenVectors
[2][0] <<
", "
<< a.
fEigenVectors
[2][1] <<
", "
<< a.
fEigenVectors
[2][2] <<
std::endl
;
63
}
64
else
65
o <<
" Principal Components Axis is not valid"
<<
std::endl
;
66
67
return
o;
68
}
69
70
//----------------------------------------------------------------------------
71
// comparison operator
72
//
73
bool
operator <
(
const
PCAxis
&
a
,
const
PCAxis
&
b
)
74
{
75
if
(a.
getID
() != b.
getID
())
76
return
a.
getID
() < b.
getID
();
77
78
return
false
;
//They are equal
79
}
80
81
}
// End of namespace
recob::PCAxis::fSvdOK
bool fSvdOK
SVD Decomposition was successful.
Definition:
PCAxis.h:35
recob
Reconstruction base classes.
Definition:
AdcChannelData.h:91
recob::PCAxis::operator<
friend bool operator<(const PCAxis &a, const PCAxis &b)
Definition:
PCAxis.cxx:73
recob::PCAxis::fEigenValues
double fEigenValues[3]
Eigen values from SVD decomposition.
Definition:
PCAxis.h:37
setprecision
Q_EXPORT QTSManip setprecision(int p)
Definition:
qtextstream.h:343
recob::PCAxis
Definition:
PCAxis.h:25
recob::PCAxis::getID
size_t getID() const
Definition:
PCAxis.h:69
PCAxis.h
recob::PCAxis::operator<<
friend std::ostream & operator<<(std::ostream &o, const PCAxis &a)
Definition:
PCAxis.cxx:50
a
const double a
Definition:
gUpMuFluxGen.cxx:164
recob::PCAxis::fID
size_t fID
axis ID
Definition:
PCAxis.h:41
recob::PCAxis::fEigenVectors
EigenVectors fEigenVectors
The three principle axes.
Definition:
PCAxis.h:38
wirecell.validate.cmaps.right
right
Definition:
cmaps.py:84
setw
Q_EXPORT QTSManip setw(int w)
Definition:
qtextstream.h:331
recob::PCAxis::PCAxis
PCAxis()
Definition:
PCAxis.cxx:21
recob::PCAxis::fNumHitsUsed
int fNumHitsUsed
Number of hits in the decomposition.
Definition:
PCAxis.h:36
b
static bool * b
Definition:
config.cpp:1043
recob::PCAxis::fAveHitDoca
double fAveHitDoca
Average doca of hits used in PCA.
Definition:
PCAxis.h:40
recob::PCAxis::fAvePosition
double fAvePosition[3]
Average position of hits fed to PCA.
Definition:
PCAxis.h:39
recob::PCAxis::EigenVectors
std::vector< std::vector< double > > EigenVectors
Definition:
PCAxis.h:29
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11